/* style.css de MyBudget : extrait automatiquement de celui de MyCRM
   (règles dont les classes et identifiants servent ici, ordre d'origine conservé). */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f6fa;
    color: #1e293b;
    min-height: 100vh;
    overflow-x: auto;
}

.header {
    background: #ffffff;
    padding: 0.2rem 1rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.025);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #1a1f3a;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-logo-link {
    display: inline-flex;
    align-items: center;
    position: relative;
}

.header-logo {
    max-height: 75px;
    width: auto;
    display: block;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.header h1 {
    font-size: 1.6rem;
    color: #1a1f3a;
    font-weight: 700;
}

.header .subtitle {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.2rem;
    font-weight: 500;
}

/* Éléments user-info masqués - utilisés uniquement pour la synchronisation avec le menu burger */

#userInfo {
    display: none !important;
}

.card {
    --card-base-color: #4f46e5;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--card-color, var(--card-base-color));
    border-radius: 8px;
    padding: 0.9rem;
    cursor: pointer;
    /* Évite la sélection de texte et le menu contextuel iOS pendant l'appui
       long du drag tactile (sans bloquer le scroll vertical des colonnes). */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
    max-width: 280px;
    width: 100%;
    display: flex;
    position: relative;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1);
    border-color: #cbd5e1;
    border-left-color: var(--card-color, var(--card-base-color));
}

.btn,
.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.45rem;
    line-height: 1.2;
    white-space: nowrap;
}

.btn {
    flex: 0 0 auto;
    padding: 0.6rem 0.8rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    min-height: 40px;
}

.btn-primary {
    background: #2563eb;
    color: white;
    border: 1px solid rgba(147, 197, 253, 0.35);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}

.btn-secondary {
    background: rgba(100, 116, 139, 0.14);
    color: #334155;
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.btn-secondary:hover {
    background: rgba(100, 116, 139, 0.18);
    border-color: rgba(148, 163, 184, 0.5);
    transform: translateY(-1px);
}

.btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.045);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.6);
}

.admin-content {
    padding: 1.5rem 2rem 2.5rem;
    max-width: 1100px;
    margin: 0 auto;
}

.admin-card {
    background: #ffffff;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.087);
    transition: border-color 0.3s, box-shadow 0.3s;
    min-width: 0; /* évite que le contenu (clés longues) fasse déborder la grille */
}

.admin-card:hover {
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.113);
}

.admin-card + .admin-card {
    margin-top: 1.25rem;
}

.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.admin-card-title-group {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.admin-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.admin-card-icon--pennylane {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid rgba(96, 165, 250, 0.35);
}

.admin-card-icon--users {
    background: #ecfdf5;
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.3);
    font-size: 1.1rem;
}

/* ===== Onglet API publique ===== */

.admin-card-icon--api {
    background: #eff6ff;
    color: #0284c7;
    border: 1px solid rgba(56, 189, 248, 0.35);
    font-size: 1.1rem;
}

.admin-card-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.admin-card-subtitle {
    font-size: 0.78rem;
    color: #64748b;
    margin: 0;
    line-height: 1.3;
}

.admin-grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.admin-settings {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-width: 0;
}

.admin-form label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
    padding: 0.7rem 0.85rem;
    background: #ffffff;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    color: #1e293b;
    font-size: 0.9rem;
    transition: all 0.25s;
    min-width: 0; /* clés longues : reste dans la carte */
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.55);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
    background: #ffffff;
}

.admin-form textarea {
    resize: vertical;
}

.admin-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.btn-sm {
    padding: 0.55rem 1.1rem !important;
    font-size: 0.82rem !important;
}

.admin-form-hint {
    color: #64748b;
    font-size: 0.72rem;
    margin-top: 0.2rem;
    display: block;
}

.admin-api-status {
    padding: 0.65rem 0.9rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    animation: fadeIn 0.3s ease-in-out;
}

.admin-api-status.success {
    background: rgba(56, 161, 105, 0.12);
    border: 1px solid rgba(56, 161, 105, 0.3);
    color: #16a34a;
}

.admin-api-status.error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: #dc2626;
}

.admin-api-status.info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #2563eb;
}

.admin-api-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: #64748b;
    padding: 0.5rem 0.7rem;
    background: rgba(99, 102, 241, 0.06);
    border-radius: 6px;
    flex-wrap: wrap;
    min-width: 0;
}

/* Clé masquée : césure des longues chaînes sans espaces */

.admin-api-meta span:not(.admin-api-meta-icon):not(.admin-api-updated) {
    overflow-wrap: break-word;
    word-break: break-all;
    min-width: 0;
}

.admin-api-meta-icon {
    font-size: 0.85rem;
    flex-shrink: 0;
}

.admin-api-updated {
    font-style: italic;
    color: #64748b;
    flex-shrink: 0;
}

@media (max-width: 768px) {
body:not(.admin-page) {
        padding-top: 4.5rem;
        padding-bottom: 80px; /* Espace pour la barre d'outils mobile */
    }
body:not(.admin-page) .header {
        padding: 0.5rem 0.8rem;
        position: fixed;
        left: 0;
        right: 0;
        top: 0;
        z-index: 1400;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.4rem;
        border-bottom: 1px solid rgba(99, 102, 241, 0.25);
    }
/* Le bouton hamburger est déjà visible par défaut sur toutes les tailles d'écran */
/* La navigation desktop est déjà masquée par défaut */
/* Masquer les actions rapides du header sur mobile (elles seront dans la toolbar en bas) */
/* SAUF le bouton hamburger qui reste visible */
body:not(.admin-page) .header-actions > *:not(.mobile-menu-toggle) {
        display: none !important;
    }
body:not(.admin-page) .header-actions {
        display: flex !important;
        gap: 0;
    }
body:not(.admin-page) .header-brand {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex-direction: row;
        justify-content: space-between;
        position: relative;
    }
/* Logo et titre sur la même ligne */
body:not(.admin-page) .header-brand > a {
        flex-shrink: 0;
    }
body:not(.admin-page) .header-brand > div {
        flex: 1;
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
body:not(.admin-page) .header-brand h1 {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
body:not(.admin-page) .header-brand .subtitle {
        display: none;
    }
body:not(.admin-page) .header-logo {
        max-height: 40px;
    }
body:not(.admin-page) .card {
        padding: 0.75rem;
    }
body:not(.admin-page) .btn {
        padding: 0.7rem;
        font-size: 0.85rem;
    }
}

body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f6fa;
    min-height: 100vh;
    padding: 1.5rem;
}

.login-card {
    background: #ffffff;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 16px;
    padding: 2.2rem 2.4rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 25px 60px rgba(10, 12, 40, 0.55);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.login-logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    animation: logoFadeIn 1s ease-out;
}

.login-logo {
    max-width: 120px;
    height: auto;
    filter: drop-shadow(0 4px 12px rgba(102, 126, 234, 0.3));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.login-logo:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 6px 20px rgba(102, 126, 234, 0.5));
}

@keyframes logoFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-header h1 {
    font-size: 1.8rem;
    background: #4f46e5;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.4rem;
    text-align: center;
    animation: titleFadeIn 1s ease-out 0.2s both;
}

@keyframes titleFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header p {
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
    animation: subtitleFadeIn 1s ease-out 0.4s both;
}

@keyframes subtitleFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-body {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    align-items: center;
}

.login-status {
    font-size: 0.85rem;
    color: #4338ca;
    text-align: center;
}

.login-error {
    font-size: 0.8rem;
    color: #dc2626;
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.4);
    padding: 0.7rem;
    border-radius: 8px;
    text-align: center;
}

.login-footer {
    text-align: center;
    font-size: 0.8rem;
    color: #64748b;
}

.login-footer a {
    color: #4f46e5;
}

@media (max-width: 560px) {
.login-card {
        padding: 1.6rem 1.2rem;
        gap: 1.1rem;
    }
}

/* ===== SYSTÈME D'ONGLETS ADMIN ===== */

.admin-tabs {
    width: 100%;
}

.admin-tab-content {
    min-height: 400px;
}

.admin-tab-panel {
    display: none;
    animation: adminFadeIn 0.35s ease-out;
}

.admin-tab-panel.active {
    display: block;
}

@keyframes adminFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.is-skeleton {
    position: relative;
    overflow: hidden;
    color: transparent !important;
    border-radius: 8px;
    background: rgba(148, 163, 184, 0.16);
    min-width: 4.5rem;
}

.is-skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
    animation: statsShimmer 1.4s infinite;
}

@keyframes statsShimmer {
    100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
.is-skeleton::after {
        animation: none !important;
    }
}

/* ===== STYLES TRÉSORERIE ===== */

.treasury-container {
    width: 100%;
    max-width: 100%;
    padding: 1.5rem;
    overflow-x: hidden;
    box-sizing: border-box;
}

.treasury-tabs {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.24);
    margin-bottom: 1rem;
}

.treasury-tab-btn {
    border: 1px solid transparent;
    background: transparent;
    color: #475569;
    padding: 0.48rem 0.95rem;
    border-radius: 9px;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.15;
}

.treasury-tab-btn:hover {
    color: #1e293b;
    background: #f1f5f9;
}

.treasury-tab-btn.active {
    color: #ffffff;
    background: #4f46e5;
    border-color: #4f46e5;
}

.treasury-tab-panel {
    display: none;
}

