/* ══ RATIOS BANCAIRES DU PRÉVISIONNEL (2026-10-11, F9), préfixe rb- ══════════════════════════════════════════════════════════
   Shared/RatiosBancairesVue.razor (la vue détaillée des covenants), Shared/RatiosBancairesBadge.razor (la pastille de la barre du
   pilotage) et la tuile « Covenants » de l'atelier de scénarios (FinTreePopup, .sat-tile.rb-tuile).
   • Rang : 5630 / 5631, au-dessus du cockpit (1400), de l'atelier de scénarios et des autres fenêtres du cockpit (5500 à 5621).
     Rendue HORS du conteneur du cockpit : aucun ancêtre à transform ou filtre ne capture son position:fixed.
   • Jetons de l'app (--surf-*, --tx*, --mut*, --o*, --brand, --brand-strong, --st-*) : clair et sombre. Mat et Papier : surfaces
     pleines, filets du thème (section en fin de fichier). Compact : tableaux resserrés.
   • Téléphone (≤ 640 px) : plein écran, un seul défilement, une courbe par ligne, jamais de hauteur en vh seule (iOS).
   ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════ */

/* ── Pastille de la barre du pilotage (même gabarit que « Bilans équilibrés ») ── */
.fintree-eq.rb-puce { cursor: pointer; font-family: inherit; }
.fintree-eq.rb-puce.ok { color: var(--mut1); }
.fintree-eq.rb-puce.warn { color: var(--st-amber, #fbbf24); border-color: color-mix(in srgb, var(--st-amber, #fbbf24) 40%, transparent); }
.fintree-eq.rb-puce.ko { color: var(--st-red, #f87171); border-color: color-mix(in srgb, var(--st-red, #f87171) 45%, transparent); }
html[data-theme="light"] .fintree-eq.rb-puce.warn { color: #9a6200; }
html[data-theme="light"] .fintree-eq.rb-puce.ko { color: #b42318; }
.fintree-eq.rb-puce:hover { background: var(--o6); }

/* ── Tuile « Covenants » de l'atelier de scénarios ── */
.sat-tile.rb-tuile { cursor: pointer; text-align: left; font-family: inherit; color: inherit; }
.sat-tile.rb-tuile { grid-column: span 2; }
.sat-tile.rb-tuile b { font-size: 12.5px; line-height: 1.3; white-space: normal; }
.sat-tile.rb-tuile.ko span { color: var(--st-red, #f87171); }
.sat-tile.rb-tuile.warn span { color: var(--st-amber, #fbbf24); }
.sat-tile.rb-tuile:hover { border-color: color-mix(in srgb, var(--brand, #00B1CF) 45%, transparent); }

/* Le copilote flottant passe au-dessus de tout (10050) : il s'efface tant que la fenêtre est ouverte. */
body:has(.rb-modal) .cop-fab { display: none; }

/* ── Fenêtre ── */
.rb-back { position: fixed; inset: 0; z-index: 5630; background: var(--bd72, rgba(3,12,18,.72)); backdrop-filter: blur(2px); }
.rb-modal {
    position: fixed; z-index: 5631; inset: 0; margin: auto;
    width: min(1180px, calc(100vw - 48px));
    height: min(900px, calc(100vh - 48px)); height: min(900px, calc(100dvh - 48px));
    display: flex; flex-direction: column; overflow: hidden; outline: none;
    background: var(--surf-2, #102733); color: var(--tx1, #eafdff); font-family: var(--font-family);
    border: 1px solid color-mix(in srgb, var(--brand, #00B1CF) 22%, transparent); border-radius: 18px;
    box-shadow: 0 30px 80px rgba(0,0,0,.55);
}
html[data-theme="light"] .rb-modal { background: #fff; box-shadow: 0 30px 80px rgba(30,41,59,.25); }

.rb-head { flex: 0 0 auto; display: flex; align-items: flex-start; gap: 14px; padding: 18px 22px 14px; border-bottom: 1px solid var(--o8); }
.rb-head-ic {
    flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
    background: color-mix(in srgb, var(--brand, #00B1CF) 16%, transparent); color: var(--brand-strong, var(--brand, #00B1CF));
}
.rb-head-ic svg { width: 18px; height: 18px; }
.rb-head-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rb-titre { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; }
.rb-sous { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--mut1); }
.rb-scen { flex: 0 0 auto; width: 220px; }
.rb-x {
    flex: 0 0 auto; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; cursor: pointer;
    border: 1px solid var(--o10); background: transparent; color: var(--mut2);
}
.rb-x:hover { background: var(--o6); color: var(--tx1); }
.rb-x svg { width: 15px; height: 15px; }

.rb-corps { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.rb-vide { display: flex; align-items: center; gap: 10px; padding: 18px; border-radius: 12px; background: var(--o3); color: var(--mut1); font-size: 13px; }

/* ── Alerte ── */
.rb-alerte { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--o8); background: var(--o3); }
.rb-alerte-ic { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--o6); color: var(--mut1); }
.rb-alerte-ic svg { width: 15px; height: 15px; }
.rb-alerte-txt { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; line-height: 1.45; color: var(--tx2, var(--tx1)); }
.rb-alerte-txt b { font-size: 14px; color: var(--tx1); }
.rb-alerte.ok .rb-alerte-ic { background: color-mix(in srgb, var(--st-green, #34d399) 16%, transparent); color: var(--st-green, #34d399); }
.rb-alerte.warn { border-color: color-mix(in srgb, var(--st-amber, #fbbf24) 35%, transparent); }
.rb-alerte.warn .rb-alerte-ic { background: color-mix(in srgb, var(--st-amber, #fbbf24) 16%, transparent); color: var(--st-amber, #fbbf24); }
.rb-alerte.ko { border-color: color-mix(in srgb, var(--st-red, #f87171) 40%, transparent); }
.rb-alerte.ko .rb-alerte-ic { background: color-mix(in srgb, var(--st-red, #f87171) 16%, transparent); color: var(--st-red, #f87171); }
html[data-theme="light"] .rb-alerte.ok .rb-alerte-ic { color: #067647; }
html[data-theme="light"] .rb-alerte.warn .rb-alerte-ic { color: #9a6200; }
html[data-theme="light"] .rb-alerte.ko .rb-alerte-ic { color: #b42318; }

/* ── Seuils ── */
/* 2026-10-11 (F9b) : cinq réglages, les quatre seuils et la matérialité de la dette, sur une ligne. */
.rb-seuils { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; align-items: start; }
.rb-seuil-c { display: flex; flex-direction: column; gap: 5px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--o8); }
.rb-seuil-l { font-size: 12.5px; font-weight: 700; color: var(--tx1); }
.rb-seuil-l small { display: block; font-weight: 500; font-size: 11px; color: var(--mut1); }
.rb-seuil-in { display: inline-flex; align-items: center; gap: 6px; }
.rb-seuil-in i { font-style: normal; color: var(--mut1); }
.rb-seuil-op { font-weight: 700; color: var(--mut1); }
.rb-seuil-in .rb-num { width: 74px; height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--o10); background: var(--o3); color: var(--tx1);
    font-family: inherit; font-size: 13px; font-variant-numeric: tabular-nums; }
.rb-seuil-src { font-size: 11px; color: var(--mut1); }
.rb-seuil-src.pret { color: var(--brand-strong, var(--brand, #00B1CF)); font-weight: 600; }
.rb-lien { grid-column: 1 / -1; justify-self: start; border: 0; background: none; padding: 0; cursor: pointer; font-family: inherit; font-size: 12px;
    color: var(--brand-strong, var(--brand, #00B1CF)); text-decoration: underline; text-underline-offset: 2px; }

/* ── Courbes ── */
.rb-courbes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rb-carte { border: 1px solid var(--o8); border-radius: 12px; padding: 12px 14px; background: var(--o2, transparent); min-width: 0; }
.rb-carte-t { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.rb-carte-t h3 { margin: 0; font-size: 13.5px; font-weight: 800; }
.rb-carte-t small { font-size: 11.5px; color: var(--mut1); }
.rb-svg { display: block; width: 100%; height: auto; overflow: visible; }
.rb-svg .rb-zone-ko { fill: color-mix(in srgb, var(--st-red, #f87171) 13%, transparent); }
.rb-svg .rb-vide-t { fill: var(--mut1); font-size: 10.5px; }
.rb-svg .rb-hors-t { fill: var(--mut1); font-size: 9px; font-style: italic; }
.rb-svg .rb-g-grid { stroke: var(--o8); stroke-width: 1; }
.rb-svg .rb-g-base { stroke: var(--o14, var(--o10)); stroke-width: 1; }
.rb-svg .rb-g-an { stroke: var(--o6); stroke-width: 1; stroke-dasharray: 2 3; }
.rb-svg .rb-g-ax { fill: var(--mut1); font-size: 9.5px; font-variant-numeric: tabular-nums; }
.rb-svg .rb-seuil { stroke: var(--st-amber, #fbbf24); stroke-width: 1.2; stroke-dasharray: 4 3; }
.rb-svg .rb-seuil-t { fill: var(--st-amber, #fbbf24); font-size: 9.5px; font-weight: 700; }
.rb-svg .rb-ligne { fill: none; stroke: var(--brand, #00B1CF); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.rb-svg .rb-pt { fill: var(--surf-2, #102733); stroke: var(--brand, #00B1CF); stroke-width: 1.6; }
.rb-svg .rb-pt.ko { stroke: var(--st-red, #f87171); fill: var(--st-red, #f87171); }
.rb-svg .rb-ns { fill: var(--mut1); opacity: .55; }
.rb-svg .rb-franchi { fill: var(--st-red, #f87171); stroke: var(--surf-2, #102733); stroke-width: 1.5; }
.rb-svg .rb-franchi-l { stroke: var(--st-red, #f87171); stroke-width: 1; stroke-dasharray: 2 2; opacity: .7; }
.rb-svg .rb-franchi-t { fill: var(--st-red, #f87171); font-size: 9.5px; font-weight: 800; }
html[data-theme="light"] .rb-svg .rb-pt { fill: #fff; }
html[data-theme="light"] .rb-svg .rb-seuil-t { fill: #9a6200; }
html[data-theme="light"] .rb-svg .rb-seuil { stroke: #c98a00; }
html[data-theme="light"] .rb-svg :is(.rb-franchi-t) { fill: #b42318; }
html[data-theme="light"] .rb-svg .rb-franchi { stroke: #fff; }

.rb-legende { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11.5px; color: var(--mut1); margin-top: -4px; }
.rb-legende span { display: inline-flex; align-items: center; gap: 6px; }
.rb-legende i { display: inline-block; }
.rb-leg-ligne { width: 16px; height: 2px; background: var(--brand, #00B1CF); border-radius: 2px; }
.rb-leg-pt { width: 8px; height: 8px; border-radius: 50%; border: 1.6px solid var(--brand, #00B1CF); }
.rb-leg-ko { width: 12px; height: 10px; border-radius: 2px; background: color-mix(in srgb, var(--st-red, #f87171) 25%, transparent); }
.rb-leg-ns { width: 3px; height: 8px; background: var(--mut1); opacity: .55; }

/* ── Tableaux ── */
.rb-tw { overflow-x: auto; }
.rb-tw-mois { max-height: 420px; overflow-y: auto; }
.rb-tab { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.rb-tab th, .rb-tab td { padding: 6px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--o6); }
.rb-tab th[scope="row"] { text-align: left; font-weight: 600; color: var(--tx1); }
.rb-tab th[scope="row"] small { margin-left: 6px; font-weight: 600; font-size: 10.5px; color: var(--mut1); text-transform: uppercase; letter-spacing: .03em; }
.rb-tab thead th { position: sticky; top: 0; z-index: 1; background: var(--surf-2, #102733); color: var(--mut1); font-weight: 700; font-size: 11.5px; }
html[data-theme="light"] .rb-tab thead th { background: #fff; }
.rb-tab thead th:first-child { text-align: left; }
.rb-tab td.rb-s { color: var(--mut1); }
.rb-tab td.rb-ko { color: var(--st-red, #f87171); font-weight: 700; }
html[data-theme="light"] .rb-tab td.rb-ko { color: #b42318; }
.rb-tab td.rb-ns-c { color: var(--mut1); font-style: italic; }
.rb-tab td.rb-z { color: var(--mut1); opacity: .75; }
.rb-tab tr.rb-clot th, .rb-tab tr.rb-clot td { border-bottom-color: var(--o12, var(--o10)); background: var(--o3); }

.rb-defs { font-size: 12px; line-height: 1.5; color: var(--mut1); }
.rb-defs summary { cursor: pointer; font-weight: 700; color: var(--tx1); }
.rb-defs p { margin: 6px 0 0; }

/* ── Mat et Papier : surfaces pleines, filets du thème ── */
html[data-style="mat"] .rb-modal { background: var(--mt-carte) !important; border-color: var(--mt-trait) !important; box-shadow: 0 12px 32px rgba(0, 0, 0, .35) !important; }
html[data-style="mat"] :is(.rb-carte, .rb-seuil-c, .rb-alerte) { background: var(--mt-carte-2, transparent) !important; border-color: var(--mt-trait) !important; }
html[data-style="mat"] .rb-tab thead th { background: var(--mt-carte) !important; }
html[data-papier] .rb-modal { border-radius: 6px !important; box-shadow: var(--pp-ombre-fen) !important; }
html[data-papier] :is(.rb-carte, .rb-seuil-c, .rb-alerte) { border-radius: 4px !important; }
html[data-papier] .rb-titre, html[data-papier] .rb-carte-t h3 { font-family: var(--pp-serif); font-weight: 700; letter-spacing: 0; }
html[data-papier] .rb-tab thead th { border-bottom: 1px solid var(--pp-trait-fort); }

/* ── Compact ── */
html[data-density="compact"] .rb-tab th, html[data-density="compact"] .rb-tab td { padding-top: 3px; padding-bottom: 3px; }
html[data-density="compact"] .rb-corps { gap: 10px; padding-top: 12px; }
html[data-density="compact"] .rb-carte { padding: 8px 10px; }

/* ── Écrans moyens et téléphone ── */
@media (max-width: 1180px) {
    .rb-seuils { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
    .rb-seuils { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .rb-modal { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; border: 0; }
    .rb-head { flex-wrap: wrap; padding: 12px 14px 10px; gap: 10px; }
    .rb-head-ic { display: none; }
    .rb-sous { display: none; }
    .rb-scen { order: 3; width: 100%; }
    .rb-x { width: 44px; height: 44px; }
    .rb-corps { padding: 12px 12px 18px; }
    .rb-courbes { grid-template-columns: minmax(0, 1fr); }
    .rb-seuils { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .rb-seuil-in .rb-num { height: 40px; }
    .rb-tw-mois { max-height: none; }
    .rb-tab th, .rb-tab td { padding: 6px 7px; }
    .fintree-eq.rb-puce .fintree-eq-lbl { display: none; }
}
