/* =====================================================================
   WAG'S FINANCE - Feuille de style principale
   Thème : bleu / jaune / rouge / noir, blanc en couleur complémentaire
   Approche MOBILE FIRST
   ===================================================================== */

:root {
    /* Palette institutionnelle */
    --wf-blue:        #0b3c8d;
    --wf-blue-dark:   #072a63;
    --wf-blue-light:  #1b5fd0;
    --wf-yellow:      #f5b301;
    --wf-yellow-dark: #c98f00;
    --wf-red:         #d62828;
    --wf-red-dark:    #a51e1e;
    --wf-black:       #10141c;
    --wf-white:       #ffffff;

    /* Interface */
    --wf-bg:          #f3f5fa;
    --wf-surface:     #ffffff;
    --wf-border:      #e3e8f0;
    --wf-text:        #1d2433;
    --wf-muted:       #6b7688;

    --wf-radius:      14px;
    --wf-radius-sm:   10px;
    --wf-shadow:      0 1px 2px rgba(16, 20, 28, .05), 0 8px 24px rgba(16, 20, 28, .06);
    --wf-shadow-sm:   0 1px 2px rgba(16, 20, 28, .06);

    --wf-sidebar-w:   268px;
    --wf-header-h:    62px;

    /* Alignement Bootstrap */
    --bs-primary:     #0b3c8d;
    --bs-primary-rgb: 11, 60, 141;
    --bs-body-bg:     var(--wf-bg);
    --bs-body-color:  var(--wf-text);
    --bs-border-color: var(--wf-border);
    --bs-link-color:  var(--wf-blue);
    --bs-link-hover-color: var(--wf-blue-light);
    --bs-border-radius: var(--wf-radius-sm);
}

* { -webkit-tap-highlight-color: transparent; }

body {
    background: var(--wf-bg);
    color: var(--wf-text);
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: .9375rem;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* ---------------------------------------------------------------------
   BOUTONS ET COULEURS UTILITAIRES
   --------------------------------------------------------------------- */
.btn-primary {
    --bs-btn-bg: var(--wf-blue);
    --bs-btn-border-color: var(--wf-blue);
    --bs-btn-hover-bg: var(--wf-blue-light);
    --bs-btn-hover-border-color: var(--wf-blue-light);
    --bs-btn-active-bg: var(--wf-blue-dark);
    --bs-btn-active-border-color: var(--wf-blue-dark);
    --bs-btn-disabled-bg: var(--wf-blue);
    --bs-btn-disabled-border-color: var(--wf-blue);
}
.btn-outline-primary {
    --bs-btn-color: var(--wf-blue);
    --bs-btn-border-color: var(--wf-blue);
    --bs-btn-hover-bg: var(--wf-blue);
    --bs-btn-hover-border-color: var(--wf-blue);
    --bs-btn-active-bg: var(--wf-blue-dark);
}
.btn-warning {
    --bs-btn-bg: var(--wf-yellow);
    --bs-btn-border-color: var(--wf-yellow);
    --bs-btn-color: #241d00;
    --bs-btn-hover-bg: var(--wf-yellow-dark);
    --bs-btn-hover-border-color: var(--wf-yellow-dark);
    --bs-btn-hover-color: #241d00;
}
.btn-danger {
    --bs-btn-bg: var(--wf-red);
    --bs-btn-border-color: var(--wf-red);
    --bs-btn-hover-bg: var(--wf-red-dark);
    --bs-btn-hover-border-color: var(--wf-red-dark);
}
.btn { border-radius: var(--wf-radius-sm); font-weight: 500; }
.btn-sm { border-radius: 8px; }

/* Zones tactiles confortables sur mobile (accessibilité) */
@media (max-width: 767.98px) {
    .btn, .form-control, .form-select { min-height: 42px; }
    .btn-sm { min-height: 38px; }
}

.text-wf-blue   { color: var(--wf-blue) !important; }
.text-wf-yellow { color: var(--wf-yellow-dark) !important; }
.text-wf-red    { color: var(--wf-red) !important; }
.bg-wf-blue     { background-color: var(--wf-blue) !important; }
.bg-wf-yellow   { background-color: var(--wf-yellow) !important; }
.bg-wf-red      { background-color: var(--wf-red) !important; }

/* ---------------------------------------------------------------------
   MISE EN PAGE
   --------------------------------------------------------------------- */
.wf-layout { min-height: 100vh; }

.wf-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--wf-sidebar-w);
    background: linear-gradient(178deg, var(--wf-blue-dark) 0%, var(--wf-black) 100%);
    color: #cfd8ea;
    z-index: 1045;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform .25s ease;
    overflow: hidden;
}
.wf-sidebar.show { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.35); }