.treasury-tab-panel.active {
    display: block;
}

.treasury-header-card {
    position: relative;
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 16px;
    padding: 1.1rem 1.2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.treasury-header-main h2 {
    margin: 0;
    color: #0f172a;
    font-size: 1.3rem;
}

.treasury-header-main p {
    margin: 0.35rem 0 0;
    color: #475569;
    font-size: 0.9rem;
}

.treasury-source-chip {
    margin-top: 0.65rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.14);
    border: 1px solid rgba(99, 102, 241, 0.32);
    color: #4338ca;
    font-size: 0.78rem;
    line-height: 1.2;
    position: relative;
}

/* `display: inline-flex` l'emporte sur l'attribut hidden : on le rétablit
   explicitement, sinon le chip vide apparaît avant la première réponse. */

.treasury-source-chip[hidden] {
    display: none;
}

.treasury-source-chip[data-status="warning"] {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.4);
    color: #b45309;
}

.treasury-source-chip[data-status="error"] {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.42);
    color: #b91c1c;
}

.treasury-source-chip-dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: #6ee7b7;
    box-shadow: 0 0 0 3px rgba(110, 231, 183, 0.18);
}

.treasury-source-chip[data-status="warning"] .treasury-source-chip-dot {
    background: #facc15;
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.18);
}

.treasury-source-chip[data-status="error"] .treasury-source-chip-dot {
    background: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2);
}

.treasury-source-chip-label {
    font-weight: 500;
    letter-spacing: 0.01em;
}

.treasury-source-chip-info {
    width: 1.1rem;
    height: 1.1rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(100, 116, 139, 0.18);
    color: inherit;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: ui-serif, Georgia, serif;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
}

.treasury-source-chip-info:hover,
.treasury-source-chip-info:focus-visible {
    background: rgba(100, 116, 139, 0.18);
    outline: none;
}

.treasury-source-chip-tooltip {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    z-index: 10;
    min-width: 18rem;
    max-width: 26rem;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid rgba(99, 102, 241, 0.32);
    color: #334155;
    font-size: 0.78rem;
    line-height: 1.45;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.113);
}

.treasury-source-chip-tooltip ul {
    margin: 0.35rem 0 0;
    padding-left: 1.1rem;
}

.treasury-source-chip-tooltip li {
    margin: 0.18rem 0;
}

.treasury-source-chip-tooltip code {
    background: rgba(100, 116, 139, 0.16);
    padding: 0.05rem 0.35rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #1e293b;
}

.treasury-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.treasury-controls label {
    color: #475569;
    font-size: 0.85rem;
}

/* ----- Barre de contrôles épurée + menu Options ----- */

.treasury-control-field {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.treasury-controls-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.treasury-options {
    position: relative;
    display: inline-flex;
}

.treasury-options-btn,
.treasury-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.treasury-options-gear,
.treasury-refresh-icon {
    font-size: 1rem;
    line-height: 1;
}

.treasury-options-caret {
    font-size: 0.65rem;
    opacity: 0.75;
    transition: transform 0.18s ease;
}

.treasury-options.is-open .treasury-options-caret {
    transform: rotate(180deg);
}

.treasury-options.is-open .treasury-options-btn {
    border-color: rgba(129, 140, 248, 0.6);
    background: rgba(99, 102, 241, 0.16);
}

.treasury-options-menu {
    position: fixed; /* positionné en JS : évite tout clipping (overflow ancêtres) */
    z-index: 1000;
    width: 340px;
    max-width: calc(100vw - 16px);
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 14px;
    box-shadow: 0 22px 50px rgba(15, 23, 42, 0.138);
    padding: 0.85rem 0.95rem 0.95rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.treasury-options-menu[hidden] {
    display: none;
}

.treasury-options-title {
    margin: 0 0 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #8b95b3;
}

.treasury-option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    padding: 0.6rem 0;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.treasury-options-title + .treasury-option-row {
    border-top: 0;
    padding-top: 0.3rem;
}

.treasury-option-row .treasury-ios-switch {
    flex-shrink: 0;
}

.treasury-option-copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.treasury-option-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    line-height: 1.25;
}

.treasury-option-desc {
    font-size: 0.74rem;
    color: #64748b;
    line-height: 1.35;
}

.treasury-options-divider {
    height: 1px;
    background: rgba(100, 116, 139, 0.16);
    margin: 0.75rem 0 0.6rem;
}

.treasury-options-action {
    width: 100%;
    justify-content: center;
    text-align: center;
    margin-top: 0.45rem;
    font-size: 0.82rem;
}

/* `hidden` doit primer dans le menu (la règle globale .btn force inline-flex) :
   ex. « Réactiver les exclusions auto » reste masqué tant qu'il n'est pas requis. */

.treasury-options-menu [hidden] {
    display: none !important;
}

.treasury-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.3rem 0.55rem 0.3rem 0.7rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.057);
    min-height: 34px;
    transition: border-color 0.18s ease, background 0.18s ease;
}

.treasury-filter-toggle:hover {
    border-color: rgba(148, 163, 184, 0.55);
    background: #ffffff;
}

.treasury-filter-toggle-hint {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.treasury-cursor-tooltip {
    position: fixed;
    top: 0;
    left: 0;
    max-width: 300px;
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    font-size: 0.72rem;
    line-height: 1.4;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
    pointer-events: none;
    z-index: 10000;
    opacity: 0;
    transform: translate3d(0, 0, 0);
    transition: opacity 0.14s ease;
    white-space: normal;
}

.treasury-cursor-tooltip.is-visible {
    opacity: 1;
}

.treasury-ios-switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
    cursor: pointer;
    flex: 0 0 auto;
}

.treasury-ios-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.treasury-ios-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(120, 120, 128, 0.45);
    transition: background 0.2s ease, box-shadow 0.2s ease;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.treasury-ios-slider::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.09), 0 1px 1px rgba(15, 23, 42, 0.06);
}

.treasury-ios-switch input:checked + .treasury-ios-slider {
    background: #34c759;
    box-shadow: inset 0 0 0 1px rgba(52, 199, 89, 0.78);
}

.treasury-ios-switch input:checked + .treasury-ios-slider::before {
    transform: translateX(14px);
}

.treasury-ios-switch input:focus-visible + .treasury-ios-slider {
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.108), 0 0 0 3px rgba(52, 199, 89, 0.3);
}

.treasury-ios-switch input:disabled + .treasury-ios-slider {
    opacity: 0.55;
    cursor: not-allowed;
}

.treasury-export-btn {
    white-space: nowrap;
    min-width: 132px;
}

