html {
    margin: 0 !important;
}

/* Barre d’accès rapide : styles dans base.html.twig (bloc <style>) pour fiabilité ; ne pas dupliquer ici */

/* Mobile : éviter le zoom automatique iOS sur focus (champs < 16px) */
@media (max-width: 767.98px) {
    input.form-control,
    textarea.form-control,
    select.form-select {
        font-size: 1rem;
    }
}

/* Indicateur de chargement (masqué une fois la page chargée) */
body[data-loading="true"]::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9998;
    pointer-events: none;
}
body[data-loading="true"]::after {
    content: "";
    position: fixed;
    top: 50%;
    left: 50%;
    width: 2.5rem;
    height: 2.5rem;
    margin: -1.25rem 0 0 -1.25rem;
    border: 3px solid var(--tblr-border-color, #e6e7e9);
    border-top-color: var(--tblr-primary, #206bc4);
    border-radius: 50%;
    animation: page-load-spin 0.8s linear infinite;
    z-index: 9999;
    pointer-events: none;
}
@keyframes page-load-spin {
    to { transform: rotate(360deg); }
}

/* Menu profil : largeur adaptée au contenu (override Tabler .dropdown-menu-card min-width: 20rem) */
.dropdown-menu.dropdown-menu-profile.dropdown-menu-card {
    width: max-content !important;
    min-width: auto !important;
}
.dropdown-menu.dropdown-menu-profile .dropdown-item {
    min-width: auto !important;
}

/* Lien logo : même apparence que le texte, pas de changement au survol */
.navbar-brand-link {
    color: inherit !important;
    text-decoration: none !important;
}
.navbar-brand-link:hover,
.navbar-brand-link:focus {
    color: inherit !important;
    text-decoration: none !important;
}

/* Responsive: permettre le retrait des blocs flex (wrap texte) */
.min-w-0 {
    min-width: 0;
}

/*
 * Tableaux larges (mobile / tablette étroite) : même idée que /budget et /operation —
 * zone scroll + léger relief pour suggérer le débordement (le texte .msc-table-scroll-hint reste la référence accessibilité).
 */
@media (max-width: 991.98px) {
    .msc-table-scroll-region {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow:
            inset 8px 0 10px -8px color-mix(in srgb, var(--tblr-body-color, #1d273b) 12%, transparent),
            inset -8px 0 10px -8px color-mix(in srgb, var(--tblr-body-color, #1d273b) 12%, transparent);
    }
}

.msc-table-scroll-hint {
    margin-bottom: 0.35rem;
}

/* Tableaux : lignes alternées et teinte au survol */
.card-table tbody tr:nth-of-type(odd) td,
.card-table tbody tr:nth-of-type(odd) th {
    background-color: rgba(0, 0, 0, 0.06);
}
.card-table tbody tr:nth-of-type(even) td,
.card-table tbody tr:nth-of-type(even) th {
    background-color: transparent;
}
.card-table tbody tr:hover td,
.card-table tbody tr:hover th {
    background-color: rgba(0, 0, 0, 0.2) !important;
}
/* Thème sombre : teintes visibles */
[data-bs-theme="dark"] .card-table tbody tr:nth-of-type(odd) td,
[data-bs-theme="dark"] .card-table tbody tr:nth-of-type(odd) th {
    background-color: rgba(255, 255, 255, 0.04);
}
[data-bs-theme="dark"] .card-table tbody tr:nth-of-type(even) td,
[data-bs-theme="dark"] .card-table tbody tr:nth-of-type(even) th {
    background-color: transparent;
}
[data-bs-theme="dark"] .card-table tbody tr:hover td,
[data-bs-theme="dark"] .card-table tbody tr:hover th {
    background-color: rgba(0, 0, 0, 0.25) !important;
}
/* Ligne d'en-tête de section (ex. catégories) : pas d'alternance */
.card-table tbody tr.section-header th {
    background-color: transparent !important;
}
.card-table tbody tr.section-header td {
    background-color: transparent !important;
}

/* Modale pleine largeur sur petit écran (fallback si Tabler n’a pas modal-fullscreen-sm-down) */
@media (max-width: 575.98px) {
    .modal-fullscreen-sm-down .modal-dialog {
        max-width: none;
        margin: 0;
        width: 100%;
    }
    .modal-fullscreen-sm-down .modal-content {
        min-height: 100vh;
        border: 0;
        border-radius: 0;
    }
}

/* Badge type Virement : fond violet (clair et sombre), priorité max pour prod */
.badge.bg-transfer,
.badge.badge-virement,
span.badge.bg-transfer,
span.badge.badge-virement,
.table .badge.bg-transfer,
.table .badge.badge-virement,
.card-table .badge.bg-transfer,
.card-table .badge.badge-virement,
table.card-table tbody td .badge.bg-transfer,
table.card-table tbody td .badge.badge-virement,
[data-bs-theme="dark"] .badge.bg-transfer,
[data-bs-theme="dark"] .badge.badge-virement,
[data-bs-theme="dark"] .table .badge.bg-transfer,
[data-bs-theme="dark"] .table .badge.badge-virement,
[data-bs-theme="dark"] .card-table .badge.bg-transfer,
[data-bs-theme="dark"] .card-table .badge.badge-virement,
[data-bs-theme="dark"] table.card-table tbody td .badge.bg-transfer,
[data-bs-theme="dark"] table.card-table tbody td .badge.badge-virement {
    background-color: #6d116e !important;
    background: #6d116e !important;
}
.badge.bg-transfer.text-dark,
.badge.badge-virement.text-dark,
span.badge.bg-transfer.text-dark,
span.badge.badge-virement.text-dark,
[data-bs-theme="dark"] .badge.bg-transfer.text-dark,
[data-bs-theme="dark"] .badge.badge-virement.text-dark {
    color: #000 !important;
}

/* Dashboard carte : icône "i" info (style comme /budget) */
.dashboard-card-info-wrapper {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    z-index: 5;
}
.dashboard-card-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--tblr-muted);
    background: var(--tblr-bg-surface-secondary, rgba(0, 0, 0, 0.1));
    border-radius: 50%;
    cursor: help;
}
.dashboard-card-info-tooltip {
    position: absolute;
    top: 50%;
    left: calc(100% + 6px);
    transform: translateY(-50%);
    padding: 0.5rem 0.75rem;
    background: var(--tblr-bg-surface);
    border: 1px solid var(--tblr-border-color);
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    max-width: 220px;
    white-space: normal;
    font-size: 0.8rem;
    line-height: 1.5;
    font-weight: normal;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 1100;
}
.dashboard-card-info-tooltip::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 100%;
    margin-top: -5px;
    border: 5px solid transparent;
    border-right-color: var(--tblr-bg-surface);
}
.dashboard-card-info-wrapper:hover .dashboard-card-info-tooltip,
.dashboard-card-info-wrapper:focus-within .dashboard-card-info-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Dashboard "Mes comptes" : éviter que les cartes soient écrasées */
.page-body .card-body .row.g-3 > .col .card.card-sm {
    min-width: 200px;
}

/* Lexique : popovers Bootstrap (bulles d'aide au survol) - thème et lisibilité */
.popover.lexique-popover {
    max-width: 320px;
    background: var(--tblr-bg-surface);
    border-color: var(--tblr-border-color);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.25);
}
.popover.lexique-popover .popover-body {
    color: var(--tblr-body-color);
    font-size: 0.8125rem;
    line-height: 1.5;
    max-height: 280px;
    overflow-y: auto;
    white-space: normal;
}
.popover.lexique-popover .popover-arrow::before,
.popover.lexique-popover .popover-arrow::after {
    border-bottom-color: var(--tblr-border-color);
    border-top-color: var(--tblr-bg-surface);
}

/* Même rendu « Patrimoine net » partout : le ? ne s’étire pas dans flex / titres / tableaux */
.lexique-tooltip-wrapper {
    flex-shrink: 0;
    align-self: center;
    line-height: 1;
}
.lexique-tooltip-trigger {
    flex-shrink: 0;
    max-width: 1.1rem;
    max-height: 1.1rem;
}
.subheader .lexique-tooltip-wrapper,
.card-title .lexique-tooltip-wrapper,
h1 .lexique-tooltip-wrapper,
h2 .lexique-tooltip-wrapper,
h3 .lexique-tooltip-wrapper,
h4 .lexique-tooltip-wrapper,
h5 .lexique-tooltip-wrapper,
th .lexique-tooltip-wrapper,
td .lexique-tooltip-wrapper {
    vertical-align: middle;
}

/* Groupes de catégories (dépenses / revenus) : liste à cases, sans widget tiers */
.category-group-checkbox-list {
    max-height: 14rem;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0;
    border: 1px solid var(--tblr-border-color, rgba(0, 0, 0, 0.2));
    border-radius: var(--tblr-border-radius, 0.375rem);
    background: var(--tblr-bg-surface, #fff);
}
.category-group-checkbox-list .form-check {
    margin-bottom: 0.35rem;
    text-align: left;
}
.category-group-checkbox-list .form-check:last-child {
    margin-bottom: 0;
}

/* Chart.js : conteneur responsive (hauteur pilotée par le parent, pas le canvas) */
.msc-chart-wrap {
    position: relative;
    width: 100%;
    min-height: clamp(160px, 36vw, 240px);
}
.msc-chart-wrap canvas {
    display: block;
    max-width: 100%;
}
