/* Palette : bleu nuit / bleu électrique. Mobile-first, compatible RTL (propriétés logiques). */
:root {
  --night: #0B1220;
  --primary: #2563EB;
  --accent: #3B82F6;
  --page: #F5F7FA;
  --bs-primary: #2563EB;
  --bs-primary-rgb: 37, 99, 235;
  --bs-link-color: #2563EB;
  --bs-link-color-rgb: 37, 99, 235;
  --bs-link-hover-color: #1D4ED8;
  --bs-link-hover-color-rgb: 29, 78, 216;
}
body { background: var(--page); }

.btn-primary {
  --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--accent); --bs-btn-hover-border-color: var(--accent);
  --bs-btn-active-bg: #1D4ED8; --bs-btn-active-border-color: #1D4ED8;
  --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary);
}
.btn-outline-primary {
  --bs-btn-color: var(--primary); --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary);
  --bs-btn-active-bg: var(--primary); --bs-btn-active-border-color: var(--primary);
}
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(59, 130, 246, .25);
}
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* Barre latérale */
.sidebar { background: var(--night); color: #cbd5e1; width: 250px; flex-shrink: 0; }
@media (min-width: 992px) {
  .sidebar { min-height: 100vh; position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow-y: auto; }
}
.sidebar-brand { display: flex; align-items: center; gap: .6rem; padding: 1rem; color: #fff; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: .6rem; background: var(--primary); color: #fff; font-size: 1.1rem;
}
.sidebar-nav { padding: .5rem; gap: .15rem; }
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: .75rem; color: #cbd5e1;
  border-radius: .5rem; padding: .7rem .85rem; min-height: 44px;      /* cible tactile */
}
.sidebar-nav .nav-link:hover { background: rgba(59, 130, 246, .18); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--primary); color: #fff; }
.sidebar-nav .bi { font-size: 1.1rem; }

/* Barre supérieure */
.main-col { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  background: #fff; border-bottom: 1px solid #e5e7eb; padding: .6rem .75rem; position: sticky; top: 0; z-index: 1020;
}
.context-switch { flex: 1 1 180px; max-width: 360px; min-width: 0; }
.cabinet-badge { max-width: 220px; font-weight: 500; }