.treasury-export-btn--pdf-icon::before {
    content: "";
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    background-image: url("../images/pdf-icon.svg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.treasury-export-btn--xlsx-icon::before {
    content: "";
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    background-image: url("../images/excel-icon.svg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.treasury-export-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ----- Export PDF : menu des versions (simple / détaillée) ----- */

.treasury-export-pdf-menu {
    padding: 0.75rem 0.6rem 0.6rem;
}

.treasury-export-pdf-menu .treasury-options-title {
    padding: 0 0.4rem;
}

.treasury-export-pdf-choice {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    width: 100%;
    padding: 0.55rem 0.6rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.treasury-export-pdf-choice + .treasury-export-pdf-choice {
    margin-top: 0.2rem;
}

.treasury-export-pdf-choice:hover,
.treasury-export-pdf-choice:focus-visible {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(129, 140, 248, 0.45);
    outline: none;
}

.treasury-custom-range {
    display: none;
    width: 100%;
    margin-top: 0.4rem;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.treasury-custom-range.is-visible {
    display: flex;
}

.treasury-custom-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.treasury-custom-field label {
    color: #475569;
    font-size: 0.8rem;
}

.treasury-select {
    background: #ffffff;
    color: #334155;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    min-height: 40px;
    padding: 0.4rem 0.6rem;
    font-size: 0.88rem;
    outline: none;
}

.treasury-date-input {
    background: #ffffff;
    color: #334155;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    min-height: 40px;
    padding: 0.4rem 0.6rem;
    font-size: 0.88rem;
    outline: none;
}

.treasury-select:focus {
    border-color: rgba(59, 130, 246, 0.7);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.treasury-date-input:focus {
    border-color: rgba(59, 130, 246, 0.7);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.treasury-status {
    display: none;
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.treasury-status.is-info {
    color: #1d4ed8;
    border-color: rgba(59, 130, 246, 0.3);
    background: #eff6ff;
}

.treasury-status.is-success {
    color: #15803d;
    border-color: rgba(34, 197, 94, 0.3);
    background: #ecfdf5;
}

.treasury-status.is-error {
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.3);
    background: #fef2f2;
}

/* ---------------------------------------------------------------------------
   Chargement non bloquant (Trésorerie)
   La page s'affiche immédiatement. Au premier chargement, les zones qui
   attendent des données montrent un squelette ; lors d'une actualisation, les
   chiffres déjà affichés restent lisibles pendant qu'une barre de progression
   et une pastille « synchronisation » signalent le travail en arrière-plan.
   --------------------------------------------------------------------------- */

/* Barre de progression indéterminée, collée au bord haut de la carte d'en-tête. */

.treasury-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    overflow: hidden;
    border-radius: 16px 16px 0 0;
    background: rgba(79, 70, 229, 0.12);
}

.treasury-progress[hidden] {
    display: none;
}

.treasury-progress-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 38%;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(79, 70, 229, 0) 0%, #4f46e5 35%, #818cf8 65%, rgba(79, 70, 229, 0) 100%);
    animation: treasuryProgressSlide 1.5s ease-in-out infinite;
}

@keyframes treasuryProgressSlide {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(360%);
    }
}

/* Rangée des badges d'en-tête : pastille de synchronisation + chip « Source ». */

.treasury-header-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.65rem;
}

.treasury-header-badges .treasury-source-chip {
    margin-top: 0;
}

.treasury-sync-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 100%;
    padding: 0.32rem 0.75rem 0.32rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #ffffff;
    color: #334155;
    font-size: 0.8rem;
    line-height: 1.2;
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.treasury-sync-pill-icon {
    position: relative;
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #94a3b8;
    box-sizing: border-box;
}

.treasury-sync-pill-label {
    font-weight: 600;
    white-space: nowrap;
}

.treasury-sync-pill-meta {
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

.treasury-sync-pill-meta:empty {
    display: none;
}

/* Chargement / actualisation : anneau qui tourne. */

.treasury-sync-pill[data-state="loading"] {
    border-color: rgba(79, 70, 229, 0.35);
    background: #eef2ff;
    color: #3730a3;
}

.treasury-sync-pill[data-state="loading"] .treasury-sync-pill-icon {
    width: 12px;
    height: 12px;
    background: transparent;
    border: 2px solid rgba(79, 70, 229, 0.25);
    border-top-color: #4f46e5;
    animation: treasurySpinner 0.9s linear infinite;
}

.treasury-sync-pill[data-state="loading"] .treasury-sync-pill-meta {
    color: #4f46e5;
}

/* À jour : données fraîches de Pennylane. */

.treasury-sync-pill[data-state="fresh"] {
    border-color: rgba(34, 197, 94, 0.35);
    background: #f0fdf4;
    color: #166534;
}

.treasury-sync-pill[data-state="fresh"] .treasury-sync-pill-icon {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

/* Cache serveur (moins de 30 min) : lisible, mais on le dit. */

.treasury-sync-pill[data-state="cached"] {
    border-color: rgba(245, 158, 11, 0.4);
    background: #fffbeb;
    color: #92400e;
}

.treasury-sync-pill[data-state="cached"] .treasury-sync-pill-icon {
    background: #f59e0b;
}

/* Actualisation impossible : les données affichées sont conservées. */

.treasury-sync-pill[data-state="warning"] {
    border-color: rgba(249, 115, 22, 0.45);
    background: #fff7ed;
    color: #9a3412;
}

.treasury-sync-pill[data-state="warning"] .treasury-sync-pill-icon {
    background: #f97316;
}

/* Erreur sans aucune donnée à afficher. */

.treasury-sync-pill[data-state="error"] {
    border-color: rgba(239, 68, 68, 0.4);
    background: #fef2f2;
    color: #991b1b;
}

.treasury-sync-pill[data-state="error"] .treasury-sync-pill-icon {
    background: #ef4444;
}

/* Bouton « Actualiser » : l'icône tourne pendant le chargement. */

.treasury-refresh-btn.is-loading .treasury-refresh-icon {
    display: inline-block;
    animation: treasurySpinner 0.9s linear infinite;
}

/* Squelettes (KPI) : blocs chatoyants remplacés par les valeurs à l'arrivée. */

.treasury-skeleton {
    display: inline-block;
    border-radius: 6px;
    background: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 45%, #e2e8f0 90%);
    background-size: 200% 100%;
    animation: treasuryShimmer 1.4s ease-in-out infinite;
}

.treasury-skeleton--kpi {
    width: 62%;
    min-width: 120px;
    height: 1.9rem;
    margin: 0.2rem 0;
}

.treasury-skeleton--sub {
    width: 42%;
    min-width: 90px;
    height: 0.75rem;
}

.treasury-kpi-value.is-skeleton {
    line-height: 1;
}

@keyframes treasuryShimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Valeur KPI modifiée par une actualisation en arrière-plan : bref halo. */

.treasury-kpi-value.is-updated {
    animation: treasuryKpiUpdated 1.6s ease-out;
    border-radius: 8px;
}

@keyframes treasuryKpiUpdated {
    0% {
        box-shadow: 0 0 0 6px rgba(79, 70, 229, 0.16);
        background: rgba(79, 70, 229, 0.1);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
        background: transparent;
    }
}

/* Squelette d'histogramme (premier chargement uniquement). */

.treasury-chart-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 0.7rem;
    min-height: 360px;
    padding: 1rem 1rem 1.2rem;
    border-radius: 12px;
    border: 1px dashed rgba(148, 163, 184, 0.45);
    background: #f8fafc;
}

.treasury-chart-loading[hidden] {
    display: none;
}

.treasury-chart-loading-bars {
    display: flex;
    align-items: flex-end;
    gap: 1.4rem;
    width: min(100%, 640px);
    height: 190px;
    padding: 0 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.45);
}

.treasury-chart-loading-group {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    height: 100%;
}

.treasury-chart-loading-group i {
    display: block;
    width: 22px;
    height: var(--h, 40%);
    border-radius: 6px 6px 2px 2px;
    transform-origin: center bottom;
    background: linear-gradient(180deg, rgba(22, 163, 74, 0.35), rgba(22, 163, 74, 0.1));
    animation: treasurySkeletonBar 1.6s ease-in-out infinite;
}

.treasury-chart-loading-group i:last-child {
    background: linear-gradient(180deg, rgba(220, 38, 38, 0.32), rgba(220, 38, 38, 0.08));
    animation-delay: 0.2s;
}

.treasury-chart-loading-group:nth-child(2) i { animation-delay: 0.15s; }

.treasury-chart-loading-group:nth-child(3) i { animation-delay: 0.3s; }

.treasury-chart-loading-group:nth-child(4) i { animation-delay: 0.45s; }

.treasury-chart-loading-group:nth-child(5) i { animation-delay: 0.6s; }

.treasury-chart-loading-group:nth-child(6) i { animation-delay: 0.75s; }

@keyframes treasurySkeletonBar {
    0%, 100% {
        opacity: 0.55;
        transform: scaleY(0.94);
    }
    50% {
        opacity: 1;
        transform: scaleY(1);
    }
}

.treasury-chart-loading-caption {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #334155;
    font-size: 0.92rem;
    font-weight: 600;
}

.treasury-chart-loading-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(79, 70, 229, 0.25);
    border-top-color: #4f46e5;
    animation: treasurySpinner 0.9s linear infinite;
    flex-shrink: 0;
}

.treasury-chart-loading-elapsed {
    color: #64748b;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.treasury-chart-loading-elapsed:empty {
    display: none;
}

.treasury-chart-loading-hint {
    margin: 0;
    max-width: 560px;
    color: #64748b;
    font-size: 0.82rem;
    text-align: center;
}

.treasury-chart-loading[data-state="error"] {
    border-color: rgba(239, 68, 68, 0.4);
    background: #fef2f2;
}

.treasury-chart-loading[data-state="error"] .treasury-chart-loading-caption {
    color: #991b1b;
}

.treasury-chart-loading[data-state="error"] .treasury-chart-loading-spinner {
    display: none;
}

.treasury-chart-loading[data-state="error"] .treasury-chart-loading-group i {
    animation: none;
    opacity: 0.3;
}

/* Cellules « Chargement… » des tableaux (Prospection, Paramètres) : pulsation. */

.treasury-loading-cell {
    animation: treasuryPulse 1.6s ease-in-out infinite;
}

@keyframes treasuryPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.45;
    }
}

@media (prefers-reduced-motion: reduce) {
.treasury-progress-bar,
    .treasury-skeleton,
    .treasury-chart-loading-group i,
    .treasury-kpi-value.is-updated,
    .treasury-loading-cell {
        animation: none;
    }
}

@keyframes treasurySpinner {
    to {
        transform: rotate(360deg);
    }
}

.treasury-settings-status {
    display: none;
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.treasury-settings-status.is-info {
    color: #1d4ed8;
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.12);
}

.treasury-settings-status.is-success {
    color: #15803d;
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.14);
}

.treasury-settings-status.is-error {
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.12);
}

.treasury-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.treasury-setting-card {
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 12px;
    padding: 0.9rem;
}

.treasury-setting-card label {
    display: block;
    color: #475569;
    font-size: 0.82rem;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.treasury-setting-card p {
    margin: 0.45rem 0 0;
    color: #64748b;
    font-size: 0.77rem;
    line-height: 1.35;
}

.treasury-setting-input {
    width: 100%;
    background: #ffffff;
    color: #334155;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    min-height: 40px;
    padding: 0.42rem 0.58rem;
    font-size: 0.88rem;
    outline: none;
}

.treasury-setting-input:focus {
    border-color: rgba(59, 130, 246, 0.7);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.treasury-hr-card {
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 14px;
    padding: 1rem 1.1rem;
}

.treasury-hr-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.8rem;
}

.treasury-hr-card-header h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1rem;
}

.treasury-hr-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.treasury-hr-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.treasury-hr-table thead th {
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #4f46e5;
    padding: 0.62rem 0.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.28);
}

.treasury-hr-table tbody td {
    padding: 0.55rem 0.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    color: #334155;
}

