/* =========================
   RESET & BASE
   ========================= */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f4f6f9;
    color: #2d3436;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =========================
   HEADER
   ========================= */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 100;
}

header {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #fff;
    padding: 1.2rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

header h1::before {
    content: "📊 ";
}

header nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

header nav a {
    color: #dfe6e9;
    text-decoration: none;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

header nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

header nav a.active {
    background: #0984e3;
    color: #fff;
}

header hr {
    display: none;
}

/* =========================
   BANQUE NAV (sticky bar)
   ========================= */
.banque-nav {
    background: #16213e;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
    padding: 0.6rem 2rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.banque-nav-groupe {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.banque-nav-groupe-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 0.3rem;
    margin-bottom: 0.3rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    width: 100%;
}

.banque-nav-groupe-comptes {
    display: flex;
    gap: 0.3rem;
    justify-content: center;
    flex-wrap: wrap;
}

.banque-nav-item {
    text-decoration: none;
    color: #dfe6e9;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
    background: rgba(255, 255, 255, 0.05);
}

.banque-nav-nom {
    font-weight: 600;
    font-size: 0.9rem;
    color: #fff;
}

.banque-nav-item-type {
    font-weight: 600;
    font-size: 0.85rem;
}

.banque-nav-item-num {
    font-size: 0.7rem;
    opacity: 0.75;
}

.banque-nav-detail {
    font-size: 0.7rem;
    opacity: 0.75;
}

/* Comptes indépendants (hors compta.) : ton gris, légèrement estompé */
.banque-nav-item.banque-nav-item-hors {
    background: rgba(255, 255, 255, 0.03);
    color: #8a94a0;
    border: 1px dashed rgba(255, 255, 255, 0.18);
}

.banque-nav-item.banque-nav-item-hors:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #b2bec3;
}

.banque-nav-item.banque-nav-item-hors.active {
    background: #4b5563;
    color: #dfe6e9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.banque-nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.banque-nav-item.active {
    background: #0984e3;
    color: #fff;
    box-shadow: 0 2px 8px rgba(9, 132, 227, 0.3);
}

/* =========================
   SUB NAV (Opérations / Relevé)
   ========================= */
.sub-nav {
    background: #0f3460;
    display: flex;
    justify-content: center;
    gap: 0;
    padding: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.sub-nav-item {
    text-decoration: none;
    color: #b2bec3;
    padding: 0.6rem 2rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}

.sub-nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.sub-nav-item.active {
    color: #fff;
    border-bottom-color: #0984e3;
}

/* =========================
   MAIN CONTENT
   ========================= */
h2 {
    font-size: 1.6rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 1.5rem 2rem 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #0984e3;
    display: inline-block;
}

/* =========================
   BANQUE BUTTONS
   ========================= */
.banque-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1rem 2rem 1.5rem;
}

.banque-buttons a {
    text-decoration: none;
}

.banque-buttons button {
    background: #fff;
    border: 2px solid #dfe6e9;
    padding: 0.6rem 1.4rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #2d3436;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.banque-buttons button:hover {
    border-color: #0984e3;
    color: #0984e3;
    background: #f0f8ff;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(9, 132, 227, 0.15);
}

.banque-buttons button:active {
    transform: translateY(0);
}

.banque-buttons button.active {
    background: #0984e3;
    color: #fff;
    border-color: #0984e3;
    box-shadow: 0 4px 12px rgba(9, 132, 227, 0.3);
    transform: translateY(-1px);
}

.banque-buttons button.active:hover {
    background: #0773c5;
    color: #fff;
    border-color: #0773c5;
}

/* =========================
   TABLE
   ========================= */
.table-wrapper {
    width: calc(100% - 4rem);
    margin: 0 2rem 2rem;
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

table thead {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
}

table thead th {
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 0.9rem 1rem;
    text-align: center;
    border: none;
    white-space: nowrap;
}

table thead th:not(:last-child) {
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

table tbody tr {
    transition: background 0.15s ease;
}

table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

table tbody tr:hover {
    background: #eef5ff;
}

table tbody td {
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid #f0f0f0;
    border: none;
    white-space: normal;
    word-wrap: break-word;
}

table tbody td:not(:last-child) {
    border-right: 1px solid #f0f0f0;
}

/* Solde initial row */
table tbody tr.row-solde-initial {
    background: linear-gradient(135deg, #f8f9fa, #eef1f5) !important;
}

table tbody tr.row-solde-initial td {
    font-weight: 600;
    color: #1a1a2e;
}

/* Future operations coloring */
table tbody tr.row-future-odd {
    background: #ecedd4 !important;
}

table tbody tr.row-future-odd td {
    color: #575115;
}

table tbody tr.row-future-even {
    background: #e8d5f5 !important;
}

table tbody tr.row-future-even td {
    color: #6b21a8;
}

/* Column alignments */
table tbody td:nth-child(2) {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.85rem;
    color: #636e72;
    white-space: nowrap;
}

table tbody td:nth-child(6),
table tbody td:nth-child(7),
table tbody td:nth-child(8) {
    font-family: 'Consolas', 'Courier New', monospace;
    text-align: right;
    font-weight: 500;
}

/* Credit positive */
table tbody td:nth-child(6) {
    color: #00b894;
}

/* Debit negative */
table tbody td:nth-child(7) {
    color: #d63031;
}

/* Balance */
table tbody td:nth-child(8) {
    color: #1a1a2e;
}

/* Balance negative */
table tbody td:nth-child(8):empty::after {
    content: "0,00";
    color: #b2bec3;
}

/* =========================
   BANQUE CARDS (Accueil)
   ========================= */
.banque-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    margin: 1rem 2rem 1.5rem;
}

.banque-card {
    display: block;
    background: #fff;
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
    text-decoration: none;
    color: #2d3436;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    border: 2px solid transparent;
    transition: all 0.25s ease;
}

.banque-card:hover {
    border-color: #0984e3;
    box-shadow: 0 6px 20px rgba(9, 132, 227, 0.12);
    transform: translateY(-3px);
}

.banque-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.4rem;
}

.banque-card-type {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1a1a2e;
}

.banque-card-info {
    font-size: 0.85rem;
    color: #636e72;
}

.banque-card-solde {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 1.4rem;
    font-weight: 700;
}

.banque-card-solde.positif {
    color: #00b894;
}

.banque-card-solde.negatif {
    color: #d63031;
}

.solde-global {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 2rem 2rem;
    padding: 1.2rem 1.5rem;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 12px;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
}

.solde-global span:last-child {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 1.4rem;
}

.solde-global .positif {
    color: #55efc4;
}

.solde-global .negatif {
    color: #ff7675;
}

.solde-global-lignes {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
}

.solde-ligne {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 500;
}

.solde-ligne span:last-child {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.95rem;
}

.solde-ligne.solde-total {
    margin-top: 0.4rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    font-size: 1.1rem;
    font-weight: 700;
}

.solde-ligne.solde-total span:last-child {
    font-size: 1.4rem;
}

/* =========================
   OP ACTIONS (edit/delete)
   ========================= */
table tbody td:nth-child(9) {
    white-space: nowrap;
    padding: 0.4rem 0.6rem;
    vertical-align: middle;
    text-align: center;
}

.btn-edit,
.btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.15s ease;
    border: none;
    cursor: pointer;
}

.btn-edit {
    background: #eef5ff;
    color: #0984e3;
}

.btn-edit:hover {
    background: #0984e3;
    color: #fff;
}

.btn-delete {
    background: #fff0f0;
    color: #d63031;
}

.btn-delete:hover {
    background: #d63031;
    color: #fff;
}

.delete-form {
    margin: 0;
    padding: 0;
    display: inline;
}

/* =========================
   OP FORM (add/edit)
   ========================= */
.op-actions {
    display: flex;
    gap: 0.6rem;
    margin: 0 2rem 0.8rem;
}

.btn-toggle-form {
    background: #0984e3;
    color: #fff;
    border: none;
    padding: 0.6rem 1.4rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-toggle-form:hover {
    background: #0773c5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(9, 132, 227, 0.3);
}

.btn-import {
    display: inline-block;
    background: #6c5ce7;
    color: #fff;
    border: none;
    padding: 0.6rem 1.4rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-import:hover {
    background: #5a4bd1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.op-form {
    display: none;
    margin: 0 2rem 1.2rem;
    padding: 1.2rem 1.5rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border-left: 4px solid #0984e3;
}

.op-form.visible {
    display: block;
}

.op-traspaso {
    display: none;
    margin-top: 1rem;
    padding: 1rem 1.2rem 0.6rem;
    border-radius: 10px;
    background: #f0f8ff;
    border: 1px solid #bcd7f2;
}

.op-traspaso .form-row {
    align-items: flex-end;
}

.op-traspaso-hint {
    margin: 0.6rem 0 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    color: #0984e3;
    font-size: 0.8rem;
    text-align: left;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.15s ease;
    border: none;
    cursor: pointer;
    background: #eef9ff;
    color: #0984e3;
}

.btn-link:hover {
    background: #0984e3;
    color: #fff;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: flex-end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
    min-width: 130px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #636e72;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
    padding: 0.5rem 0.7rem;
    border: 2px solid #dfe6e9;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #fafbfc;
    transition: border-color 0.2s ease;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #0984e3;
    background: #fff;
}

.form-group input.input-error {
    border-color: #d63031;
    background: #fff5f5;
}

.form-group input.input-error:focus {
    border-color: #d63031;
}

.form-group input[type="number"] {
    font-family: 'Consolas', 'Courier New', monospace;
}

.input-credit {
    color: #00b894;
}

.input-debit {
    color: #d63031;
}

.input-disabled {
    background: rgba(0, 0, 0, 0.05);
    color: #636e72;
    cursor: not-allowed;
}

.form-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    min-width: auto;
}

.btn-submit,
.btn-cancel {
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    display: inline-block;
}

.btn-submit {
    background: #00b894;
    color: #fff;
}

.btn-submit:hover {
    background: #00a381;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 184, 148, 0.3);
}

.btn-cancel {
    background: #dfe6e9;
    color: #636e72;
}

.btn-cancel:hover {
    background: #b2bec3;
    color: #fff;
}

/* =========================
   NO SELECTION MESSAGE
   ========================= */
p:not(header p, footer p) {
    margin: 1rem 2rem;
    padding: 1.5rem 2rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    color: #636e72;
    font-size: 1rem;
    text-align: center;
    border-left: 4px solid #0984e3;
}

/* =========================
   FOOTER
   ========================= */
hr {
    display: none;
}

footer {
    margin-top: auto;
    background: #1a1a2e;
    color: #b2bec3;
    text-align: center;
    padding: 1rem 2rem;
    font-size: 0.85rem;
}

footer p {
    margin: 0;
}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 0.8rem;
        text-align: center;
        padding: 1rem;
    }

    h2 {
        margin: 1rem 1rem 0.5rem;
        font-size: 1.3rem;
    }

    .banque-buttons {
        margin: 0.8rem 1rem 1.2rem;
    }

    .table-wrapper {
        width: calc(100% - 2rem);
        margin: 0 1rem 1.5rem;
    }

    table {
        font-size: 0.8rem;
    }

    table thead th,
    table tbody td {
        padding: 0.5rem 0.6rem;
    }

    p:not(header p, footer p) {
        margin: 1rem;
    }
}

@media (max-width: 480px) {
    table {
        font-size: 0.75rem;
    }

    table thead th,
    table tbody td {
        padding: 0.4rem 0.4rem;
    }

    .banque-buttons button {
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
    }
}

/* =========================
   IMPORT QIF
   ========================= */
.import-layout {
    margin: 1rem 2rem;
}

.import-upload {
    background: #fff;
    padding: 1.2rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
}

.import-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.import-form .form-group {
    flex: 1;
    min-width: 250px;
}

.import-form .btn-submit {
    white-space: nowrap;
}

.import-table {
    width: 100%;
    margin: 0 0 1.5rem;
}

.import-table select {
    padding: 0.3rem 0.5rem;
    border: 2px solid #dfe6e9;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: inherit;
    background: #fafbfc;
    max-width: 140px;
}

.import-table .col-amount {
    font-family: 'Consolas', 'Courier New', monospace;
    text-align: right;
    font-weight: 500;
    white-space: nowrap;
}

.import-actions {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.import-success {
    margin: 1rem 2rem;
    padding: 1.2rem 1.5rem;
    background: #d4edda;
    border-radius: 12px;
    color: #155724;
    font-weight: 600;
    font-size: 1.1rem;
    border-left: 4px solid #28a745;
}

.btn-back {
    display: inline-block;
    margin: 1rem 2rem;
    padding: 0.6rem 1.4rem;
    background: #0984e3;
    color: #fff;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-back:hover {
    background: #0773c5;
    transform: translateY(-1px);
}

.error-msg {
    margin: 1rem 2rem;
    padding: 1rem 1.5rem;
    background: #fff0f0;
    border-radius: 10px;
    color: #d63031;
    border-left: 4px solid #d63031;
    font-weight: 500;
}

/* =========================
   RELEVÉ BANCAIRE / LETTRAGE
   ========================= */
.rl-layout {
    display: flex;
    gap: 1.5rem;
    margin: 1rem 2rem;
    align-items: flex-start;
}

.rl-sidebar {
    flex: 0 0 280px;
    position: sticky;
    top: 1rem;
}

.rl-upload {
    background: #fff;
    border-radius: 12px;
    padding: 1.2rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    margin-bottom: 1rem;
}

.rl-upload h3,
.rl-list h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rl-upload-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.rl-upload-form .btn-submit {
    align-self: flex-start;
}

.rl-upload-hint {
    display: inline-block;
    margin: -0.35rem 0 0.9rem;
    padding: 0;
    border: 0;
    background: none;
    color: #0984e3;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.rl-upload-hint:hover {
    text-decoration: underline;
}

.modal-box h4 {
    margin: 1.2rem 0 0.5rem;
    font-size: 0.95rem;
    color: #1a1a2e;
}

.modal-box h4:first-of-type {
    margin-top: 0;
}

.aide-etapes {
    margin: 0 0 0.4rem;
    padding-left: 1.25rem;
}

.aide-etapes li {
    margin-bottom: 0.45rem;
    line-height: 1.45;
}

.aide-etapes a {
    word-break: break-all;
}

.rl-list {
    background: #fff;
    border-radius: 12px;
    padding: 1.2rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.rl-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    text-decoration: none;
    color: #2d3436;
    transition: background 0.15s ease;
    margin-bottom: 0.3rem;
}

.rl-item:hover {
    background: #f0f8ff;
}

.rl-item.active {
    background: #eef5ff;
    border-left: 3px solid #0984e3;
}

.rl-item-date {
    font-size: 0.75rem;
    color: #636e72;
    font-weight: 500;
}

.rl-item-name {
    font-size: 0.85rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rl-item-right {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: auto;
    flex-shrink: 0;
}

.rl-item-badge {
    font-size: 0.7rem;
    font-weight: 600;
    background: #dfe6e9;
    color: #636e72;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
}

.rl-item-badge-ok {
    background: #d4edda;
    color: #155724;
}

.rl-item-complete {
    background: #e6f9f0 !important;
}

.rl-item-complete.active {
    background: #d4f5e3 !important;
}

.rl-item-complete.active .rl-item-date {
    color: inherit !important;
}

.rl-item-complete .rl-item-date {
    color: #155724 !important;
}

.rl-item-check {
    color: #00b894;
    font-weight: 700;
    font-size: 0.9rem;
    margin-left: auto;
    flex-shrink: 0;
}

.rl-main {
    flex: 1;
    min-width: 0;
}

.rl-header {
    background: #fff;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.rl-header-title {
    font-weight: 600;
    font-size: 1rem;
    color: #1a1a2e;
}

.rl-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 620px;
}

.rl-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.rl-table thead th:nth-child(1),
.rl-table tbody td:nth-child(1) {
    width: 90px;
}

.rl-table thead th:nth-child(2),
.rl-table tbody td:nth-child(2) {
    width: 30%;
    max-width: 30%;
    overflow: hidden;
}

.rl-table thead th:nth-child(3),
.rl-table tbody td:nth-child(3),
.rl-table thead th:nth-child(4),
.rl-table tbody td:nth-child(4) {
    width: 95px;
}

.rl-table thead th:nth-child(5),
.rl-table tbody td:nth-child(5) {
    width: 28%;
}

.rl-table thead th:nth-child(6),
.rl-table tbody td:nth-child(6) {
    width: 90px;
}

.rl-table tbody td:nth-child(2) {
    white-space: normal;
    overflow-wrap: break-word;
}

.rl-date {
    text-align: center;
    font-family: 'Consolas', 'Courier New', monospace;
    white-space: nowrap;
}

/* Colonnes completes conservees a l'import */
.rl-detail {
    margin-top: 0.3rem;
}

.rl-detail > summary {
    cursor: pointer;
    font-size: 0.8rem;
    color: #666;
    list-style: none;
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fafafa;
}

.rl-detail > summary::-webkit-details-marker {
    display: none;
}

.rl-detail > summary::before {
    content: "\25B8\00a0";
}

.rl-detail[open] > summary::before {
    content: "\25BE\00a0";
}

.rl-detail > summary:hover {
    border-color: #999;
    color: #333;
}

.rl-detail-table {
    margin-top: 0.4rem;
    border-collapse: collapse;
    font-size: 0.82rem;
    width: 100%;
}

.rl-detail-table th,
.rl-detail-table td {
    border: 1px solid #e2e2e2;
    padding: 0.15rem 0.4rem;
    text-align: left;
    vertical-align: top;
    font-weight: normal;
}

.rl-detail-table th {
    background: #f4f4f4;
    color: #555;
    white-space: nowrap;
    width: 1%;
}

.rl-detail-table td {
    font-family: 'Consolas', 'Courier New', monospace;
    overflow-wrap: break-word;
}

.rl-detail-vide {
    color: #aaa;
    font-style: italic;
}

.rl-table tbody tr.rl-reconciled {
    background: #f0fff4 !important;
}

.rl-table tbody tr.rl-reconciled td:not(.rl-amount) {
    color: #2d6a4f;
}

.rl-th-right {
    text-align: right;
}

.rl-th-center {
    text-align: center;
}

.rl-td-center {
    text-align: center;
}

.rl-amount {
    font-family: 'Consolas', 'Courier New', monospace;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}

.rl-amount.positif,
td .positif {
    color: #00b894;
}

.rl-amount.negatif,
td .negatif {
    color: #d63031;
}

.rl-sign {
    display: none;
}

.rl-match-select {
    padding: 0.3rem 0.5rem;
    border: 2px solid #dfe6e9;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: inherit;
    background: #fafbfc;
    max-width: 280px;
    width: 100%;
}

.rl-match-select option.rl-suggested {
    background: #fff3cd;
    font-weight: 600;
}

.rl-match-select option.rl-suggested-perfect {
    background: #9fe7c7;
    font-weight: 600;
}

.rl-match-select.rl-match-presel {
    border-color: #f9ca24;
    background: #fffdf5;
}

.rl-match-select.rl-match-perfect {
    border-color: #00b894;
    background: #f0fff9;
}

.rl-matched-label {
    font-size: 0.85rem;
    color: #2d3436;
    vertical-align: middle;
}

.rl-matched-categ {
    color: #636e72;
}

.rl-unlink {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: #fff0f0;
    color: #d63031;
    text-decoration: none;
    font-size: 0.75rem;
    margin-left: 0.4rem;
    transition: all 0.15s ease;
    vertical-align: middle;
}

.rl-unlink:hover {
    background: #d63031;
    color: #fff;
}

.rl-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.rl-badge-ok {
    background: #d4edda;
    color: #155724;
}

.rl-badge-suggest {
    background: #fff3cd;
    color: #856404;
}

.rl-badge-pending {
    background: #e2e3e5;
    color: #383d41;
}

.rl-actions {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    margin-top: 0.5rem;
}

.rl-multi-btn {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
    font-weight: 600;
    opacity: 0.85;
}

.rl-multi-btn:hover {
    opacity: 1;
}

.rl-multi-modal-box {
    max-width: 560px;
    width: 90%;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
}

.rl-multi-modal-box form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
}

.rl-multi-libelle {
    font-size: 0.85rem;
    color: #636e72;
    margin: 0 0 1rem;
    flex: none;
}

.rl-multi-list {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 55vh;
    overflow-y: auto;
    border: 1px solid #e3e8ec;
    border-radius: 8px;
    padding: 0.5rem;
    background: #fafbfc;
}

.rl-multi-opt {
    display: flex;
    flex: none;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.35rem 0.4rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    margin: 0;
}

.rl-multi-opt:hover {
    background: #eef3f8;
}

.rl-multi-opt input {
    margin-top: 0.2rem;
    flex: none;
}

.rl-multi-opt span {
    min-width: 0;
}

.rl-multi-date {
    color: #2d3436;
}

.rl-multi-montant {
    font-weight: 600;
    font-family: 'Consolas', 'Courier New', monospace;
}

.rl-multi-montant.rl-montant-pos {
    color: #00b894;
}

.rl-multi-montant.rl-montant-neg {
    color: #d63031;
}

.rl-multi-categ {
    color: #636e72;
}

.rl-multi-sep {
    color: #b2bec3;
}

.rl-multi-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.8rem;
    padding: 0.6rem 0.8rem;
    border: 1px solid #e3e8ec;
    border-radius: 8px;
    background: #f7f9fb;
    font-size: 0.85rem;
    flex: none;
}