/* Cartes et tuiles */
.card { border: 0; box-shadow: 0 1px 2px rgba(11, 18, 32, .06), 0 1px 8px rgba(11, 18, 32, .04); border-radius: .75rem; }
.stat-tile { display: flex; align-items: center; gap: .9rem; padding: 1rem; }
.stat-icon {
  width: 3rem; height: 3rem; border-radius: .75rem; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.35rem; color: #fff; flex-shrink: 0;
}
.bg-tile-blue { background: #2563EB; } .bg-tile-green { background: #22C55E; }
.bg-tile-orange { background: #F59E0B; } .bg-tile-red { background: #EF4444; } .bg-tile-night { background: #0B1220; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.module-tile { opacity: .75; }
.table > :not(caption) > * > * { vertical-align: middle; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.35rem; margin: 0; }
.ltr { direction: ltr; unicode-bidi: embed; }   /* identifiants, e-mails, liens : toujours de gauche à droite */

/* Pages hors connexion */
body.guest { background: linear-gradient(160deg, #0B1220 0%, #13224a 60%, #2563EB 140%); min-height: 100vh; }
.guest-wrap { max-width: 440px; margin: 0 auto; padding: 2.5rem 1rem; }
.guest .brand-mark { width: 3.25rem; height: 3.25rem; font-size: 1.6rem; display: flex; }

.min-w-0 { min-width: 0; }

/* Lot 2 : menu par sections, lignes de saisie, pièces */
.sidebar-heading { padding: .9rem .85rem .25rem; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: #64748b; }
.line-row { padding: .6rem; border: 1px solid #e5e7eb; border-radius: .6rem; background: #fff; }
.line-row + .line-row { margin-top: .5rem; }
.num { text-align: end; font-variant-numeric: tabular-nums; direction: ltr; }
.totals-box { max-width: 340px; margin-inline-start: auto; }
.class-head td { background: #eef2ff; font-weight: 600; }
.doc-head { border-inline-start: 4px solid var(--primary); padding-inline-start: .75rem; }
@media print {
  .sidebar, .topbar, .no-print, .alert { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* Lot 3 : ventilation des règlements */
.alloc-input { max-width: 190px; }

/* =====================================================================
   Habillage DIAZ — couleurs relevées sur le logo :
   bleu marine #00204C, bleu vif #0083E6, orange #FD8601.
   Le bleu des boutons est un peu plus soutenu que celui du logo pour que
   le texte blanc reste lisible (contraste suffisant).
   ===================================================================== */
:root {
  --night: #00204C;
  --primary: #0A5FC2;
  --accent: #0083E6;
  --brand-orange: #FD8601;
  --bs-primary: #0A5FC2;
  --bs-primary-rgb: 10, 95, 194;
  --bs-link-color: #0A5FC2;
  --bs-link-color-rgb: 10, 95, 194;
  --bs-link-hover-color: #084C9B;
  --bs-link-hover-color-rgb: 8, 76, 155;
}
.btn-primary { --bs-btn-active-bg: #084C9B; --bs-btn-active-border-color: #084C9B; }
.form-control:focus, .form-select:focus, .form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(0, 131, 230, .25); }
.text-bg-primary { background-color: var(--primary) !important; }
.nav-pills { --bs-nav-pills-link-active-bg: var(--primary); --bs-nav-link-color: var(--primary); --bs-nav-link-hover-color: #084C9B; }
.page-link { --bs-pagination-color: var(--primary); }

/* Logo : toujours sur fond blanc (ses lettres bleu marine disparaîtraient sur la barre latérale) */
.sidebar-brand { background: #fff; padding: .85rem 1rem; border-bottom: 3px solid var(--brand-orange); }
.sidebar-logo { display: block; flex: 1 1 auto; min-width: 0; }
.sidebar-logo img { display: block; width: 100%; max-width: 190px; height: auto; }
.guest-logo { width: 100%; max-width: 300px; height: auto; }

/* Menu : entrée active en orange, texte marine (bien lisible) */
.sidebar-nav .nav-link:hover { background: rgba(0, 131, 230, .22); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--brand-orange); color: var(--night); font-weight: 600; }
.sidebar-heading { color: #8FA6C9; }
.class-head td { background: #E8F1FB; }
.doc-head { border-inline-start-color: var(--brand-orange); }
.bg-tile-blue { background: #0A5FC2; } .bg-tile-orange { background: #FD8601; } .bg-tile-night { background: #00204C; }

body.guest { background: linear-gradient(160deg, #00204C 0%, #06367A 55%, #0083E6 130%); }
body.guest .guest-wrap > .card { border-top: 4px solid var(--brand-orange) !important; }

/* Correctifs relevés au contrôle visuel dans le navigateur.
   1) Bootstrap rend « .offcanvas-lg » transparent sur grand écran (avec !important) : sans ces règles,
      la barre latérale perdait son fond bleu marine et le menu devenait illisible. */
.sidebar { --bs-offcanvas-bg: var(--night); --bs-offcanvas-color: #cbd5e1; --bs-offcanvas-width: 270px; }
@media (min-width: 992px) {
  .sidebar.offcanvas-lg { background-color: var(--night) !important; }
}
/* 2) « .card » impose une disposition en colonne : les tuiles chiffrées repassent en ligne (icône à gauche). */
.card.stat-tile { flex-direction: row; }
/* 3) Numéros de pièces jamais coupés au milieu ; liste des taux de TVA assez large pour afficher « 20 % ». */
.table a.ltr, .table span.ltr { white-space: nowrap; }
.line-row select[data-col="tax"] { min-width: 78px; }

/* Grand livre : le libellé garde une largeur lisible sur mobile (le tableau défile horizontalement) */
.col-label { min-width: 13rem; }

/* =====================================================================
   Maquette DIAZ (tableau de bord) : fond clair, cartes arrondies à ombre douce,
   menu à entrée active bleue, groupes repliables, barre du haut « cabinet + société ».
   Aucune règle ne dépend d'un style en ligne (CSP) ; propriétés logiques pour le RTL.
   ===================================================================== */
:root { --page: #F4F6FB; --line: #E6EAF2; --ink: #0F1B33; --muted: #6B7A90; }
body { background: var(--page); color: var(--ink); }
.card { border-radius: 1rem; box-shadow: 0 1px 2px rgba(15, 27, 51, .04), 0 6px 24px rgba(15, 27, 51, .05); }
.btn { border-radius: .65rem; }
.form-control, .form-select, .input-group-text { border-color: var(--line); border-radius: .65rem; }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--line); --bs-btn-hover-bg: #F1F5FB; --bs-btn-hover-border-color: var(--line); }
.btn-icon { width: 2.6rem; height: 2.6rem; display: inline-flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; }
.page-head h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -.01em; }
.section-title { font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 .75rem; }

/* --- Barre latérale --- */
.sidebar { width: 264px; --bs-offcanvas-width: 280px; }
.sidebar-brand { background: transparent; border-bottom: 0; padding: .9rem .9rem .5rem; }
.sidebar-logo { background: #fff; border-radius: .9rem; padding: .55rem .8rem; box-shadow: inset 0 -3px 0 var(--brand-orange); }
.sidebar-brand .btn-close { filter: invert(1) grayscale(1) brightness(2); }
.sidebar-nav { padding: .5rem .75rem 1.25rem; gap: .2rem; flex-wrap: nowrap; }
.sidebar-nav .nav-link { color: #D5DEEE; font-weight: 500; border-radius: .7rem; padding: .62rem .8rem; }
.sidebar-nav .nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar-nav .nav-link.active { background: linear-gradient(135deg, #1273E6, #0A5FC2); color: #fff; font-weight: 600; box-shadow: 0 6px 16px rgba(10, 95, 194, .35); }
.sidebar-nav .nav-link:focus-visible { outline: 2px solid #8EC5FF; outline-offset: 2px; }
.nav-caret { margin-inline-start: auto; font-size: .8rem !important; transition: transform .2s; }
.nav-group.collapsed .nav-caret { transform: rotate(-90deg); }
[dir="rtl"] .nav-group.collapsed .nav-caret { transform: rotate(90deg); }
.nav-group[aria-expanded="true"] { color: #fff; }
.sidebar-sub { padding-inline-start: 1.15rem; gap: .1rem; margin: .15rem 0 .35rem; flex-wrap: nowrap; }
.sidebar-sub .nav-link { font-size: .93rem; padding: .5rem .75rem; min-height: 40px; color: #B9C6DC; }
.sidebar-sub .bi { font-size: 1rem; }
@media (prefers-reduced-motion: reduce) { .nav-caret { transition: none; } }

/* --- Barre du haut --- */
.topbar { gap: .75rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); flex-wrap: nowrap; }
.cabinet-card { align-items: center; gap: .6rem; padding: .5rem .8rem; border: 1px solid var(--line); border-radius: .8rem; min-width: 0; max-width: 340px; box-shadow: 0 1px 2px rgba(15, 27, 51, .04); }
.cabinet-card > .bi { font-size: 1.25rem; color: var(--primary); }
.cabinet-name { font-weight: 600; min-width: 0; }
.role-pill { background: #ECE8FF; color: #4B32C3; font-weight: 600; font-size: .78rem; padding: .2rem .6rem; border-radius: .5rem; white-space: nowrap; }
.context-switch { flex: 1 1 170px; max-width: 320px; position: relative; }
.context-label { position: absolute; top: -.5rem; inset-inline-start: .7rem; background: #fff; padding: 0 .3rem; font-size: .68rem; color: var(--muted); line-height: 1; z-index: 6; }
.context-switch .form-select { font-weight: 600; padding-block: .55rem; }
.user-btn { display: flex; align-items: center; gap: .6rem; background: none; border: 0; padding: .15rem .25rem; border-radius: .7rem; color: inherit; }
.user-btn:hover, .user-btn:focus-visible { background: #F1F5FB; }
.avatar { width: 2.5rem; height: 2.5rem; border-radius: 50%; background: linear-gradient(135deg, #00204C, #0A5FC2); color: #fff; font-weight: 700; font-size: .9rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.user-meta { flex-direction: column; align-items: flex-start; line-height: 1.2; max-width: 180px; }
.user-name { font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: .78rem; color: var(--muted); }
.lang-btn { white-space: nowrap; }

/* --- Tuiles : icône sur fond teinté (la couleur pleine reste réservée aux actions) --- */
.tone-blue, .bg-tile-blue { background: #E6F0FD; color: #0A5FC2; }
.tone-green, .bg-tile-green { background: #E3F6EC; color: #12894F; }
.tone-orange, .bg-tile-orange { background: #FFF0DC; color: #C56200; }
.tone-violet { background: #EEEAFE; color: #5B3FD6; }
.bg-tile-red { background: #FDE8E8; color: #C62828; }
.bg-tile-night { background: #E4E9F2; color: #00204C; }
.text-tone-blue { color: #0A5FC2; } .text-tone-green { color: #12894F; } .text-tone-orange { color: #D96F00; } .text-tone-violet { color: #5B3FD6; }
.stat-icon { border-radius: 50%; }

/* --- Tableau de bord --- */
.dash-head { align-items: flex-start; }
.period-pick { width: auto; flex-wrap: nowrap; }
.period-pick .input-group-text { background: #fff; }
.period-pick .form-select { font-weight: 500; min-width: 9.5rem; }
.card.kpi { flex-direction: row; gap: .9rem; padding: 1.1rem 1.15rem; }
.kpi-icon { width: 3rem; height: 3rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem; flex-shrink: 0; }
.kpi-body { min-width: 0; flex: 1 1 auto; }
.kpi-label { font-size: .88rem; font-weight: 500; color: #33425C; }
.kpi-value { font-size: 1.45rem; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; white-space: nowrap; }
.kpi-value small { font-size: .8rem; font-weight: 600; }
.kpi-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: .5rem; margin-top: .2rem; min-height: 2.5rem; }
.kpi-trend-box { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.kpi-trend { font-size: .85rem; font-weight: 600; display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.kpi-vs { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trend-up { color: #12894F; } .trend-down { color: #C62828; } .trend-flat { color: var(--muted); }
.spark { width: 4.6rem; height: 2.5rem; flex-shrink: 0; direction: ltr; }
.spark-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-area { fill: currentColor; opacity: .12; }
.spark-green { color: #1FAF7A; } .spark-blue { color: #0A5FC2; } .spark-orange { color: #FD8601; } .spark-violet { color: #7C4DFF; }

.block-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: 1rem; }
.block-head h2 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.block-head h2 small { font-size: .8rem; }
.seg { background: #fff; border: 1px solid var(--line); border-radius: .65rem; padding: 2px; gap: 2px; flex-wrap: nowrap; }
.seg-btn { border: 0; background: none; border-radius: .5rem; padding: .32rem .8rem; font-size: .85rem; font-weight: 500; color: #33425C; white-space: nowrap; }
.seg-btn:hover { background: #F1F5FB; }
.seg-btn.active { background: var(--primary); color: #fff; }
.seg-count { font-weight: 700; margin-inline-start: .25rem; }

.chart-box { direction: ltr; }                  /* l'axe du temps se lit de gauche à droite dans les deux langues */
.chart-svg { width: 100%; height: auto; display: block; }
.chart-grid { stroke: #EDF1F7; stroke-width: 1; }
.chart-zero { stroke: #CBD5E1; stroke-width: 1; }
.chart-tick { font-size: 12px; fill: #6B7A90; }
.chart-bar { transition: opacity .15s; }
.chart-bar:hover { opacity: .75; }

.donut-wrap { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; justify-content: center; }
.donut-svg { direction: ltr; width: 11rem; height: 11rem; flex-shrink: 0; }
.donut-total { font-size: 5px; font-weight: 700; fill: var(--ink); }
.donut-unit { font-size: 3px; font-weight: 600; fill: #33425C; }
.legend { list-style: none; margin: 0; padding: 0; flex: 1 1 12rem; min-width: 0; max-width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); gap: .7rem; }
.legend li { min-width: 0; display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.legend-dot { width: .75rem; height: .75rem; border-radius: 50%; flex-shrink: 0; }
.legend-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-value { font-weight: 600; white-space: nowrap; }
.dot-1 { background: #0A5FC2; } .dot-2 { background: #FD8601; } .dot-3 { background: #1FAF7A; } .dot-4 { background: #7C4DFF; } .dot-other { background: #94A3B8; }

.due-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "icon main badge" "icon date amount"; align-items: center; gap: .3rem .75rem; padding: .8rem .85rem; border: 1px solid var(--line); border-radius: .8rem; color: inherit; text-decoration: none; }
.due-row + .due-row { margin-top: .55rem; }
.due-row:hover { border-color: #B9D4F5; background: #F8FBFF; color: inherit; }
.due-icon { grid-area: icon; width: 2.5rem; height: 2.5rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.due-main { grid-area: main; min-width: 0; display: flex; flex-direction: column; }
.due-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-sub { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-amount { grid-area: amount; font-weight: 700; white-space: nowrap; text-align: end; }
.due-date { grid-area: date; font-size: .85rem; color: #33425C; white-space: nowrap; }
.due-badge { grid-area: badge; font-weight: 600; font-size: .78rem; padding: .4rem .7rem; border-radius: .5rem; justify-self: end; }
.badge-late { background: #FDE8E8; color: #B42318; }
.badge-soon { background: #FFF0DC; color: #A85400; }
@media (min-width: 768px) {
  .due-row { grid-template-columns: auto minmax(0, 1fr) 7.2rem 9.6rem 5.4rem; grid-template-areas: "icon main date amount badge"; }
}

.shortcut-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
@media (min-width: 420px) { .shortcut-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .shortcut-grid:not(.shortcut-wide) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1500px) { .shortcut-grid:not(.shortcut-wide) { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.shortcut { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .45rem; min-height: 5.6rem; padding: .7rem .4rem; border: 1px solid var(--line); border-radius: .8rem; text-align: center; font-size: .82rem; font-weight: 600; line-height: 1.2; color: var(--ink); text-decoration: none; }
.shortcut .bi { font-size: 1.5rem; }
.shortcut:hover { border-color: #B9D4F5; background: #F8FBFF; color: var(--ink); box-shadow: 0 4px 14px rgba(10, 95, 194, .1); }
.empty-block { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.empty-block .bi { font-size: 2rem; display: block; margin-bottom: .4rem; }

/* Tableaux posés dans une carte : la première et la dernière colonne ne collent pas au bord arrondi */
.card > .table-responsive > .table > :not(caption) > * > :first-child { padding-inline-start: 1rem; }
.card > .table-responsive > .table > :not(caption) > * > :last-child { padding-inline-end: 1rem; }

/* États de synthèse (CPC, bilan) : titres de masse, totaux et résultats se distinguent par la graisse et le fond */
.stmt-table .stmt-h td { font-weight: 700; background: #F1F5FB; padding-top: .55rem; padding-bottom: .55rem; }
.card > .table-responsive > .stmt-table > tbody > .stmt-l > td:first-child { padding-inline-start: 1.9rem; }   /* plus précis que la règle générale des cartes */
.stmt-table .stmt-t td { font-weight: 600; border-top: 1px solid #CBD5E1; }
.stmt-table .stmt-r td { font-weight: 700; background: #E6F0FD; border-top: 2px solid var(--primary); }
.stmt-table tfoot .stmt-r td { font-size: 1.02rem; }
@media print { .stmt-table .stmt-h td, .stmt-table .stmt-r td { background: none; } }

/* Rapports : barre de part (élément <progress> natif, aucune largeur en ligne) */
.report-bar-col { width: 22%; min-width: 8rem; }
.report-bar { width: 100%; height: .6rem; border: 0; border-radius: .3rem; background: #EEF2F7; overflow: hidden; vertical-align: middle; appearance: none; -webkit-appearance: none; }
.report-bar::-webkit-progress-bar { background: #EEF2F7; border-radius: .3rem; }
.report-bar::-webkit-progress-value { background: var(--primary); border-radius: .3rem; }
.report-bar::-moz-progress-bar { background: var(--primary); border-radius: .3rem; }

/* En-têtes et cellules de montants : jamais coupés sur deux lignes (le tableau défile horizontalement sur mobile) */
.table th.num, .table td.num { white-space: nowrap; }

/* Paie : cellules de saisie compactes, alignées à droite */
.pay-input { min-width: 6.5rem; max-width: 9rem; margin-inline-start: auto; }

/* Police : pile explicite plutôt que « system-ui ». Sur certains postes, la police système du navigateur
   n'affiche pas les graisses intermédiaires (500 / 600) : les libellés du menu et de la barre du haut
   devenaient invisibles. Segoe UI, Roboto et Arial ont toutes un gras et un demi-gras fiables. */
:root {
  --bs-body-font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", Tahoma, sans-serif;
  --bs-font-sans-serif: "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", Tahoma, sans-serif;
}
body, button, input, select, textarea { font-family: var(--bs-body-font-family); }
[dir="rtl"] { --bs-body-font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Noto Sans Arabic", Arial, sans-serif; }

/* ---------- Taille générale du texte ----------
   Toutes les tailles sont en rem : on réduit la base (16px -> 15px)
   et l'ensemble de l'interface suit proportionnellement.
   Pour ajuster : 100% = taille d'origine, 90% = encore plus petit. */
html { font-size: 93.75%; }
/* iOS zoome sur les champs de moins de 16px : on les garde à 16px sur mobile */
@media (max-width: 767.98px) {
  input.form-control, select.form-select, textarea.form-control { font-size: 16px; }
}

/* ---------- Sous-menus ----------
   Mobile (< 992px) : accordéon vertical dans le menu coulissant.
   Ordinateur : volet qui sort à côté de la barre latérale (position calculée par app.js). */
.sidebar-sub { display: none; }
.has-sub.is-open > .sidebar-sub { display: flex; }
.has-sub:not(.is-open) > .nav-group .nav-caret { transform: rotate(-90deg); }
[dir="rtl"] .has-sub:not(.is-open) > .nav-group .nav-caret { transform: rotate(90deg); }
@media (min-width: 992px) {
  .sidebar { z-index: 1030; }                                        /* la barre (et son volet) passe au-dessus du contenu */
  .has-sub.is-open > .sidebar-sub { display: none; }                 /* l'accordéon ne s'applique pas ici */
  .has-sub > .nav-group .nav-caret,
  .has-sub:not(.is-open) > .nav-group .nav-caret { transform: rotate(-90deg); }   /* flèche vers le volet */
  [dir="rtl"] .has-sub > .nav-group .nav-caret { transform: rotate(90deg); }
  .has-sub.is-fly > .nav-group { background: rgba(255, 255, 255, .1); color: #fff; }
  /* Le sous-menu étant masqué, le groupe de la page courante est signalé sur l'entrée parente */
  .has-sub.has-active > .nav-group { color: #fff; box-shadow: inset 3px 0 0 #3B9BFF; background: rgba(18, 115, 230, .22); }
  [dir="rtl"] .has-sub.has-active > .nav-group { box-shadow: inset -3px 0 0 #3B9BFF; }
  .has-sub.is-fly > .sidebar-sub {
    display: flex; position: fixed; z-index: 1040;                   /* fixed : échappe au défilement de la barre */
    min-width: 15rem; max-width: 20rem; max-height: calc(100vh - 16px); overflow-y: auto;
    margin: 0; padding: .5rem; gap: .1rem;
    background: var(--night); border: 1px solid rgba(255, 255, 255, .1); border-radius: .8rem;
    box-shadow: 0 14px 34px rgba(0, 20, 50, .35);
  }
}