.treasury-hr-table tbody tr:last-child td {
    border-bottom: none;
}

.treasury-hr-input {
    width: 100%;
    background: #ffffff;
    color: #334155;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 8px;
    min-height: 36px;
    padding: 0.34rem 0.52rem;
    font-size: 0.84rem;
    outline: none;
}

.treasury-hr-input:focus {
    border-color: rgba(59, 130, 246, 0.7);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

.treasury-hr-actions-cell {
    width: 42px;
    text-align: right;
}

.treasury-hr-delete-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(248, 113, 113, 0.45);
    background: rgba(220, 38, 38, 0.22);
    color: #b91c1c;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.treasury-hr-delete-btn:hover {
    background: rgba(220, 38, 38, 0.34);
    border-color: rgba(248, 113, 113, 0.72);
}

.treasury-prospection-card {
    margin-bottom: 1rem;
}

.treasury-prospection-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.treasury-prospection-toolbar .treasury-settings-status {
    margin: 0;
    flex: 1 1 320px;
}

.treasury-prospection-toolbar .treasury-export-btn {
    margin-left: auto;
}

.treasury-prospection-section-header {
    margin-bottom: 0.55rem;
}

.treasury-prospection-section-header .btn {
    flex: 0 0 auto;
}

.treasury-prospection-section-toggle {
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    min-width: 0;
    text-align: left;
    flex: 1 1 auto;
}

.treasury-prospection-section-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.35);
    border-radius: 8px;
}

.treasury-prospection-section-title {
    margin: 0;
    color: #0f172a;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
}

.treasury-prospection-section-chevron {
    color: #475569;
    font-size: 0.92rem;
    transition: transform 0.2s ease;
}

.treasury-prospection-section-toggle[aria-expanded="false"] .treasury-prospection-section-chevron {
    transform: rotate(-90deg);
}

.treasury-prospection-collapsible.is-collapsed {
    display: none;
}

.treasury-prospection-card--certain {
    border-color: rgba(16, 185, 129, 0.42);
    background: #ecfdf5;
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.16);
}

.treasury-prospection-card--certain .treasury-prospection-section-title {
    color: #059669;
}

.treasury-prospection-card--pipeline {
    border-color: rgba(251, 191, 36, 0.42);
    background: #fffbeb;
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.16);
}

.treasury-prospection-card--pipeline .treasury-prospection-section-title {
    color: #b45309;
}

.treasury-prospection-card--prospect {
    border-color: rgba(244, 114, 182, 0.38);
    background: #fff1f2;
    box-shadow: inset 0 0 0 1px rgba(244, 114, 182, 0.16);
}

.treasury-prospection-card--prospect .treasury-prospection-section-title {
    color: #be185d;
}

.treasury-prospection-card--result {
    border-color: rgba(45, 212, 191, 0.36);
    background: #f0fdfa;
    box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.14);
}

.treasury-prospection-card--result .treasury-prospection-section-title {
    color: #0f766e;
    font-size: 0.95rem;
}

.treasury-prospection-help {
    margin: 0 0 0.9rem;
    color: #475569;
    font-size: 0.82rem;
    line-height: 1.4;
}

.treasury-prospection-table {
    min-width: 980px;
}

.treasury-prospection-table .treasury-prospection-etp-input {
    text-align: center;
}

.treasury-prospection-table .treasury-prospection-days-input {
    text-align: center;
}

#treasuryProspectionExpensesTable {
    width: auto;
    min-width: 620px;
    table-layout: fixed;
}

#treasuryProspectionExpensesTable thead th:first-child,
#treasuryProspectionExpensesTable tbody td:first-child {
    width: 240px;
}

#treasuryProspectionExpensesTable thead th:nth-child(n + 2):not(:last-child),
#treasuryProspectionExpensesTable tbody td:nth-child(n + 2):not(:last-child) {
    width: 72px;
}

#treasuryProspectionExpensesTable thead th:last-child,
#treasuryProspectionExpensesTable tbody td:last-child {
    width: 44px;
}

#treasuryProspectionExpensesTable .treasury-prospection-etp-input {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
}

.treasury-prospection-table thead th {
    text-align: center;
    white-space: nowrap;
}

.treasury-prospection-table thead th:first-child {
    text-align: left;
}

.treasury-prospection-table thead th:last-child {
    width: 44px;
}

.treasury-prospection-result-table thead th:last-child {
    width: auto;
}

.treasury-prospection-role-cell {
    min-width: 240px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.treasury-prospection-role-text {
    display: block;
    min-width: 0;
}

.treasury-prospection-row-handle {
    width: 30px;
    height: 30px;
    margin-top: 0.1rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #ffffff;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    line-height: 1;
    cursor: grab;
    touch-action: none;
}

.treasury-prospection-row-handle:active {
    cursor: grabbing;
}

.treasury-prospection-row-handle:hover {
    border-color: rgba(147, 197, 253, 0.75);
    color: #1d4ed8;
}

.treasury-prospection-row-handle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.35);
}

.treasury-prospection-expense-row.is-dragging {
    opacity: 0.42;
}

.treasury-prospection-expense-row.is-drop-target td {
    background: rgba(251, 191, 36, 0.18);
}

.treasury-prospection-role-desc {
    display: block;
    margin-top: 0.18rem;
    font-size: 0.74rem;
    color: #64748b;
    font-weight: 400;
}

.treasury-prospection-table td {
    text-align: center;
}

.treasury-prospection-table td:first-child {
    text-align: left;
}

.treasury-prospection-computed-row td {
    background: rgba(15, 23, 42, 0.06);
    color: #1d4ed8;
}

.treasury-prospection-computed-value {
    font-weight: 600;
}

.treasury-prospection-total-row td {
    background: rgba(59, 130, 246, 0.12);
    border-top: 1px solid rgba(96, 165, 250, 0.4);
    color: #1d4ed8;
    font-weight: 700;
}

.treasury-prospection-total-value {
    color: #2563eb;
}

.treasury-prospection-row-delete-btn {
    margin: 0 auto;
}

.treasury-prospection-expense-delete-btn {
    border-color: rgba(248, 113, 113, 0.38);
    background: rgba(239, 68, 68, 0.12);
    color: #e11d48;
}

.treasury-prospection-expense-delete-btn:hover {
    border-color: rgba(248, 113, 113, 0.62);
    background: rgba(239, 68, 68, 0.12);
    color: #be123c;
}

.treasury-prospection-modal {
    position: fixed;
    inset: 0;
    z-index: 1600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.treasury-prospection-modal[hidden] {
    display: none;
}

.treasury-prospection-modal__backdrop {
    position: absolute;
    inset: 0;
    background: #ffffff;
}

.treasury-prospection-modal__content {
    position: relative;
    z-index: 1;
    width: min(480px, 100%);
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: #ffffff;
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.14);
    padding: 1rem 1rem 0.95rem;
}

.treasury-prospection-modal__content h3 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    color: #0f172a;
}

.treasury-prospection-modal__content label {
    display: block;
    margin: 0 0 0.35rem;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 600;
}

.treasury-prospection-modal__content select {
    width: 100%;
}

.treasury-prospection-modal__help {
    margin: 0 0 0.8rem;
    color: #475569;
    font-size: 0.8rem;
    line-height: 1.35;
}

.treasury-prospection-modal__actions {
    margin-top: 0.9rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
}

.treasury-prospection-result-label {
    min-width: 240px;
    font-weight: 700;
    color: #334155;
}

.treasury-prospection-result-value {
    font-weight: 400;
    color: #0f172a;
}

.treasury-prospection-result-row--certain-gap td {
    background: rgba(30, 58, 138, 0.18);
}

.treasury-prospection-result-row--certain-gap .treasury-prospection-result-value {
    color: #2563eb;
}

.treasury-prospection-result-row--certain-days td {
    background: rgba(59, 130, 246, 0.12);
}

.treasury-prospection-result-row--certain-days .treasury-prospection-result-label {
    color: #c2410c;
}

.treasury-prospection-result-row--certain-days .treasury-prospection-result-value {
    color: #c2410c;
}

.treasury-prospection-result-row--probable-gap td {
    background: rgba(13, 148, 136, 0.2);
}

.treasury-prospection-result-row--probable-gap .treasury-prospection-result-value {
    color: #0f766e;
}

.treasury-prospection-result-row--probable-days td {
    background: rgba(20, 184, 166, 0.12);
}

.treasury-prospection-result-row--probable-days .treasury-prospection-result-label {
    color: #6d28d9;
}

.treasury-prospection-result-row--probable-days .treasury-prospection-result-value {
    color: #7c3aed;
}

.treasury-prospection-chart-svg {
    min-width: 860px;
}

.treasury-bar-projected {
    opacity: 0.72;
    stroke: rgba(191, 219, 254, 0.75);
    stroke-width: 1;
    stroke-dasharray: 4 2;
}

.treasury-line-point-projected {
    fill: #0f766e;
    opacity: 0.65;
}

#treasuryProspectionChartSvg .treasury-chart-projected-zone {
    fill: rgba(251, 191, 36, 0.14);
}

#treasuryProspectionChartSvg .treasury-chart-projected-separator {
    stroke: rgba(251, 191, 36, 0.95);
    stroke-width: 1.8;
    stroke-dasharray: 5 4;
}

#treasuryProspectionChartSvg .treasury-chart-projected-caption {
    fill: #b45309;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