.wf-sidebar__brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}
.wf-sidebar__logo {
    width: 40px; height: 40px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--wf-yellow) 0%, var(--wf-red) 100%);
    display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: 1rem;
    flex-shrink: 0;
    object-fit: contain;
}
.wf-sidebar__title { color: #fff; font-weight: 700; font-size: .95rem; letter-spacing: .04em; line-height: 1.1; }
.wf-sidebar__tagline { font-size: .68rem; color: var(--wf-yellow); line-height: 1.2; margin-top: 2px; }

.wf-nav { flex: 1 1 auto; overflow-y: auto; padding: .75rem .6rem 1.5rem; }
.wf-nav::-webkit-scrollbar { width: 6px; }
.wf-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 3px; }

.wf-nav__section {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .12em;
    color: rgba(255,255,255,.38); font-weight: 600;
    padding: 1rem .75rem .35rem;
}
.wf-nav__link {
    display: flex; align-items: center; gap: .7rem;
    padding: .6rem .75rem;
    border-radius: 10px;
    color: #c3cde3;
    font-size: .875rem;
    font-weight: 500;
    transition: background .15s ease, color .15s ease;
}
.wf-nav__link i { font-size: 1.05rem; width: 20px; text-align: center; flex-shrink: 0; }
.wf-nav__link:hover { background: rgba(255,255,255,.07); color: #fff; }
.wf-nav__link.active {
    background: linear-gradient(90deg, rgba(245,179,1,.18), rgba(245,179,1,.02));
    color: #fff;
    box-shadow: inset 3px 0 0 var(--wf-yellow);
}
.wf-nav__badge { margin-left: auto; font-size: .65rem; }

.wf-backdrop {
    position: fixed; inset: 0; background: rgba(8, 12, 22, .55);
    z-index: 1040; display: none;
}
.wf-backdrop.show { display: block; }

.wf-main { min-width: 0; }

/* En-tête */
.wf-header {
    position: sticky; top: 0; z-index: 1030;
    height: var(--wf-header-h);
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--wf-border);
    display: flex; align-items: center; gap: .75rem;
    padding: 0 .9rem;
}
.wf-header__title { font-weight: 650; font-size: 1rem; margin: 0; }

.wf-context {
    display: flex; gap: .4rem; flex-wrap: wrap;
}
.wf-context__chip {
    display: inline-flex; align-items: center; gap: .35rem;
    background: #eef2fa; border: 1px solid var(--wf-border);
    border-radius: 999px; padding: .2rem .6rem;
    font-size: .74rem; color: #37425a; white-space: nowrap;
}
.wf-context__chip strong { color: var(--wf-blue); font-weight: 600; }

.wf-content { padding: 1rem .9rem 3rem; }

@media (min-width: 992px) {
    .wf-sidebar { transform: translateX(0); }
    .wf-main    { margin-left: var(--wf-sidebar-w); }
    .wf-backdrop{ display: none !important; }
    .wf-content { padding: 1.5rem 1.75rem 4rem; }
    .wf-header  { padding: 0 1.75rem; }
}

/* ---------------------------------------------------------------------
   CARTES ET STATISTIQUES
   --------------------------------------------------------------------- */
.card {
    border: 1px solid var(--wf-border);
    border-radius: var(--wf-radius);
    box-shadow: var(--wf-shadow-sm);
    background: var(--wf-surface);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--wf-border);
    padding: .85rem 1.1rem;
    font-weight: 600;
}
.card-body { padding: 1.1rem; }