.rl-multi-sum-label {
    font-weight: 600;
    color: #2d3436;
}

.rl-multi-sum-values {
    font-family: 'Consolas', 'Courier New', monospace;
    font-weight: 600;
}

.rl-multi-sum-checked {
    color: #0984e3;
}

.rl-multi-sum-sep {
    color: #b2bec3;
    margin: 0 0.3rem;
}

.rl-multi-sum-total {
    color: #636e72;
}


.rl-multi-label {
    display: block;
    border-left: 3px solid #0984e3;
    padding-left: 0.5rem;
    margin-top: 0.25rem;
}

.rl-multi-line {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.rl-multi-line .rl-multi-label {
    margin-top: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rl-multi-line .rl-unlink {
    flex: none;
    margin-left: 0;
}


.no-data {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    color: #636e72;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

@media (max-width: 900px) {
    .rl-layout {
        flex-direction: column;
    }

    .rl-sidebar {
        flex: none;
        width: 100%;
        position: static;
    }
}

/* =========================
   LETTRAGE CHECK
   ========================= */
.th-check {
    width: 2rem;
}

.td-check {
    text-align: center;
    width: 2rem;
}

.check-ok {
    color: #00b894;
    font-size: 1.1rem;
}

.row-lettre {
    background-color: #e6f9f0 !important;
}

.row-lettre td {
    color: #155724;
}

.row-lettre:nth-child(even) {
    background-color: #d4f5e3 !important;
}

.row-lettre:hover {
    background-color: #b8e8ca !important;
}

/* Row mise en évidence (arrivée via "voir l'opération liée" / edit) */
table tbody tr.row-highlight {
    background: linear-gradient(135deg, #fff3cd, #ffe49e) !important;
    animation: row-flash 2.5s ease-out 1;
}

table tbody tr.row-highlight td {
    color: #7a5b00;
    border-top: 3px solid #e9b02c;
    border-bottom: 3px solid #e9b02c;
}

table tbody tr.row-highlight td:first-child {
    border-left: 3px solid #e9b02c;
}

table tbody tr.row-highlight td:last-child {
    border-right: 3px solid #e9b02c;
}

table tbody tr.row-highlight:nth-child(even) {
    background: linear-gradient(135deg, #fff3cd, #ffe49e) !important;
}

@keyframes row-flash {
    0% { background: #ffd54d !important; }
    100% { background: linear-gradient(135deg, #fff3cd, #ffe49e); }
}

.op-row-target {
    scroll-margin-top: 200px;
}

/* =========================
   GROUPE SECTIONS (Accueil)
   ========================= */
.groupe-section {
    margin: 1.5rem 2rem 1rem;
}

.groupe-titre {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a2e;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #eef5ff, #f8f9fa);
    border-left: 4px solid #0984e3;
    border-radius: 0 8px 8px 0;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.groupe-logo {
    height: 28px;
    width: auto;
    max-width: 80px;
    object-fit: contain;
    vertical-align: middle;
}

.op-logo {
    height: 48px;
    max-width: 140px;
}

.banque-nav-logo {
    height: 28px;
    width: auto;
    max-width: 80px;
    object-fit: contain;
}

/* =========================
   ADMIN PAGE
   ========================= */
.admin-section {
    margin: 1.5rem 2rem;
}

.admin-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 0.8rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #0984e3;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.admin-table thead {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
}

.admin-table thead th {
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.8rem 1rem;
    text-align: left;
    white-space: nowrap;
}

.admin-table tbody td {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background: #f0f8ff;
}

.inline-form {
    margin: 0;
    padding: 0;
    display: inline;
}

.btn-add {
    background: #0984e3;
    color: #fff;
    border: none;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

.btn-cancel {
    background: transparent;
    color: #636e72;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem 0.4rem;
}

.btn-action {
    background: transparent;
    color: #1a1a2e;
    border: 1px solid #dfe6e9;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-action:hover {
    background: #0984e3;
    color: #fff;
    border-color: #0984e3;
}

.btn-disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.input-small {
    width: 70px;
    padding: 0.4rem 0.5rem;
    border: 2px solid #dfe6e9;
    border-radius: 6px;
    font-size: 0.85rem;
    text-align: center;
    background: #fafbfc;
}

.input-small:focus {
    border-color: #0984e3;
    background: #fff;
    outline: none;
}

.input-medium {
    width: 160px;
    padding: 0.4rem 0.5rem;
    border: 2px solid #dfe6e9;
    border-radius: 6px;
    font-size: 0.85rem;
    background: #fafbfc;
}

.input-medium:focus {
    border-color: #0984e3;
    background: #fff;
    outline: none;
}

.input-text {
    padding: 0.4rem 0.7rem;
    border: 2px solid #dfe6e9;
    border-radius: 6px;
    font-size: 0.85rem;
    background: #fafbfc;
}

.input-text:focus {
    border-color: #0984e3;
    background: #fff;
    outline: none;
}

.btn-small {
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
}

.logo-preview {
    height: 32px;
    max-width: 80px;
    object-fit: contain;
}

.logo-preview-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.td-logo-cell {
    white-space: nowrap;
}

.no-logo {
    color: #b2bec3;
    font-size: 1.2rem;
}

.logo-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.logo-actions-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.logo-standalone {
    display: inline;
}

.logo-upload-form {
    display: inline;
}

.btn-upload {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    background: #eef5ff;
    color: #0984e3;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.btn-upload:hover {
    background: #0984e3;
    color: #fff;
}

.btn-upload input[type="file"] {
    display: none;
}

.admin-save {
    margin-top: 1rem;
    padding: 1rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    text-align: right;
}

.admin-save-inline {
    margin-top: 0.5rem;
    text-align: right;
}

.td-actions {
    overflow: visible !important;
    white-space: nowrap;
}

.td-logo {
    position: relative;
    vertical-align: top;
}

.logo-actions-inline {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.3rem;
}

.btn-tiny {
    width: 22px;
    height: 22px;
    padding: 0;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* =========================
   RESPONSIVE ADMIN
   ========================= */
@media (max-width: 900px) {
    .admin-table {
        font-size: 0.8rem;
    }

    .admin-table thead th,
    .admin-table tbody td {
        padding: 0.4rem 0.5rem;
    }

    .input-medium {
        width: 120px;
    }

    .groupe-section {
        margin: 1rem 1rem;
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    box-sizing: border-box;
    overflow-y: auto;
}

.modal-box {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    min-width: 350px;
    max-width: 500px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.modal-box h3 {
    margin: 0 0 1rem;
}

.file-input-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    border: 2px dashed #dfe6e9;
    border-radius: 8px;
    background: #fafbfc;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    text-align: center;
}

.file-input-wrapper:hover {
    border-color: #0984e3;
    background: #fff;
}

.file-input-wrapper input[type="file"] {
    display: none;
}

.file-input-text {
    font-size: 0.9rem;
    color: #636e72;
}

.file-input-wrapper.has-file {
    border-color: #00b894;
    border-style: solid;
    background: #fff;
}

/* =========================
   AUTHENTIFICATION
   ========================= */
.login-body {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    align-items: center;
    justify-content: center;
}

.login-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-box {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.login-box h1 {
    font-size: 1.4rem;
    color: #1a1a2e;
    text-align: center;
    margin-bottom: 0.3rem;
}

.login-box h1::before {
    content: "📊 ";
}

.login-subtitle {
    text-align: center;
    color: #636e72;
    font-size: 0.9rem;
    margin: 0 0 1.5rem;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border-left: none;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-error {
    margin: 0 0 1rem;
}

.login-submit {
    width: 100%;
    padding: 0.7rem;
    font-size: 1rem;
}

.header-user {
    color: #dfe6e9;
    font-size: 0.9rem;
    padding: 0.4rem 0.6rem;
    white-space: nowrap;
}

.header-logout {
    color: #ff7675 !important;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.header-logout:hover {
    background: #d63031 !important;
    color: #fff !important;
}

/* =========================
   ANALYSE : TABLEAU CROISÉ MOIS x CATÉGORIE
   ========================= */
.pivot-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0 2rem 1rem;
}

.pivot-annee {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    font-size: 0.95rem;
}

.pivot-annee a {
    font-weight: 600;
}

.pivot-annee strong {
    font-size: 1.05rem;
}

.pivot-disabled {
    color: #b2bec3;
}

.pivot-scope {
    color: #636e72;
    font-size: 0.9rem;
}

.pivot-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 920px;
}

.pivot-table th,
.pivot-table td {
    border: 1px solid #eef0f3;
    padding: 0.45rem 0.5rem;
    text-align: right;
    font-size: 0.8rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.pivot-table tbody td:nth-child(n) {
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 400;
    white-space: nowrap;
}

.pivot-table thead th {
    background: #f4f5f7;
    color: #2d3436;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
}

.pivot-table tbody th,
.pivot-table tfoot th:first-child {
    text-align: left;
    font-weight: 500;
    color: #2d3436;
}

.pivot-table thead th:first-child,
.pivot-table tbody th,
.pivot-table tfoot th:first-child {
    position: sticky;
    left: 0;
    background: #f8f9fa;
    box-shadow: 1px 0 0 #dfe6e9;
}

.pivot-table thead th:first-child {
    z-index: 2;
}

.pivot-table tbody, .pivot-table tfoot {
    background: #fff;
}

.pivot-empty {
    color: #b2bec3;
}

.pivot-table td .positif {
    color: #00b894;
}

.pivot-table td .negatif {
    color: #d63031;
}

.pivot-table td.positif {
    color: #00b894;
}

.pivot-table td.negatif {
    color: #d63031;
}

.pivot-table .pivot-row-total {
    font-weight: 600;
    background: #f8f9fa;
}

.pivot-table tfoot th,
.pivot-table tfoot td {
    font-weight: 700;
    background: #f4f5f7;
    border-top: 2px solid #dfe6e9;
}

/* =========================
   ANALYSE : COURBE FILTRABLE
   ========================= */
.pivot-chart-title {
    margin: 1.5rem 2rem 1rem;
    color: #2d3436;
}

.chart-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0 2rem 1rem;
}

.chart-sign {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: #636e72;
}

.chart-sign select {
    padding: 0.45rem 0.6rem;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #fff;
    color: #2d3436;
}

.chart-toolbar input[type="search"] {
    flex: 1;
    min-width: 180px;
    padding: 0.45rem 0.7rem;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    font-size: 0.9rem;
}

.chart-actions {
    display: flex;
    gap: 0.4rem;
}

.pivot-btn {
    padding: 0.45rem 0.8rem;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    background: #fff;
    color: #2d3436;
    font-size: 0.9rem;
    cursor: pointer;
}

.pivot-btn:hover {
    background: #f4f5f7;
}

.chart-legend {
    max-height: 220px;
    overflow-y: auto;
    margin: 0 2rem 1rem;
    padding: 0.8rem 1rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
}

.chart-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.4rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
}

.chart-item:hover {
    background: #f4f5f7;
}

.chart-item input[type="checkbox"] {
    accent-color: #0984e3;
    cursor: pointer;
}

.chart-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 10px;
}

.chart-lbl {
    color: #2d3436;
}

.chart-cat-total {
    font-variant-numeric: tabular-nums;
    font-size: 0.78rem;
}

.chart-cat-total.positif {
    color: #00b894;
}

.chart-cat-total.negatif {
    color: #d63031;
}

.chart-box {
    position: relative;
    margin: 0 2rem 2rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.chart-cols {
    display: flex;
    gap: 1.25rem;
    margin: 0 2rem 1rem;
    align-items: flex-start;
}

.chart-all {
    display: flex;
    gap: 2rem;
    margin: 0 1rem 1rem;
    align-items: stretch;
}

.chart-block {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.chart-all .chart-cols {
    flex: 1;
    min-width: 0;
    gap: 0.75rem;
    align-items: stretch;
    margin: 0;
}

.chart-cols-title {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    text-align: center;
}

.chart-all .chart-cols .chart-legend {
    flex: 0 0 220px;
    width: auto;
    min-width: 0;
    height: 620px;
    max-height: 620px;
    overflow-x: hidden;
    overflow-y: auto;
    flex-wrap: nowrap;
    align-content: flex-start;
}

.chart-all .chart-cols .chart-box {
    flex: 1;
    min-width: 0;
    max-width: 75%;
    height: 620px;
}

.chart-cols .chart-legend {
    flex: 0 0 320px;
    margin: 0;
    max-height: 380px;
    flex-direction: column;
    align-content: stretch;
}

.chart-cols .chart-legend .chart-item {
    width: 100%;
}

.chart-cols .chart-box {
    flex: 1;
    min-width: 0;
    margin: 0;
}

#ch-svg,
#ch-svg-rentrees,
#ch-svg-sorties,
#bl-svg {
    display: block;
    width: 100%;
    height: auto;
}

#ch-svg-rentrees,
#ch-svg-sorties {
    height: 100%;
}

.chart-tip {
    position: absolute;
    z-index: 5;
    background: rgba(26, 26, 46, 0.95);
    color: #fff;
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    font-size: 0.8rem;
    min-width: 190px;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.chart-tip-h {
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.chart-tip-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.1rem 0;
}

.chart-tip-row .chart-lbl {
    color: #fff;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chart-tip-row .positif {
    color: #55efc4;
}

.chart-tip-row .negatif {
    color: #ff6b81;
}

/* ---------- Decoupage : soleil a 3 anneaux ---------- */

.slice-drill {
    cursor: zoom-in;
}

.slice-drill:hover {
    opacity: 0.82;
}

.chart-item-drill {
    background: rgba(0, 184, 148, 0.06);
    border-left: 3px solid #00b894;
}

.chart-drill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin-left: 0.35rem;
    padding: 0;
    border: 1px solid #00b894;
    border-radius: 6px;
    background: #ffffff;
    color: #00b894;
    cursor: pointer;
}

.chart-drill:hover {
    background: #00b894;
    color: #ffffff;
}

.sun-panel {
    margin: 1rem 0.5rem 0;
    padding: 1rem;
    border: 1px solid #dfe6e9;
    border-radius: 12px;
    background: #fbfdfd;
}

.sun-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.sun-eyebrow {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #00b894;
}

.sun-title {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: #2d3436;
}

.sun-cat {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #636e72;
}

.sun-close {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    background: #ffffff;
    color: #636e72;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
}

.sun-close:hover {
    background: #ff6b81;
    border-color: #ff6b81;
    color: #ffffff;
}

.sun-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.sun-box svg {
    display: block;
    width: 100%;
    height: auto;
}

.sun-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #636e72;
}

/* Sans cela, `display:flex` ci-dessus l'emporte sur le [hidden]{display:none}
   du navigateur : la legende resterait visible sous un panneau vide,
   soit une barre horizontale orpheline. */
.sun-foot[hidden],
.sun-box[hidden] {
    display: none;
}

.sun-legend {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.sun-legend i {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid #ffffff;
}

.sun-r0 { background: #6c7ae0; }
.sun-r1 { background: #8f9ae6; }
.sun-r2 { background: #b3baec; }

.sun-hint {
    margin-left: auto;
    font-style: italic;
    color: #95a5a6;
}

/* ---------- Administration : cases de decoupage ---------- */

.analyse-explain {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border-left: 4px solid #00b894;
    border-radius: 0 8px 8px 0;
    background: rgba(0, 184, 148, 0.06);
    font-size: 0.85rem;
    line-height: 1.55;
}

.analyse-explain ul {
    margin: 0.4rem 0 0.6rem 1.1rem;
}

.analyse-explain li {
    margin-bottom: 0.2rem;
}

.analyse-explain-note {
    margin: 0.6rem 0 0;
    color: #636e72;
}

.analyse-cat-active {
    background: rgba(0, 184, 148, 0.08);
}