#treasuryProspectionChartSvg .treasury-bar-projected {
    opacity: 0.98;
    stroke: rgba(251, 191, 36, 0.95);
    stroke-width: 1.6;
    stroke-dasharray: 4 2;
    filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.38));
}

#treasuryProspectionChartSvg .treasury-bar-inflow-projected {
    fill: #16a34a;
}

#treasuryProspectionChartSvg .treasury-bar-outflow-projected {
    fill: #dc2626;
}

#treasuryProspectionChartSvg .treasury-line-point-projected {
    opacity: 0.92;
    stroke: rgba(251, 191, 36, 0.92);
    stroke-width: 1.2;
}

.treasury-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.treasury-kpi-card {
    position: relative;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 14px;
    padding: 1rem 1.15rem 1.05rem;
    overflow: hidden;
}

/* Filet d'accent coloré à gauche : repère instantané du type de KPI. */

.treasury-kpi-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: rgba(100, 116, 139, 0.18);
}

.treasury-kpi-card--inflow::before {
    background: #34d399;
}

.treasury-kpi-card--outflow::before {
    background: #f87171;
}

.treasury-kpi-card--net::before {
    background: #38bdf8;
}

.treasury-kpi-card--current {
    border-color: rgba(250, 204, 21, 0.58);
    background: #fef3c7;
}

.treasury-kpi-card--current::before {
    background: #facc15;
}

.treasury-kpi-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
}

.treasury-kpi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
    background: rgba(100, 116, 139, 0.16);
    color: #475569;
}

.treasury-kpi-icon--inflow {
    background: rgba(52, 211, 153, 0.16);
    color: #059669;
}

.treasury-kpi-icon--outflow {
    background: rgba(248, 113, 113, 0.16);
    color: #dc2626;
}

.treasury-kpi-icon--net {
    background: rgba(125, 211, 252, 0.2);
    color: #0369a1;
}

.treasury-kpi-icon--current {
    background: rgba(250, 204, 21, 0.18);
    color: #a16207;
}

.treasury-kpi-label {
    color: #64748b;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.treasury-kpi-value {
    color: #0f172a;
    font-size: clamp(1.9rem, 1.4rem + 1.4vw, 2.35rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.treasury-kpi-sub {
    margin-top: 0.45rem;
    font-size: 0.78rem;
    color: #64748b;
    font-variant-numeric: tabular-nums;
    min-height: 1.1rem;
}

.treasury-kpi-sub[hidden] {
    display: none;
}

.treasury-kpi-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: rgba(100, 116, 139, 0.18);
    color: #475569;
}

.treasury-kpi-badge--positive {
    background: rgba(52, 211, 153, 0.16);
    color: #059669;
}

.treasury-kpi-badge--negative {
    background: rgba(248, 113, 113, 0.16);
    color: #dc2626;
}

/* Variation vs période précédente. La flèche indique le sens, la couleur le
   "bon/mauvais" (une hausse des charges est rouge, pas verte). */

.treasury-kpi-trend {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.treasury-kpi-trend--up {
    color: #059669;
}

.treasury-kpi-trend--down {
    color: #dc2626;
}

.treasury-kpi-trend-ref {
    color: #64748b;
    font-weight: 400;
}

.treasury-kpi-value--current {
    color: #a16207;
}

.treasury-kpi-value--current.is-unavailable {
    color: #a16207;
    font-size: 1.1rem;
    font-weight: 600;
}

.treasury-kpi-value--inflow,
.treasury-value-positive,
.treasury-kpi-value.is-positive {
    color: #059669;
}

.treasury-kpi-value--outflow,
.treasury-value-negative,
.treasury-kpi-value.is-negative {
    color: #dc2626;
}

#treasuryNet {
    color: #0369a1;
}

#treasuryNet.is-positive {
    color: #059669;
}

#treasuryNet.is-negative {
    color: #dc2626;
}

.treasury-chart-card {
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
}

.treasury-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.treasury-chart-header h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1rem;
}