.wf-stat {
    position: relative;
    overflow: hidden;
    border-radius: var(--wf-radius);
    background: var(--wf-surface);
    border: 1px solid var(--wf-border);
    box-shadow: var(--wf-shadow-sm);
    padding: 1rem 1.1rem;
    height: 100%;
    transition: transform .18s ease, box-shadow .18s ease;
}
.wf-stat:hover { transform: translateY(-2px); box-shadow: var(--wf-shadow); }
.wf-stat::before {
    content: ''; position: absolute; inset: 0 auto 0 0; width: 4px;
    background: var(--wf-blue);
}
.wf-stat--blue::before   { background: var(--wf-blue); }
.wf-stat--yellow::before { background: var(--wf-yellow); }
.wf-stat--red::before    { background: var(--wf-red); }
.wf-stat--green::before  { background: #17936a; }
.wf-stat--black::before  { background: var(--wf-black); }

.wf-stat__label {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
    color: var(--wf-muted); font-weight: 600; margin-bottom: .35rem;
}
.wf-stat__value { font-size: 1.35rem; font-weight: 700; line-height: 1.15; word-break: break-word; }
.wf-stat__meta  { font-size: .76rem; color: var(--wf-muted); margin-top: .3rem; }
.wf-stat__icon {
    position: absolute; right: .9rem; top: .9rem;
    width: 38px; height: 38px; border-radius: 11px;
    display: grid; place-items: center; font-size: 1.05rem;
    background: #eef2fa; color: var(--wf-blue);
}
.wf-stat--yellow .wf-stat__icon { background: #fff6de; color: var(--wf-yellow-dark); }
.wf-stat--red    .wf-stat__icon { background: #fdeaea; color: var(--wf-red); }
.wf-stat--green  .wf-stat__icon { background: #e6f6f0; color: #17936a; }

@media (min-width: 768px) {
    .wf-stat__value { font-size: 1.55rem; }
}

/* ---------------------------------------------------------------------
   TABLEAUX
   --------------------------------------------------------------------- */
.wf-table-card { overflow: hidden; }
.wf-table-wrapper { overflow-x: auto; }

.table { --bs-table-hover-bg: #f6f8fd; margin-bottom: 0; }
.table > thead th {
    background: #f7f9fd;
    border-bottom: 1px solid var(--wf-border);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--wf-muted);
    font-weight: 600;
    white-space: nowrap;
    padding: .7rem .85rem;
}
.table > tbody td { padding: .7rem .85rem; vertical-align: middle; border-color: #eef1f7; }
.table tbody tr:last-child td { border-bottom: 0; }

a.wf-sort { color: inherit; display: inline-flex; align-items: center; gap: .3rem; }
a.wf-sort:hover { color: var(--wf-blue); }
a.wf-sort.active { color: var(--wf-blue); }

.wf-empty { padding: 3rem 1rem; text-align: center; color: var(--wf-muted); }
.wf-empty i { font-size: 2.4rem; opacity: .35; display: block; margin-bottom: .6rem; }

.page-link { color: var(--wf-blue); }
.page-item.active .page-link { background: var(--wf-blue); border-color: var(--wf-blue); }

/* Actions en fin de ligne */
.wf-actions { white-space: nowrap; text-align: end; }
.wf-actions .btn { --bs-btn-padding-y: .2rem; --bs-btn-padding-x: .45rem; }

/* ---------------------------------------------------------------------
   BARRES DE PROGRESSION BUDGETAIRE
   --------------------------------------------------------------------- */
.wf-progress { height: 8px; border-radius: 99px; background: #eaeef6; overflow: hidden; }
.wf-progress__bar { height: 100%; border-radius: 99px; transition: width .5s ease; }
.wf-progress__bar--ok       { background: #17936a; }
.wf-progress__bar--warning  { background: var(--wf-yellow); }
.wf-progress__bar--critical { background: #ef6c1a; }
.wf-progress__bar--overrun  { background: var(--wf-red); }

/* ---------------------------------------------------------------------
   FORMULAIRES
   --------------------------------------------------------------------- */
.form-label { font-size: .8rem; font-weight: 600; color: #48536b; margin-bottom: .3rem; }
.form-control, .form-select {
    border-radius: var(--wf-radius-sm);
    border-color: #d9e0ec;
    font-size: .9rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--wf-blue-light);
    box-shadow: 0 0 0 .2rem rgba(11, 60, 141, .12);
}
.wf-form-section {
    border-top: 1px solid var(--wf-border);
    margin-top: 1.2rem; padding-top: 1.1rem;
}
.wf-form-section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.wf-form-section__title {
    font-size: .78rem; text-transform: uppercase; letter-spacing: .08em;
    color: var(--wf-blue); font-weight: 700; margin-bottom: .85rem;
    display: flex; align-items: center; gap: .45rem;
}
.required::after { content: ' *'; color: var(--wf-red); }

/* Select2 aligné sur Bootstrap 5 */
.select2-container--bootstrap-5 .select2-selection { border-radius: var(--wf-radius-sm); }

/* ---------------------------------------------------------------------
   PAGE DE CONNEXION
   --------------------------------------------------------------------- */
.wf-login {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr;
    background: var(--wf-bg);
}
.wf-login__brand {
    background: linear-gradient(150deg, var(--wf-blue-dark) 0%, var(--wf-blue) 55%, var(--wf-black) 100%);
    color: #fff;
    padding: 2.25rem 1.5rem;
    position: relative;
    overflow: hidden;
}
.wf-login__brand::after {
    content: ''; position: absolute; right: -70px; bottom: -90px;
    width: 260px; height: 260px; border-radius: 50%;
    background: radial-gradient(circle, rgba(245,179,1,.35) 0%, transparent 68%);
}
.wf-login__brand::before {
    content: ''; position: absolute; left: -60px; top: -80px;
    width: 220px; height: 220px; border-radius: 50%;
    background: radial-gradient(circle, rgba(214,40,40,.28) 0%, transparent 68%);
}
.wf-login__form { display: grid; place-items: center; padding: 2rem 1.25rem 3rem; }
.wf-login__card { width: 100%; max-width: 420px; }
.wf-login__logo {
    width: 60px; height: 60px; border-radius: 16px;
    background: linear-gradient(135deg, var(--wf-yellow) 0%, var(--wf-red) 100%);
    display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.3rem;
    box-shadow: 0 10px 26px rgba(245,179,1,.28);
    object-fit: contain;
}
.wf-login__features { position: relative; z-index: 2; }
.wf-login__features li {
    display: flex; gap: .6rem; align-items: flex-start;
    margin-bottom: .7rem; font-size: .875rem; color: rgba(255,255,255,.86);
}
.wf-login__features i { color: var(--wf-yellow); margin-top: .15rem; }

@media (min-width: 992px) {
    .wf-login { grid-template-columns: 1.05fr 1fr; }
    .wf-login__brand { padding: 3.5rem 3rem; display: flex; flex-direction: column; justify-content: center; }
}

/* ---------------------------------------------------------------------
   DIVERS
   --------------------------------------------------------------------- */
.wf-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--wf-blue); color: #fff;
    display: grid; place-items: center;
    font-size: .78rem; font-weight: 600; flex-shrink: 0;
    object-fit: cover;
}
.wf-page-title { font-size: 1.25rem; font-weight: 700; margin: 0; }
.wf-page-subtitle { color: var(--wf-muted); font-size: .85rem; margin: .15rem 0 0; }
.breadcrumb { --bs-breadcrumb-divider-color: var(--wf-muted); font-size: .8rem; }

.wf-chip-readonly {
    background: #fff6de; color: #7a5a00; border: 1px solid #f3dfa6;
    border-radius: 999px; padding: .15rem .6rem; font-size: .72rem; font-weight: 600;
}

/* ---------------------------------------------------------------------
   MONTANTS ET DOUBLE AFFICHAGE DES DEVISES
   ---------------------------------------------------------------------
   Sur un site tenu dans une monnaie autre que la devise de reference,
   chaque montant se lit sur deux lignes : la monnaie locale en premier,
   son equivalent consolide juste en dessous. */
.wf-amount {
    display: block; font-weight: 700; line-height: 1.15;
    color: var(--wf-dark, #14213d); font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.wf-amount--lg { font-size: 1.35rem; }
.wf-amount--sm { font-size: .95rem; }
.wf-amount__second {
    display: block; margin-top: .1rem;
    font-size: .74rem; font-weight: 600; letter-spacing: .01em;
    color: var(--wf-muted, #6b7280); font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
td .wf-amount { font-size: .9rem; }
td .wf-amount__second { font-size: .7rem; }

/* Bandeau de taux de change du tableau de bord */
.wf-rate-banner {
    display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem;
    padding: .65rem .9rem; margin-bottom: 1rem;
    border: 1px solid #dbe4f3; border-left: 4px solid var(--wf-blue, #003049);
    border-radius: 12px;
    background: linear-gradient(90deg, #f4f8ff 0%, #ffffff 60%);
}
.wf-rate-banner--warn {
    border-color: #f3dfa6; border-left-color: var(--wf-yellow, #f5b301);
    background: linear-gradient(90deg, #fff8e6 0%, #ffffff 60%);
    color: #7a5a00;
}
.wf-rate-banner__main {
    font-weight: 700; font-size: .92rem; color: var(--wf-blue, #003049);
    display: flex; align-items: center; gap: .45rem;
}
.wf-rate-banner--warn .wf-rate-banner__main { color: #7a5a00; }
.wf-rate-banner__rates { display: flex; flex-wrap: wrap; gap: .4rem; }
.wf-rate-banner__date {
    margin-left: auto; font-size: .74rem; color: var(--wf-muted, #6b7280);
    white-space: nowrap;
}
.wf-rate-chip {
    background: #fff; border: 1px solid #dbe4f3; border-radius: 999px;
    padding: .15rem .7rem; font-size: .78rem; font-weight: 600;
    color: var(--wf-dark, #14213d); font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Parite affichee dans la barre de contexte de l'en-tete */
.wf-context__chip--rate .wf-context__rate,
.wf-context__chip--warn .wf-context__rate {
    margin-left: .35rem; padding-left: .45rem;
    border-left: 1px solid rgba(0,0,0,.12);
    font-weight: 600; font-variant-numeric: tabular-nums;
}
.wf-context__chip--warn { background: #fff6de; color: #7a5a00; border-color: #f3dfa6; }

/* Barre de filtres du tableau de bord */
.wf-filterbar { border: 1px solid #e5e9f2; border-radius: 14px; background: #fff; }
.wf-filterbar .form-label { font-size: .72rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .03em; color: var(--wf-muted, #6b7280); margin-bottom: .2rem; }

@media (max-width: 575.98px) {
    .wf-amount--lg { font-size: 1.15rem; }
    .wf-rate-banner__date { margin-left: 0; width: 100%; }
}

/* ---------------------------------------------------------------------
   INSTALLATION SUR L'ÉCRAN D'ACCUEIL
   --------------------------------------------------------------------- */
.wf-steps { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.wf-steps li {
    display: flex; gap: .85rem; align-items: flex-start;
    padding: .7rem 0; border-bottom: 1px dashed var(--wf-border);
    font-size: .92rem; line-height: 1.55;
}
.wf-steps li:last-child { border-bottom: 0; }
.wf-steps__num {
    flex-shrink: 0;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--wf-blue); color: #fff;
    display: grid; place-items: center;
    font-size: .78rem; font-weight: 700;
}
.wf-ios-share {
    display: inline-grid; place-items: center;
    width: 24px; height: 24px; border-radius: 6px;
    background: #eef2fa; border: 1px solid #d8e1f2;
    color: var(--wf-blue); vertical-align: -.35rem;
}

.wf-benefit { display: flex; gap: .75rem; align-items: flex-start; }
.wf-benefit i {
    flex-shrink: 0;
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, var(--wf-yellow) 0%, var(--wf-red) 100%);
    color: #fff; display: grid; place-items: center; font-size: 1.05rem;
}
.wf-benefit strong { display: block; font-size: .88rem; margin-bottom: .15rem; }
.wf-benefit p { margin: 0; font-size: .8rem; line-height: 1.5; color: var(--wf-muted); }

/* Le bouton d'installation de l'en-tête : discret, mais repérable */
#wfInstallButton { font-weight: 600; }

/* En mode application installée, l'encoche et la barre de gestes des
   téléphones récents ne doivent pas manger le contenu. */
@media (display-mode: standalone) {
    .wf-header { padding-top: max(0px, env(safe-area-inset-top)); }
    .wf-content { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
    .wf-sidebar { padding-top: max(0px, env(safe-area-inset-top)); }
    /* Inutile de proposer une installation déjà faite */
    #wfInstallButton { display: none !important; }
}

/* ---------------------------------------------------------------------
   VISIONNEUSE DE JUSTIFICATIFS
   ---------------------------------------------------------------------
   Dans l'application installée, il n'y a ni barre d'adresse ni bouton
   « précédent » : la croix de fermeture est donc la seule sortie. Elle
   est volontairement grande et toujours visible.
   --------------------------------------------------------------------- */
.wf-viewer .modal-content {
    background: #12161f;
    color: #fff;
    border: 0;
    border-radius: 16px;
    overflow: hidden;
}
@media (max-width: 767.98px) {
    .wf-viewer .modal-content { border-radius: 0; }
}

.wf-viewer__header {
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    padding: .7rem 1rem;
    padding-top: calc(.7rem + env(safe-area-inset-top));
    align-items: center;
}
.wf-viewer__title  { font-size: .95rem; font-weight: 600; margin: 0; }
.wf-viewer__meta   { font-size: .72rem; color: rgba(255, 255, 255, .55); margin-top: .1rem; }

/* Cible tactile généreuse : c'est la sortie de secours */
.wf-viewer__close {
    flex-shrink: 0;
    width: 42px; height: 42px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, .12);
    background-size: 15px;
    opacity: .9;
    margin: 0;
}
.wf-viewer__close:hover,
.wf-viewer__close:focus { opacity: 1; background-color: rgba(255, 255, 255, .22); }

.wf-viewer__body {
    padding: 0;
    background: #0b0e14;
    display: grid;
    place-items: center;
    overflow: auto;
    min-height: 46vh;
    max-height: calc(100vh - 190px);
}
@media (max-width: 767.98px) {
    .wf-viewer__body { max-height: none; height: auto; flex: 1 1 auto; }
}

.wf-viewer__img {
    max-width: 100%;
    max-height: calc(100vh - 200px);
    object-fit: contain;
    cursor: zoom-in;
    display: block;
}
/* Agrandi : l'image reprend sa taille réelle et le conteneur défile */
.wf-viewer__body--zoom { place-items: start; }
.wf-viewer__body--zoom .wf-viewer__img {
    max-width: none; max-height: none;
    width: auto; height: auto;
    cursor: zoom-out;
}

.wf-viewer__frame {
    width: 100%;
    height: min(72vh, 900px);
    border: 0;
    background: #fff;
}
@media (max-width: 767.98px) {
    .wf-viewer__frame { height: calc(100vh - 190px); }
}

.wf-viewer__loading { padding: 3.5rem; color: rgba(255, 255, 255, .6); }

.wf-viewer__message {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: rgba(255, 255, 255, .72);
}
.wf-viewer__message i { font-size: 2.4rem; display: block; margin-bottom: .6rem; opacity: .6; }
.wf-viewer__message p { font-size: .9rem; margin-bottom: 1rem; }

.wf-viewer__footer {
    border-top: 1px solid rgba(255, 255, 255, .1);
    padding: .6rem 1rem;
    padding-bottom: calc(.6rem + env(safe-area-inset-bottom));
    flex-wrap: nowrap;
}
.wf-viewer__nav { display: flex; align-items: center; gap: .5rem; }
.wf-viewer__count { font-size: .78rem; color: rgba(255, 255, 255, .65); font-variant-numeric: tabular-nums; }

/* Vignette cliquable */
.wf-thumb { cursor: zoom-in; position: relative; display: block; }
.wf-thumb::after {
    content: '\F4A9';                     /* bi-zoom-in */
    font-family: 'bootstrap-icons';
    position: absolute; right: .3rem; bottom: .3rem;
    width: 22px; height: 22px; border-radius: 6px;
    background: rgba(16, 20, 28, .62); color: #fff;
    display: grid; place-items: center; font-size: .7rem;
    opacity: 0; transition: opacity .15s ease;
}
.wf-thumb:hover::after, .wf-thumb:focus::after { opacity: 1; }

/* ---------------------------------------------------------------------
   BOUTON « RETOUR » DU MODE INSTALLÉ
   ---------------------------------------------------------------------
   Une application installée n'a pas de bouton « précédent » de
   navigateur. On en fournit un, mais uniquement là où il manque : dans
   un onglet ordinaire, il ferait doublon.
   --------------------------------------------------------------------- */
#wfBackButton { display: none; }

@media (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
    #wfBackButton { display: inline-flex; }
}
body.wf-standalone #wfBackButton { display: inline-flex; }

/* Impression */
@media print {
    .wf-sidebar, .wf-header, .wf-toolbar, .wf-pagination, .wf-actions,
    .btn, .no-print, .toast-container { display: none !important; }
    .wf-main { margin-left: 0 !important; }
    .wf-content { padding: 0 !important; }
    .card { border: 0 !important; box-shadow: none !important; }
    body { background: #fff !important; font-size: 11pt; }
    .table > thead th { background: #eee !important; -webkit-print-color-adjust: exact; }
}