.treasury-chart-legend {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.treasury-legend-item {
    color: #475569;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.treasury-legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}

.treasury-legend-line {
    width: 16px;
    height: 0;
    border-top: 3px solid #ef4444;
    display: inline-block;
    border-radius: 999px;
}

.treasury-legend-line--moving-average {
    border-top: 3px dashed #86efac;
}

.treasury-legend-line--moving-average-outflow {
    border-top: 3px dotted #f87171;
}

.treasury-legend-line--treasury {
    border-top: 3px solid #f59e0b;
}

.treasury-legend-swatch--inflow {
    background: #16a34a;
}

.treasury-legend-swatch--outflow {
    background: #dc2626;
}

.treasury-chart-scroll {
    width: 100%;
    overflow-x: auto;
}

.treasury-chart-svg {
    width: 100%;
    min-width: 760px;
    height: 360px;
    display: block;
}

.treasury-chart-svg text {
    font-family: "SF Pro Text", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-weight: 500;
    letter-spacing: 0;
}

.treasury-chart-empty {
    text-align: center;
    color: #64748b;
    font-style: italic;
    padding: 0.3rem 0 0.1rem;
}

.treasury-chart-grid {
    stroke: #e2e8f0;
    stroke-width: 1;
}

.treasury-chart-axis {
    stroke: #cbd5e1;
    stroke-width: 1.2;
}

.treasury-chart-y-label,
.treasury-chart-x-label {
    fill: #475569;
    font-size: 11px;
}

.treasury-chart-x-label--projected {
    fill: #dc2626;
    font-style: italic;
}

.treasury-chart-bar-value--projected {
    opacity: 0.96;
    font-weight: 700;
}

#treasuryProspectionChartSvg .treasury-chart-x-label--projected {
    fill: #b45309;
    font-style: normal;
    font-weight: 700;
}

.treasury-chart-axis-label {
    fill: #64748b;
    font-size: 12px;
    font-weight: 600;
}

.treasury-chart-bar-value {
    font-size: 9.5px;
    opacity: 0.78;
}

.treasury-chart-bar-value--inflow {
    fill: #16a34a;
}

.treasury-chart-bar-value--outflow {
    fill: #e11d48;
}

.treasury-bar-inflow {
    fill: #22c55e;
    opacity: 0.9;
}

.treasury-bar-inflow:hover {
    opacity: 1;
}

.treasury-bar-outflow {
    fill: #ef4444;
    opacity: 0.9;
}

.treasury-bar-outflow:hover {
    opacity: 1;
}

.treasury-chart-selectable,
.treasury-chart-month-selectable {
    cursor: pointer;
}

.treasury-chart-selectable:focus,
.treasury-chart-month-selectable:focus {
    outline: none;
}

.treasury-chart-selectable.is-selected {
    filter: drop-shadow(0 0 6px rgba(250, 250, 250, 0.45));
    opacity: 1;
}

.treasury-chart-month-selectable.is-selected {
    fill: #0f172a;
    font-weight: 700;
}

.treasury-chart-details {
    margin-top: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    padding-top: 0.95rem;
}

.treasury-chart-details-title {
    margin: 0;
    color: #0f172a;
    font-size: 1rem;
}

.treasury-chart-details-context {
    margin: 0.25rem 0 0;
    color: #64748b;
    font-size: 0.82rem;
}

.treasury-chart-details-columns {
    margin-top: 0.85rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
    align-items: start;
}

.treasury-chart-details-column {
    min-width: 0;
}

.treasury-chart-details-column > .treasury-chart-details-section {
    width: 100%;
    box-sizing: border-box;
}

.treasury-chart-details-column-title {
    margin: 0;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.treasury-chart-details-subtitle {
    margin: 0;
    color: #475569;
    font-size: 0.85rem;
    font-weight: 600;
}

.treasury-chart-details-section {
    margin-top: 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 11px;
    padding: 0.65rem;
    background: rgba(15, 23, 42, 0.033);
}

.treasury-chart-details-section.is-active {
    border-color: rgba(148, 163, 184, 0.38);
    background: rgba(15, 23, 42, 0.051);
}

.treasury-chart-details-section--inflow.is-active {
    border-color: rgba(74, 222, 128, 0.5);
}

.treasury-chart-details-section--outflow.is-active {
    border-color: rgba(251, 113, 133, 0.5);
}

.treasury-chart-details-section--transactions {
    padding: 0.5rem;
    border-radius: 10px;
}

.treasury-chart-details-section--transactions .treasury-chart-details-subtitle {
    font-size: 0.8rem;
}

.treasury-chart-details-section--transactions .treasury-chart-details-list {
    margin-top: 0.35rem;
    gap: 0.34rem;
}

.treasury-chart-details-section--transactions .treasury-chart-details-row {
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
}

.treasury-chart-details-section--transactions .treasury-chart-details-row-header {
    gap: 0.45rem;
    margin-bottom: 0.2rem;
}

.treasury-chart-details-section--transactions .treasury-chart-details-row-name {
    font-size: 0.8rem;
}

.treasury-chart-details-section--transactions .treasury-chart-details-row-meta {
    font-size: 0.76rem;
}

.treasury-chart-details-section--transactions .treasury-chart-details-progress {
    height: 6px;
}

.treasury-chart-details-section--transactions .treasury-chart-macro-accordion {
    gap: 0.32rem;
}

.treasury-chart-details-section--transactions .treasury-chart-macro-group {
    gap: 0.25rem;
}

.treasury-chart-details-section--transactions .treasury-chart-macro-panel {
    margin: 0;
    padding: 0.35rem;
    border-radius: 8px;
}

.treasury-chart-details-section--transactions .treasury-chart-subcategories-list {
    gap: 0.28rem;
}

.treasury-chart-details-section--transactions .treasury-chart-subcategory-actions {
    margin-top: 0.25rem;
}

.treasury-chart-details-section--transactions .treasury-chart-subcategory-action-btn {
    font-size: 0.68rem;
    padding: 0.28rem 0.52rem;
}

.treasury-chart-details-empty {
    margin: 0;
    color: #64748b;
    font-size: 0.84rem;
}

.treasury-chart-details-total-card {
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    padding: 0.6rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.treasury-chart-details-total-card--column {
    margin-top: 0.6rem;
}

.treasury-chart-details-total-label {
    color: #64748b;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.treasury-chart-details-total-value {
    color: #0f172a;
    font-size: 1.03rem;
    line-height: 1.2;
}

.treasury-chart-details-total-value--inflow {
    color: #16a34a;
}

.treasury-chart-details-total-value--outflow {
    color: #e11d48;
}

.treasury-chart-details-list {
    margin-top: 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.treasury-chart-details-row {
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
}

.treasury-chart-details-row--macro {
    width: 100%;
    display: block;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.treasury-chart-details-row--macro:hover {
    border-color: rgba(148, 163, 184, 0.45);
    background: rgba(15, 23, 42, 0.027);
}

.treasury-chart-details-row--macro.is-active {
    border-color: rgba(148, 163, 184, 0.62);
    background: rgba(15, 23, 42, 0.037);
}

.treasury-chart-details-row--macro-inflow:hover {
    border-color: rgba(74, 222, 128, 0.45);
    background: rgba(20, 83, 45, 0.22);
}

.treasury-chart-details-row--macro-inflow.is-active {
    border-color: rgba(74, 222, 128, 0.65);
    background: rgba(20, 83, 45, 0.32);
}

.treasury-chart-details-row--macro-outflow:hover {
    border-color: rgba(251, 113, 133, 0.45);
    background: rgba(239, 68, 68, 0.12);
}

.treasury-chart-details-row--macro-outflow.is-active {
    border-color: rgba(251, 113, 133, 0.62);
    background: rgba(239, 68, 68, 0.12);
}

.treasury-chart-macro-accordion {
    gap: 0.45rem;
}

.treasury-chart-macro-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.treasury-chart-details-row-name-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.treasury-chart-macro-chevron {
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    opacity: 0.65;
    transition: transform 0.18s ease, opacity 0.18s ease;
    flex: 0 0 auto;
}

.treasury-chart-details-row--macro.is-active .treasury-chart-macro-chevron {
    transform: rotate(-135deg);
    opacity: 1;
}

.treasury-chart-macro-panel {
    margin: 0 0.05rem 0.2rem;
    padding: 0.5rem;
    border-radius: 9px;
    border: 1px dashed rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.052);
}

.treasury-chart-macro-panel[hidden] {
    display: none;
}

.treasury-chart-macro-panel--inflow {
    border-color: rgba(74, 222, 128, 0.38);
    background: rgba(20, 83, 45, 0.17);
}

.treasury-chart-macro-panel--outflow {
    border-color: rgba(251, 113, 133, 0.38);
    background: rgba(239, 68, 68, 0.12);
}

.treasury-chart-subcategories-list {
    margin-top: 0;
    gap: 0.38rem;
}

.treasury-chart-subcategory-row {
    background: #ffffff;
    border-color: rgba(148, 163, 184, 0.22);
}

.treasury-chart-subcategory-row.is-excluded {
    border-color: rgba(234, 179, 8, 0.5);
    background: rgba(245, 158, 11, 0.14);
}

.treasury-chart-subcategory-actions {
    margin-top: 0.4rem;
    display: flex;
    justify-content: flex-end;
}

.treasury-chart-subcategory-action-btn {
    appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 999px;
    background: #ffffff;
    color: #334155;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.36rem 0.6rem;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.treasury-chart-subcategory-action-btn:hover:not(:disabled) {
    border-color: rgba(248, 250, 252, 0.62);
    background: #ffffff;
}

.treasury-chart-subcategory-action-btn.is-excluded {
    border-color: rgba(251, 191, 36, 0.65);
    background: rgba(249, 115, 22, 0.16);
    color: #b45309;
}

.treasury-chart-subcategory-action-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ---------------------------------------------------------------------------
   Notes par ligne (client CA / libellé dépense)
   Affichage compact sous le libellé ; édition en place (textarea auto-ajustée,
   raccourcis clavier, état d'enregistrement et erreur inline).
   --------------------------------------------------------------------------- */

.treasury-line-note {
    margin: 0.1rem 0 0.05rem;
}

.treasury-line-note[hidden] {
    display: none;
}

/* Bouton discret « + note » (à gauche de « Exclure »). */

.treasury-line-note-add {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-right: auto;
    padding: 0.3rem 0.55rem 0.3rem 0.4rem;
    border: 1px dashed rgba(148, 163, 184, 0.55);
    border-radius: 999px;
    background: transparent;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

/* `display` explicite ⇒ l'attribut hidden doit être rétabli à la main. */

.treasury-line-note-add[hidden],
.treasury-chart-loading-retry[hidden] {
    display: none;
}

.treasury-line-note-add:hover,
.treasury-line-note-add:focus-visible {
    color: #4338ca;
    border-color: rgba(79, 70, 229, 0.5);
    background: rgba(79, 70, 229, 0.06);
    outline: none;
}

.treasury-line-note-add svg,
.treasury-line-note-text svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

/* Note affichée : cliquable pour modifier. */

.treasury-line-note-text {
    appearance: none;
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    width: 100%;
    padding: 0.38rem 0.55rem 0.38rem 0.6rem;
    border: 1px solid rgba(79, 70, 229, 0.16);
    border-left: 3px solid rgba(79, 70, 229, 0.55);
    border-radius: 8px;
    background: rgba(79, 70, 229, 0.06);
    color: #334155;
    font: inherit;
    font-size: 0.78rem;
    line-height: 1.4;
    text-align: left;
    cursor: text;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.treasury-line-note-text:hover,
.treasury-line-note-text:focus-visible {
    background: rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.3);
    border-left-color: #4f46e5;
    outline: none;
}

.treasury-line-note-text svg {
    margin-top: 0.15rem;
    color: #4f46e5;
    opacity: 0.8;
}

.treasury-line-note-content {
    flex: 1 1 auto;
    min-width: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.treasury-line-note-meta {
    flex-shrink: 0;
    align-self: flex-end;
    color: #94a3b8;
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.treasury-line-note-text.is-saved {
    animation: treasuryLineNoteSaved 1.4s ease-out;
}

@keyframes treasuryLineNoteSaved {
    0% {
        box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.28);
        border-left-color: #22c55e;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

/* Éditeur en place. */

.treasury-line-note-editor {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.treasury-line-note-input {
    width: 100%;
    min-height: 2.4rem;
    max-height: 14rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid rgba(79, 70, 229, 0.45);
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    font: inherit;
    font-size: 0.8rem;
    line-height: 1.4;
    resize: none;
    overflow-y: auto;
    box-sizing: border-box;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.treasury-line-note-input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

.treasury-line-note-input:disabled {
    opacity: 0.7;
}

.treasury-line-note-editor-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.treasury-line-note-counter {
    color: #94a3b8;
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
}

.treasury-line-note-counter.is-near-limit {
    color: #b45309;
}

.treasury-line-note-hint {
    color: #94a3b8;
    font-size: 0.7rem;
}

.treasury-line-note-editor-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
}

.treasury-line-note-btn {
    appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 999px;
    background: #ffffff;
    color: #334155;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.36rem 0.65rem;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

.treasury-line-note-btn:hover:not(:disabled) {
    border-color: rgba(100, 116, 139, 0.6);
    background: #f8fafc;
}

.treasury-line-note-btn--primary {
    border-color: #4f46e5;
    background: #4f46e5;
    color: #ffffff;
}

.treasury-line-note-btn--primary:hover:not(:disabled) {
    border-color: #4338ca;
    background: #4338ca;
}

.treasury-line-note-btn--danger {
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.35);
}

.treasury-line-note-btn--danger:hover:not(:disabled) {
    background: #fef2f2;
    border-color: rgba(239, 68, 68, 0.55);
}

.treasury-line-note-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.treasury-line-note-error {
    margin: 0;
    color: #b91c1c;
    font-size: 0.74rem;
}

.treasury-line-note-error[hidden] {
    display: none;
}

@media (max-width: 480px) {
.treasury-line-note-hint {
        display: none;
    }
.treasury-line-note-editor-actions {
        width: 100%;
        justify-content: flex-end;
    }
.treasury-line-note-meta {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
.treasury-line-note-text.is-saved {
        animation: none;
    }
}

.treasury-chart-excluded-row-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.4rem;
}

.treasury-chart-excluded-include-btn.is-active {
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(187, 247, 208, 0.85);
    color: #15803d;
}

.treasury-chart-draggable {
    cursor: grab;
}

.treasury-chart-draggable:active {
    cursor: grabbing;
}

.treasury-chart-draggable.is-dragging {
    opacity: 0.45;
    outline: 1px dashed rgba(148, 163, 184, 0.6);
}

.is-drop-target {
    outline: 2px dashed rgba(74, 222, 128, 0.85);
    outline-offset: 2px;
    background: rgba(20, 83, 45, 0.25);
    border-radius: 8px;
    transition: background 0.12s ease, outline-color 0.12s ease;
}

.treasury-chart-details-refreshbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0.4rem 0 0.9rem;
    padding: 0.55rem 0.8rem;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.treasury-chart-details-refreshbar-status {
    color: #475569;
    font-size: 0.78rem;
    line-height: 1.35;
}

.treasury-chart-details-refreshbar-status.has-pending {
    color: #b45309;
}

.treasury-chart-details-refresh-btn {
    appearance: none;
    border: 1px solid rgba(96, 165, 250, 0.6);
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.45rem 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.treasury-chart-details-refresh-btn:hover:not(:disabled) {
    border-color: rgba(191, 219, 254, 0.85);
    background: #dbeafe;
    color: #0f172a;
}

.treasury-chart-details-refresh-btn.is-highlight {
    border-color: rgba(253, 224, 71, 0.85);
    background: #fef9c3;
    color: #854d0e;
}

.treasury-chart-details-refresh-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.treasury-chart-excluded-include-btn {
    appearance: none;
    border: 1px solid rgba(74, 222, 128, 0.55);
    border-radius: 999px;
    background: rgba(20, 83, 45, 0.35);
    color: #15803d;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.36rem 0.7rem;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.treasury-chart-excluded-include-btn:hover:not(:disabled) {
    border-color: rgba(187, 247, 208, 0.85);
    background: rgba(34, 197, 94, 0.14);
    color: #15803d;
}

.treasury-chart-excluded-include-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.treasury-chart-details-section--collapsible {
    margin-top: 1rem;
}

.treasury-chart-details-section--collapsible > .treasury-chart-details-section-summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.25);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.treasury-chart-details-section--collapsible > .treasury-chart-details-section-summary:hover {
    background: #ffffff;
    border-color: rgba(203, 213, 225, 0.45);
}

.treasury-chart-details-section--collapsible > .treasury-chart-details-section-summary::-webkit-details-marker {
    display: none;
}

.treasury-chart-details-section--collapsible > .treasury-chart-details-section-summary::before {
    content: '\25B8';
    color: #64748b;
    font-size: 0.75rem;
    transition: transform 0.15s ease;
    transform-origin: center;
    line-height: 1;
}

.treasury-chart-details-section--collapsible[open] > .treasury-chart-details-section-summary::before {
    transform: rotate(90deg);
}

.treasury-chart-details-subtitle--summary {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin: 0;
}

.treasury-chart-details-summary-meta {
    font-size: 0.78rem;
    font-weight: 500;
    color: #64748b;
}

.treasury-chart-details-section-body {
    padding-top: 0.6rem;
}

.treasury-chart-details-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.35rem;
}

.treasury-chart-details-row-name {
    color: #0f172a;
    font-size: 0.85rem;
    font-weight: 600;
}

.treasury-chart-details-row-meta {
    color: #475569;
    font-size: 0.82rem;
}

.treasury-chart-details-progress {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.18);
    overflow: hidden;
}

.treasury-chart-details-progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #f97316;
}

.treasury-chart-details-progress-fill--inflow {
    background: #16a34a;
}

.treasury-chart-details-progress-fill--outflow {
    background: #f97316;
}

.treasury-chart-details-section--inflow-invoices {
    border-color: rgba(74, 222, 128, 0.42);
    width: 100%;
}

.treasury-chart-invoice-kpis {
    margin: 0.55rem 0 0.75rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.45rem;
}

.treasury-chart-invoice-kpi {
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: #ffffff;
    border-radius: 9px;
    padding: 0.5rem 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.16rem;
}

.treasury-chart-invoice-kpi-label {
    color: #64748b;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.treasury-chart-invoice-kpi-value {
    color: #0f172a;
    font-size: 0.96rem;
    line-height: 1.2;
}

.treasury-chart-invoice-kpi-value--paid {
    color: #16a34a;
}

.treasury-chart-invoice-kpi-value--pending {
    color: #e11d48;
}

.treasury-chart-invoice-client-row {
    background: #ffffff;
}

.treasury-chart-invoice-row {
    background: rgba(15, 23, 42, 0.06);
}

.treasury-chart-invoice-client-meta {
    color: #475569;
    font-size: 0.78rem;
    line-height: 1.35;
}

.treasury-line-moving-average {
    fill: none;
    stroke: #16a34a;
    stroke-width: 2.8;
    stroke-dasharray: 7 5;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.treasury-line-point-moving-average {
    fill: #16a34a;
    stroke: rgba(15, 23, 42, 0.9);
    stroke-width: 1.4;
}

.treasury-line-moving-average-outflow {
    fill: none;
    stroke: #dc2626;
    stroke-width: 2.6;
    stroke-dasharray: 2 5;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.treasury-line-point-moving-average-outflow {
    fill: #dc2626;
    stroke: rgba(15, 23, 42, 0.9);
    stroke-width: 1.2;
}

.treasury-chart-mm-value {
    fill: #16a34a;
    font-size: 10px;
    font-weight: 600;
}

/* Courbe de trésorerie : trait continu jaune orangé. Contraste ~2,2:1 sur
   blanc, compensé par le contour sombre des points et le KPI « Trésorerie
   actuelle ». */

.treasury-line-treasury {
    fill: none;
    stroke: #f59e0b;
    stroke-width: 2.6;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.treasury-line-point-treasury {
    fill: #f59e0b;
    stroke: rgba(15, 23, 42, 0.9);
    stroke-width: 1.2;
}

.treasury-loading-cell,
.treasury-empty-cell {
    text-align: center;
    color: #64748b;
    font-style: italic;
}

/* Responsive */

@media (max-width: 768px) {
.admin-content {
        padding: 1rem;
    }
.admin-grid-2 {
        grid-template-columns: 1fr;
    }
.admin-card {
        padding: 1.1rem;
    }
.admin-card-icon {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }
.treasury-container {
        padding: 0.75rem 1rem;
    }
.treasury-header-card {
        padding: 0.9rem;
        gap: 0.8rem;
    }
.treasury-header-main h2 {
        font-size: 1.1rem;
    }
.treasury-header-main p {
        font-size: 0.82rem;
    }
.treasury-controls {
        width: 100%;
        align-items: stretch;
        gap: 0.5rem;
    }
.treasury-select {
        flex: 1 1 100%;
        width: 100%;
    }
.treasury-filter-toggle {
        width: 100%;
        justify-content: space-between;
    }
.treasury-filter-toggle-hint {
        max-width: none;
    }
.treasury-controls .btn,
    .treasury-controls .treasury-export-btn {
        width: 100%;
        min-height: 40px;
    }
/* Les boutons d'export PDF et Excel sont enveloppés (menu des versions) :
       l'enveloppe prend toute la largeur pour garder les boutons alignés. */
.treasury-controls .treasury-export-pdf,
    .treasury-controls .treasury-export-xlsx {
        width: 100%;
    }
.treasury-custom-range {
        gap: 0.6rem;
    }
.treasury-custom-field {
        flex: 1 1 100%;
        min-width: 0;
    }
.treasury-date-input {
        width: 100%;
    }
.treasury-summary-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
.treasury-kpi-card {
        padding: 0.9rem;
    }
.treasury-kpi-value {
        font-size: 1.5rem;
    }
.treasury-chart-card {
        padding: 0.9rem;
    }
.treasury-chart-svg {
        min-width: 640px;
        height: 330px;
    }
.treasury-chart-scroll,
    .treasury-hr-table-wrap {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }
.treasury-chart-details-columns {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }
.treasury-chart-details-row-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }
.treasury-tabs {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.28rem;
    }
.treasury-tab-btn {
        width: 100%;
        text-align: center;
        padding: 0.54rem 0.42rem;
        font-size: 0.8rem;
    }
.treasury-settings-grid {
        grid-template-columns: 1fr;
        gap: 0.7rem;
    }
.treasury-setting-card {
        padding: 0.8rem;
    }
.treasury-hr-card {
        padding: 0.9rem;
    }
.treasury-hr-card-header {
        gap: 0.6rem;
        align-items: stretch;
    }
.treasury-hr-card-header .btn {
        width: 100%;
    }
.treasury-prospection-toolbar {
        align-items: stretch;
        gap: 0.6rem;
    }
.treasury-prospection-toolbar .treasury-settings-status {
        flex-basis: 100%;
    }
.treasury-prospection-toolbar .treasury-export-btn {
        width: 100%;
        margin-left: 0;
    }
.treasury-prospection-table {
        min-width: 780px;
    }
.treasury-prospection-chart-svg {
        min-width: 700px;
        height: 330px;
    }
.treasury-prospection-help {
        font-size: 0.78rem;
    }
.treasury-prospection-modal {
        padding: 0.6rem;
    }
.treasury-prospection-modal__content {
        width: 100%;
        padding: 0.85rem;
    }
.treasury-prospection-modal__actions {
        flex-direction: column-reverse;
    }
.treasury-prospection-modal__actions .btn {
        width: 100%;
    }
.treasury-chart-subcategory-actions {
        justify-content: flex-start;
    }
.treasury-chart-subcategory-action-btn {
        min-height: 34px;
        padding: 0.42rem 0.72rem;
    }
}

/* Très petits écrans mobiles */

@media (max-width: 480px) {
.treasury-container {
        padding: 0.55rem 0.7rem;
    }
.treasury-header-card,
    .treasury-chart-card,
    .treasury-hr-card {
        padding: 0.75rem;
        border-radius: 12px;
    }
.treasury-tab-btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.2rem;
    }
.treasury-filter-toggle {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.45rem;
    }
.treasury-ios-switch {
        align-self: flex-end;
    }
.treasury-chart-svg {
        min-width: 560px;
        height: 300px;
    }
.treasury-prospection-chart-svg {
        min-width: 620px;
        height: 300px;
    }
.treasury-prospection-table {
        min-width: 700px;
    }
.treasury-chart-details-title {
        font-size: 0.92rem;
    }
.treasury-chart-details-row-name {
        font-size: 0.8rem;
    }
.treasury-chart-details-row-meta {
        font-size: 0.76rem;
    }
.treasury-chart-subcategory-action-btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
.treasury-container {
        padding: 0.5rem 0.75rem;
    }
.treasury-header-card {
        padding: 0.75rem;
    }
.treasury-controls {
        gap: 0.45rem;
    }
.treasury-filter-toggle {
        padding: 0.28rem 0.45rem 0.28rem 0.6rem;
    }
.treasury-filter-toggle-hint {
        font-size: 0.62rem;
    }
.treasury-chart-svg {
        min-width: 560px;
        height: 300px;
    }
.treasury-tab-btn {
        font-size: 0.8rem;
        padding: 0.45rem 0.55rem;
    }
.treasury-setting-card label {
        font-size: 0.78rem;
    }
.treasury-setting-card p {
        font-size: 0.74rem;
    }
.treasury-hr-card-header {
        flex-direction: column;
        align-items: stretch;
    }
.treasury-prospection-table {
        min-width: 700px;
    }
.treasury-prospection-chart-svg {
        min-width: 620px;
        height: 300px;
    }
.treasury-prospection-role-cell {
        min-width: 180px;
    }
}

/* Ajustement du contenu principal pour éviter le chevauchement avec le footer */

body:not(.admin-page) {
    padding-bottom: 60px;
}

/* Responsive pour le footer */

@media (max-width: 768px) {
body:not(.admin-page) {
        padding-bottom: 80px;
    }
}

.tab {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #64748b;
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    bottom: -2px;
}

.tab:hover {
    color: #475569;
    background: rgba(99, 102, 241, 0.05);
}

.tab.active {
    color: #4f46e5;
    border-bottom-color: #6366f1;
}

.btn-secondary {
    background: rgba(100, 116, 139, 0.14);
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: #334155;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(100, 116, 139, 0.18);
    border-color: rgba(148, 163, 184, 0.5);
    transform: translateY(-1px);
}

@media (max-width: 768px) {
.tab {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

.btn-primary {
    background: #2563eb;
    color: white;
    border: 1px solid rgba(147, 197, 253, 0.35);
    padding: 0.75rem 2rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

/* ===============================================
   HEADER NAVIGATION MENU (REMPLACÉ PAR MENU BURGER)
   =============================================== */

.header-nav {
    display: none; /* Masqué sur toutes les tailles d'écran - remplacé par le menu burger */
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.2rem;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: #4b5563;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
}

/* Effet de fond au survol */

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #eef2ff;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 10px;
    z-index: -1;
}

.nav-item:hover::before {
    opacity: 1;
}

.nav-item:hover {
    color: #4f46e5;
    transform: translateY(-2px);
}

/* État actif avec indicateur en dessous */

.nav-item.active {
    background: #4f46e5;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.35),
                0 1px 3px rgba(15, 23, 42, 0.05);
    transform: translateY(0);
}

/* Effet brillant sur l'élément actif */

.nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        #f1f5f9,
        transparent
    );
    transition: left 0.5s ease;
}

.nav-item.active:hover::after {
    left: 100%;
}

.nav-item .nav-icon {
    font-size: 1.2rem;
    line-height: 1;
    transition: transform 0.3s ease;
}

.nav-item:hover .nav-icon {
    transform: scale(1.1);
}

.nav-item.active .nav-icon {
    filter: none;
}

.nav-item .nav-text {
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Responsive Navigation */

@media (max-width: 1200px) {
.header-nav {
        gap: 0.5rem;
        margin: 0 1rem;
        padding: 0.4rem;
    }
.nav-item {
        padding: 0.5rem 0.9rem;
        font-size: 0.85rem;
    }
.nav-item .nav-icon {
        font-size: 1.1rem;
    }
}

/* Navigation desktop reste en haut, masquée sur mobile via le media query principal */

/* Style pour masquer les éléments admin si pas admin - DÉSACTIVÉ : tout le monde peut voir admin maintenant */

/* [data-role="admin-only"] {
    display: flex;
}

body:not(.user-is-admin) [data-role="admin-only"] {
    display: none;
} */

/* ===============================================
   MENU HAMBURGER MOBILE
   =============================================== */

.mobile-menu-toggle {
    display: flex; /* Toujours visible sur desktop et mobile */
    flex-direction: column;
    justify-content: space-around;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 8px;
    cursor: pointer;
    padding: 8px 6px;
    z-index: 1400; /* En dessous du menu (1500) et de l'overlay (1499) */
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.mobile-menu-toggle:hover {
    background: rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.4);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background: #4f46e5;
    border-radius: 2px;
    transition: all 0.3s ease;
    display: block;
}

.mobile-menu-toggle:hover .hamburger-line {
    background: #6d28d9;
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1600; /* Au-dessus du header (1400) */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    background: #ffffff;
    box-shadow: -2px 0 10px rgba(15, 23, 42, 0.05);
    z-index: 1601; /* Au-dessus de l'overlay (1600) et du header (1400) */
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.025);
    background: #4f46e5;
}

.mobile-menu-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.mobile-menu-close {
    background: rgba(15, 23, 42, 0.1);
    border: 1px solid rgba(15, 23, 42, 0.16);
    color: #ffffff;
    font-size: 2rem;
    line-height: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mobile-menu-close:hover {
    background: #f1f5f9;
    transform: rotate(90deg);
}

.mobile-menu-items {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    color: #1a1f3a;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.mobile-menu-item:hover {
    background: rgba(79, 70, 229, 0.1);
    border-left-color: rgba(79, 70, 229, 0.3);
}

.mobile-menu-item.active {
    background: #eef2ff;
    border-left-color: #4f46e5;
    color: #4f46e5;
    font-weight: 600;
}

.mobile-menu-icon {
    font-size: 1.5rem;
    line-height: 1;
    width: 32px;
    text-align: center;
}

.mobile-menu-text {
    flex: 1;
}

/* Séparateur dans le menu */

.mobile-menu-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(79, 70, 229, 0.25), transparent);
    margin: 0.75rem 1.25rem;
}

/* Informations utilisateur dans le menu */

.mobile-menu-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(79, 70, 229, 0.05);
    border-left: 4px solid transparent;
}

.mobile-menu-user-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: #4f46e5;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mobile-menu-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mobile-menu-user-avatar-placeholder {
    font-size: 1.5rem;
    color: white;
}

.mobile-menu-user-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.mobile-menu-user-name {
    font-weight: 600;
    color: #1a1f3a;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-menu-user-email {
    font-size: 0.85rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bouton de déconnexion dans le menu */

.mobile-menu-logout {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: transparent;
    border: none;
    color: #ef4444;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.mobile-menu-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: rgba(239, 68, 68, 0.3);
}

.mobile-menu-logout .mobile-menu-icon {
    font-size: 1.5rem;
    line-height: 1;
    width: 32px;
    text-align: center;
}

.mobile-menu-logout .mobile-menu-text {
    flex: 1;
}

/* Adaptation du menu burger pour desktop */

@media (min-width: 769px) {
.mobile-menu {
        width: 320px; /* Plus large sur desktop */
        right: -320px;
    }
.mobile-menu-item {
        padding: 1.2rem 1.5rem;
        font-size: 1.05rem;
    }
.mobile-menu-icon {
        font-size: 1.6rem;
    }
.mobile-menu-user {
        padding: 1.2rem 1.5rem;
    }
.mobile-menu-user-avatar {
        width: 52px;
        height: 52px;
    }
.mobile-menu-logout {
        padding: 1.2rem 1.5rem;
        font-size: 1.05rem;
    }
}

/* Responsive map - Styles supplémentaires pour garantir l'affichage */

@media (max-width: 768px) {
/* S'assurer que la carte est visible */
#map {
        width: 100% !important;
        height: 500px !important;
        min-height: 500px !important;
        display: block !important;
        visibility: visible !important;
    }
}

/* ─── Icônes SVG de navigation (remplacent les emojis) ─────────────────── */

.nav-icon,
.mobile-menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-icon svg,
.mobile-menu-icon svg {
    display: block;
}

.mobile-menu-user-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

/* ----- Propre à MyBudget ----- */

/* Administration > Accès : adresses autorisées (config/oauth.php). */
.admin-access-list {
    list-style: none;
    margin: 0 0 0.75rem;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.admin-access-list li {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 0.875rem;
}
