/* Shell comptabilité — aligné plateforme Amelie (sidebar pleine hauteur, header gris à droite) */

/* Pages bornées (Ventes, edition…) : .accounting-app/.accounting-shell portent min-height:100vh,
   qui peut finir légèrement plus haute que 100vh une fois la sidebar/le header (position: fixed)
   pris en compte par le navigateur, ouvrant quelques px de scroll document. Rien ne doit défiler
   au niveau document sur ces pages — tout le défilement se fait dans le conteneur interne
   (.card-body) — donc on verrouille explicitement le scroll document plutôt que d'espérer que
   les hauteurs calculées tombent pile à 100vh. */
/* :has() correspond dès qu'un marqueur existe QUELQUE PART dans le DOM — les onglets de travail
   restent tous montés (juste masqués via .accounting-tab-pane--hidden), donc un onglet Ventes
   ouvert EN ARRIÈRE-PLAN suffisait à déclencher ces règles même en consultant un autre onglet.
   D'où le préfixe systématique par l'onglet actif : c'est lui qui doit contenir le marqueur, pas
   le document entier.
   Marqueur dédié .accounting-bounded-list plutôt que .sales-card/.invoice-mailbox-card/
   .grand-livre/.balance-generale/etc. : ces classes-là sont réutilisées ailleurs à des fins
   purement visuelles — CompanyDetail.razor (Fiche tiers, onglet Documents) porte aussi
   .invoice-mailbox-card sur un panneau intégré sans rapport avec l'écran Achat/Divers, et
   AccountingVatDeclaration.razor / AccountingSimplifiedTrialBalance.razor réutilisent respectivement
   .liasse-fiscale et .balance-generale pour un style cohérent sur une page différente. Confirmé
   en direct : ouvrir une fiche fournisseur verrouillait le scroll de toute la page à cause du
   panneau Documents, alors qu'aucune vraie page Achat/Ventes n'était affichée. Chaque page
   bornée (Ventes, Achat/Divers, et les 12 éditions/rapports comptables) porte désormais aussi
   .accounting-bounded-list sur sa propre racine — jamais un composant réutilisé ailleurs. */
/* html, pas body : document.scrollingElement est <html> dans ce document (mode standards) —
   confirmé en direct (htmlScrollTop non nul alors que bodyScrollTop restait 0). Verrouiller
   overflow sur body seul ne bloquait donc rien : le vrai défilement document se fait sur html. */
html:has(.accounting-tab-pane:not(.accounting-tab-pane--hidden) .accounting-bounded-list),
body:has(.accounting-tab-pane:not(.accounting-tab-pane--hidden) .accounting-bounded-list) {
  /* !important nécessaire : au changement d'onglet, un utilitaire Bootstrap (scroll-lock de
     sidebar/offcanvas) pose overflow:auto en style INLINE sur body, ce qui bat n'importe quelle
     règle de feuille de style ordinaire indépendamment de sa spécificité — seul !important
     l'emporte sur un style inline non important. Confirmé en direct : le sélecteur matchait déjà
     (body.matches(...) === true) mais getComputedStyle restait "auto" à cause de ce style inline. */
  overflow: hidden !important;
}

.accounting-shell {
  --accounting-sidebar-bg: #0f1a2e;
  --accounting-sidebar-text: #9ca3af;
  --accounting-sidebar-text-active: #ffffff;
  --accounting-sidebar-active-bg: #7c3aed;
  --accounting-sidebar-hover-bg: rgba(124, 58, 237, 0.22);
  --accounting-sidebar-accent: #a78bfa;
  --accounting-header-height: 5rem;
  --accounting-sidebar-width: 14rem;
  --accounting-header-bg: #ffffff;
  --accounting-header-border: #e8ecf1;
  min-height: 100vh;
}

/* —— Sidebar pleine hauteur —— */
.accounting-shell #accounting-sidebar {
  background: var(--accounting-sidebar-bg) !important;
  width: var(--accounting-sidebar-width) !important;
  min-width: var(--accounting-sidebar-width) !important;
  top: 0 !important;
  bottom: 0;
  left: 0;
  height: 100vh !important;
  z-index: 1650;
  position: fixed !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.25s ease, visibility 0.25s ease;
  border-inline-end: none !important;
  font-family: "Montserrat", sans-serif;
}

.accounting-shell #accounting-sidebar:not(.show) {
  width: var(--accounting-sidebar-width) !important;
  min-width: var(--accounting-sidebar-width) !important;
}

.accounting-shell:not(.sidebar-closed) #accounting-sidebar {
  transform: translateX(0) !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.accounting-shell.sidebar-closed #accounting-sidebar {
  transform: translateX(-100%) !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* —— Zone droite (header + contenu) —— */
.accounting-shell .accounting-workspace {
  min-height: 100vh;
  transition: margin-inline-start 0.25s ease, width 0.25s ease;
}

.accounting-shell:not(.sidebar-closed) .accounting-workspace {
  margin-inline-start: var(--accounting-sidebar-width);
  width: calc(100% - var(--accounting-sidebar-width));
}

.accounting-shell.sidebar-closed .accounting-workspace {
  margin-inline-start: 0;
  width: 100%;
}

/* —— Header blanc (aligné app-header Amélie, à droite du logo sidebar) —— */
.accounting-shell .accounting-header.app-header {
  position: fixed;
  top: 0;
  inset-inline-end: 0;
  z-index: 1700;
  height: var(--accounting-header-height) !important;
  background: var(--accounting-header-bg) !important;
  border-bottom: 1px solid var(--accounting-header-border) !important;
  transition: inset-inline-start 0.25s ease, width 0.25s ease;
  box-shadow: none;
  display: flex;
  align-items: stretch;
}

.accounting-shell .accounting-header--with-brand .main-header-container {
  flex: 1 1 auto;
  min-width: 0;
  width: auto !important;
}

.accounting-shell .accounting-header__brand-panel {
  flex: 0 0 var(--accounting-sidebar-width);
  width: var(--accounting-sidebar-width);
  min-width: var(--accounting-sidebar-width);
  max-width: var(--accounting-sidebar-width);
  background: var(--accounting-sidebar-bg);
  border-inline-end: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  padding: 0 1.15rem;
  overflow: hidden;
}

.accounting-shell .accounting-header__brand-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.125rem;
  text-decoration: none;
  min-width: 0;
  width: 100%;
}

.accounting-shell .accounting-brand__mark {
  height: 2.25rem;
  width: auto;
  max-width: 100%;
  display: block;
}

.accounting-shell .accounting-brand__tag {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accounting-sidebar-text);
  line-height: 1;
}

.accounting-shell:not(.sidebar-closed) .accounting-header.app-header {
  inset-inline-start: var(--accounting-sidebar-width);
  width: calc(100% - var(--accounting-sidebar-width));
}

.accounting-shell.sidebar-closed .accounting-header.app-header {
  inset-inline-start: 0;
  width: 100%;
}

.accounting-shell .accounting-header__bar.main-header-container {
  display: grid;
  grid-template-columns: minmax(3.5rem, auto) 1fr minmax(auto, max-content);
  align-items: stretch;
  justify-content: stretch;
  height: 100%;
  width: auto !important;
  flex: 1 1 auto;
  min-width: 0;
  padding-inline: 0.25rem 1rem;
}

.accounting-shell .accounting-header__bar > .header-content-right {
  justify-content: flex-end;
  align-items: center;
}

.accounting-shell .accounting-header__bar .header-element {
  align-items: center;
}

.accounting-shell .accounting-header__language {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem;
  padding: 0.5rem 0.65rem !important;
  height: auto;
  line-height: 1;
}

.accounting-shell .accounting-header__language-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.125rem;
  height: 1.125rem;
  padding: 0;
  margin: 0;
  font-size: 1.125rem;
  line-height: 1;
  color: #475569;
  position: static;
  border-radius: 0;
}

.accounting-shell .accounting-header__language-code {
  display: inline-flex;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  color: #111c43;
}

.accounting-shell .accounting-header__left {
  display: flex;
  align-items: center;
}

.accounting-shell .accounting-header__center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 0.75rem;
  min-width: 0;
  padding-inline: 0.75rem;
}

.accounting-shell .accounting-header__center .accounting-header__year {
  flex-shrink: 0;
}

.accounting-shell .accounting-header__toggle-wrap {
  position: relative;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.accounting-shell .accounting-header__toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: #111c43;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.accounting-shell .accounting-header__toggle-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.accounting-shell .accounting-header__toggle-btn:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.accounting-shell .accounting-header__dossier {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  color: #2d3748;
  font-size: 1rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.35rem 0.5rem;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.accounting-shell .accounting-header__dossier:hover {
  background: #f1f5f9;
}

.accounting-shell .accounting-header__dossier:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.accounting-shell .accounting-header__dossier-chevron {
  font-size: 1.15rem;
  opacity: 0.55;
  flex-shrink: 0;
  line-height: 1;
}

.accounting-shell .accounting-header__year {
  display: flex;
  align-items: center;
}

.accounting-shell .accounting-year-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.4rem 0.65rem 0.4rem 0.55rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 0.625rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  min-height: 2.5rem;
}

.accounting-shell .accounting-year-picker:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.07);
}

.accounting-shell .accounting-year-picker:focus-within {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.accounting-shell .accounting-year-picker__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.375rem;
  background: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.accounting-shell .accounting-year-picker__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
  min-width: 0;
}

.accounting-shell .accounting-year-picker__label {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.accounting-shell .accounting-year-picker__select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #111c43;
  line-height: 1.2;
  cursor: pointer;
  min-width: 3rem;
  max-width: 4.5rem;
}

.accounting-shell .accounting-year-picker__select:focus {
  outline: none;
}

.accounting-shell .accounting-year-picker__chevron {
  font-size: 1rem;
  color: #94a3b8;
  flex-shrink: 0;
  pointer-events: none;
  margin-inline-start: -0.15rem;
}

@media (max-width: 575.98px) {
  .accounting-shell .accounting-year-picker__label {
    display: none;
  }

  .accounting-shell .accounting-year-picker__text {
    flex-direction: row;
    align-items: center;
  }

  .accounting-shell .accounting-year-picker {
    padding: 0.35rem 0.5rem;
  }
}


/* —— Contenu principal —— */
.accounting-shell .accounting-main-content {
  margin-block-start: var(--accounting-header-height) !important;
  margin-inline-start: 0 !important;
  min-height: calc(100vh - var(--accounting-header-height));
  background: #f8fafc;
  position: relative;
  z-index: 1;
}

.accounting-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1640;
}

.accounting-shell #accounting-sidebar .main-sidebar-header {
  position: sticky !important;
  top: 0 !important;
  inset-inline-start: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 5rem !important;
  min-height: 5rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  background: var(--accounting-sidebar-bg) !important;
  border-inline-end: none !important;
  border-block-end: 1px solid rgba(55, 65, 81, 0.4);
  z-index: 2;
  flex-shrink: 0;
}

.accounting-shell.sidebar-closed #accounting-sidebar .main-sidebar-header {
  display: none !important;
}

.accounting-shell #accounting-sidebar .main-sidebar-header a.header-logo {
  width: 90% !important;
  height: 80% !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

.accounting-shell #accounting-sidebar .main-sidebar-header a.header-logo img {
  height: 3.25rem;
  width: auto;
}

.accounting-shell #accounting-sidebar .main-sidebar {
  flex: 1 1 auto;
  min-height: 0;
  padding-block-start: 0 !important;
  height: auto;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 2rem;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

/* —— Sidebar nav (Figma: slot-online-25593055.figma.site) —— */
.accounting-shell #accounting-sidebar .main-menu-container {
  padding: 0 0.5rem 1rem;
}

.accounting-shell #accounting-sidebar .main-menu {
  margin: 0;
  padding: 0;
  list-style: none;
}

.accounting-shell #accounting-sidebar .slide {
  margin: 0;
  padding: 0 !important;
}

.accounting-shell #accounting-sidebar .slide--category {
  margin: 0.85rem 0 0.25rem;
  padding: 0 0.65rem !important;
  pointer-events: none;
}

.accounting-shell #accounting-sidebar .side-menu__category {
  display: block;
  color: #9ca3af;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
}

.accounting-shell #accounting-sidebar.app-sidebar .side-menu__item {
  position: relative;
  margin: 0.1rem 0 !important;
  padding: 0.5rem 0.65rem;
  gap: 0.65rem;
  border-radius: 0.5rem !important;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border-left: none;
  background: transparent;
  transition: background-color 0.15s ease;
}

.accounting-shell #accounting-sidebar.app-sidebar .side-menu__item:hover {
  color: #fff !important;
  background-color: var(--accounting-sidebar-hover-bg) !important;
  border-left: none !important;
}

.accounting-shell #accounting-sidebar.app-sidebar .side-menu__item.active {
  color: #fff !important;
  background-color: var(--accounting-sidebar-active-bg) !important;
  font-weight: 600;
  border-left: none !important;
}

.accounting-shell #accounting-sidebar.app-sidebar .side-menu__item.active::before {
  content: none;
}

.accounting-shell #accounting-sidebar.app-sidebar .side-menu__item.active .side-menu__label,
.accounting-shell #accounting-sidebar.app-sidebar .side-menu__item:hover .side-menu__label,
.accounting-shell #accounting-sidebar.app-sidebar .side-menu__item.active .side-menu__angle,
.accounting-shell #accounting-sidebar.app-sidebar .side-menu__item:hover .side-menu__angle {
  color: #fff !important;
}

.accounting-shell #accounting-sidebar .side-menu__icon-main,
.accounting-shell #accounting-sidebar .side-menu__item > i.bx:first-child,
.accounting-shell #accounting-sidebar .side-menu__item .d-flex.align-items-center > i.bx {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  font-size: 1.25rem;
  line-height: 1;
  margin-inline-end: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.accounting-shell #accounting-sidebar .side-menu__item > .side-menu__label,
.accounting-shell #accounting-sidebar .side-menu__item .d-flex.align-items-center .side-menu__label,
.accounting-shell #accounting-sidebar .side-menu__item .d-flex.flex-column .side-menu__label {
  display: block;
  flex: 1;
  min-width: 0;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.accounting-shell #accounting-sidebar .side-menu__item > .d-flex.align-items-center {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  gap: 0.65rem;
}

/* Descriptions sous titre retirées pour un menu plus étroit (Accueil Amélie). */
.accounting-shell #accounting-sidebar .side-menu__item .side-menu__desc {
  display: none !important;
}

.accounting-shell #accounting-sidebar .side-menu__item .side-menu__angle {
  position: static;
  flex-shrink: 0;
  font-size: 1rem;
  color: var(--accounting-sidebar-text) !important;
  transition: transform 0.15s ease;
}

.accounting-shell #accounting-sidebar .side-menu__item.child-active {
  background-color: transparent !important;
}

.accounting-shell #accounting-sidebar .side-menu__item.child-active > .d-flex.align-items-center .side-menu__label,
.accounting-shell #accounting-sidebar .side-menu__item.child-active > .side-menu__label {
  color: #fff !important;
  font-weight: 600;
}

/* Dashboard status block */
.accounting-shell #accounting-sidebar .sidebar-dashboard-status {
  padding: 0.75rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid rgba(55, 65, 81, 0.4);
}

.accounting-shell #accounting-sidebar .sidebar-dashboard-status .custom__side-menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 0;
  margin: 0 0 0.125rem;
  text-align: end;
  gap: 0;
}

.accounting-shell #accounting-sidebar .sidebar-status-label {
  font-size: 0.6875rem;
  color: var(--accounting-sidebar-text);
  font-weight: 400;
  line-height: 1.45;
}

.accounting-shell #accounting-sidebar .sidebar-status-date {
  font-size: 0.6875rem;
  color: #fff;
  font-weight: 600;
  line-height: 1.45;
}

.accounting-shell #accounting-sidebar .sidebar-status-date-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
}

.accounting-shell #accounting-sidebar .sidebar-status-date-row .bx-info-circle {
  font-size: 0.875rem;
  color: var(--accounting-sidebar-text);
  opacity: 1;
  vertical-align: middle;
}

/* Submenus */
.accounting-shell #accounting-sidebar .slide-submenu {
  padding: 0 0 0 1rem;
  list-style: none;
  margin: 0;
}

.accounting-shell #accounting-sidebar .slide-submenu .side-menu__item {
  padding: 0.625rem 0.75rem;
  font-weight: 500;
}

.accounting-shell #accounting-sidebar .slide-submenu .side-menu__item i {
  width: 1rem !important;
  height: 1rem !important;
  font-size: 1rem !important;
}

.accounting-shell #accounting-sidebar .slide-submenu .side-menu__item .fs-14 {
  font-size: 0.875rem !important;
  font-weight: 500;
  color: #fff;
}

@media (max-width: 991.98px) {
  .accounting-shell:not(.sidebar-closed) .accounting-workspace {
    margin-inline-start: 0;
    width: 100%;
  }

  .accounting-shell:not(.sidebar-closed) .accounting-header {
    inset-inline-start: 0;
    width: 100%;
  }
}

/* —— Éditions comptables (balance, grand livre, etc.) —— */
.accounting-edition-header {
  background: #fafbfc;
}

.accounting-edition-header__title {
  font-size: 1rem;
  white-space: nowrap;
}

.accounting-edition-header__field {
  flex-shrink: 0;
}

.accounting-edition-header__search {
  flex-shrink: 0;
  width: 200px;
}

.accounting-edition-header__field .form-label {
  color: #64748b;
}

.accounting-edition-header__date-input,
.accounting-edition-header .form-control-sm,
.accounting-edition-header .form-select-sm {
  width: auto;
  min-width: 9.5rem;
}

.accounting-edition-header__meta {
  line-height: 1.3;
}

/* Boutons d'action de l'en-tête : même taille partout (largeur mini uniforme). */
.accounting-edition-header__action {
  min-width: 7.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.accounting-edition__table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f5f9;
  font-size: 0.75rem;
  white-space: nowrap;
  border-bottom: 2px solid #cbd5e1;
}

.accounting-edition__table td {
  font-size: 0.8125rem;
  vertical-align: middle;
}

.accounting-edition__row--total td {
  border-top: 1px solid #cbd5e1;
  background: #f8fafc;
}

.accounting-edition__row--grand td {
  background: #e2e8f0;
  font-weight: 700;
  border-top: 2px solid #94a3b8;
}

.accounting-edition__result {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.accounting-edition__result .card-body {
  overflow: auto;
  flex: 1;
  min-height: 0;
}

/* Pages d'édition — occuper toute la hauteur sous header + onglets.
   Préfixe .accounting-tab-pane:not(.accounting-tab-pane--hidden) devant chaque marqueur : les
   onglets restent tous montés (juste masqués), donc sans ce préfixe un onglet Ventes/edition
   ouvert EN ARRIÈRE-PLAN suffisait à déclencher ces règles même en consultant un autre onglet
   (ex. Tableau de bord) — cassant sa mise en page. Le marqueur doit être DANS l'onglet actif. */
.accounting-shell .accounting-main-content:has(
  .accounting-tab-pane:not(.accounting-tab-pane--hidden) .accounting-bounded-list
) {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--accounting-header-height));
  min-height: calc(100vh - var(--accounting-header-height));
  overflow: hidden;
}

.accounting-shell .accounting-main-content:has(
  .accounting-tab-pane:not(.accounting-tab-pane--hidden) .accounting-bounded-list
) > .accounting-workspace-tabs {
  flex-shrink: 0;
  /* Dans ce contexte borné, .accounting-main-content lui-même (et non plus le viewport)
     devient la référence du sticky — il établit un conteneur de défilement dès qu'il a un
     overflow différent de visible, que son propre contenu déborde ou non. Son bord supérieur
     colle déjà au bas du header fixe (margin-block-start plus haut) : le décalage correct
     ici est 0, pas header-height, sous peine de doubler le décalage (header + top). */
  position: sticky !important;
  top: 0 !important;
}

.accounting-shell .accounting-main-content:has(
  .accounting-tab-pane:not(.accounting-tab-pane--hidden) .accounting-bounded-list
) > .content-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* .content-wrapper garde son padding:1.5rem de base (AccountingLayout.razor) même ici — sur
     une page bornée, ce padding devient un vide fixe au-dessus et en dessous de la carte, prélevé
     sur la hauteur que le tableau pourrait utiliser. Réduit au minimum pour maximiser les lignes
     visibles, quitte à perdre un peu d'air visuel. */
  padding: 0.35rem 1rem !important;
}

.accounting-shell .content-wrapper:has(
  .accounting-tab-pane:not(.accounting-tab-pane--hidden) .accounting-bounded-list
) .accounting-workspace-tab-host,
.accounting-shell .content-wrapper:has(
  .accounting-tab-pane:not(.accounting-tab-pane--hidden) .accounting-bounded-list
) .accounting-tab-pane:not(.accounting-tab-pane--hidden) {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Ventes / Achat / Divers — même stratégie, un seul bloc partagé via le marqueur dédié
   .accounting-bounded-list (voir plus haut pourquoi pas .sales-card/.invoice-mailbox-card
   directement) : l'en-tête, les filtres et l'en-tête de tableau restent visibles, seules les
   lignes défilent sous eux (au lieu de tout faire défiler sous le header fixe). */
.accounting-shell .accounting-tab-pane:has(.accounting-bounded-list) > .row,
.accounting-shell .accounting-tab-pane:has(.accounting-bounded-list) > .row > .col-xl-12 {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.accounting-shell .accounting-bounded-list {
  flex: 1;
  min-height: 0;
  display: flex !important;
  flex-direction: column;
  overflow: hidden !important;
}

.accounting-shell .accounting-bounded-list > *:not(.card-body) {
  flex-shrink: 0;
}

.accounting-shell .accounting-bounded-list > .card-body,
/* .account-ledger (grand livre GL et analytique) n'a pas de .card-body : c'est
   .account-ledger__panel qui porte le tableau défilant — même rôle, même traitement. */
.accounting-shell .account-ledger.accounting-bounded-list > .account-ledger__panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Le scroll vertical se fait ici, pas sur .card-body : un seul conteneur de défilement
   (horizontal + vertical) évite l'ambiguïté de deux wrappers imbriqués qui se disputent la
   référence du thead sticky (cf. .sales-table-wrap dans sales.css / .invoice-mailbox-table-wrap
   dans processing.css). Même chose côté mobile (.sales-mobile / .invoice-mailbox-mobile) : sans
   ça son contenu serait coupé sous la hauteur bloquée du shell. Chaque page garde son nom de
   classe pour son wrapper de tableau (colonnes/tri propres à chacune) — seul le marqueur qui
   déclenche le layout borné est mutualisé. */
.accounting-shell .accounting-bounded-list > .card-body > .sales-table-wrap,
.accounting-shell .accounting-bounded-list > .card-body > .sales-mobile,
.accounting-shell .accounting-bounded-list > .card-body > .invoice-mailbox-table-wrap,
.accounting-shell .accounting-bounded-list > .card-body > .invoice-mailbox-mobile {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.accounting-shell .accounting-bounded-list > .card-body > *:not(.sales-table-wrap):not(.sales-mobile):not(.invoice-mailbox-table-wrap):not(.invoice-mailbox-mobile) {
  flex-shrink: 0;
}

/* Financiers (Comptes, À traiter) : pas de .card-body — le tableau est enfant direct de la carte
   (.card-header, .fin-kpi-strip/.fin-tabs/.fin-kpi-cards, .sales-search-bar, puis le tableau).
   Sans ces règles rien n'obtient flex:1/overflow:auto : la carte (overflow:hidden par le marqueur)
   couperait simplement tout ce qui dépasse au lieu de le faire défiler. */
.accounting-shell .accounting-bounded-list > .table-responsive,
.accounting-shell .accounting-bounded-list > .archive-table-wrapper,
.accounting-shell .accounting-bounded-list > .d-md-none {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.accounting-shell .accounting-bounded-list > *:not(.table-responsive):not(.archive-table-wrapper):not(.d-md-none):not(.card-body) {
  flex-shrink: 0;
}

.accounting-shell .grand-livre,
.accounting-shell .balance-generale,
.accounting-shell .accounting-edition,
.accounting-shell .interrogation-comptes,
.accounting-shell .journal-ecritures,
.accounting-shell .fichier-fec,
.accounting-shell .bilan-interne,
.accounting-shell .liasse-fiscale,
.accounting-shell .fixed-asset-index,
.accounting-shell .expense-personal-use-report,
.accounting-shell .plan-comptable,
.accounting-shell .accounting-vat,
.accounting-shell .account-ledger,
.accounting-shell .archive-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.accounting-shell .grand-livre__result,
.accounting-shell .balance-generale__result,
.accounting-shell .accounting-edition__result,
.accounting-shell .interrogation-comptes__result,
.accounting-shell .journal-ecritures__result,
.accounting-shell .fichier-fec__result,
.accounting-shell .bilan-interne__result,
.accounting-shell .liasse-fiscale__result,
.accounting-shell .fixed-asset-index__result,
.accounting-shell .expense-personal-use-report__result,
.accounting-shell .plan-comptable__card,
.accounting-shell .accounting-vat__card,
.accounting-shell .account-ledger__panel:not(.account-ledger__panel--centered),
.accounting-shell .archive-card {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.accounting-shell .grand-livre__result > .accounting-edition-header,
.accounting-shell .balance-generale__result > .accounting-edition-header,
.accounting-shell .accounting-edition__result > .accounting-edition-header,
.accounting-shell .interrogation-comptes__result > .accounting-edition-header,
.accounting-shell .journal-ecritures__result > .accounting-edition-header,
.accounting-shell .fichier-fec__result > .accounting-edition-header,
.accounting-shell .bilan-interne__result > .accounting-edition-header,
.accounting-shell .liasse-fiscale__result > .accounting-edition-header,
.accounting-shell .fixed-asset-index__result > .card-header,
.accounting-shell .expense-personal-use-report__result > .accounting-edition-header,
.accounting-shell .plan-comptable__card > .accounting-edition-header,
.accounting-shell .accounting-vat__card > .accounting-edition-header,
.accounting-shell .account-ledger > .accounting-edition-header {
  flex-shrink: 0;
}

.accounting-shell .grand-livre__result > .card-body,
.accounting-shell .balance-generale__result > .card-body,
.accounting-shell .interrogation-comptes__result > .card-body,
.accounting-shell .journal-ecritures__result > .card-body,
.accounting-shell .fichier-fec__result > .card-body,
.accounting-shell .bilan-interne__result > .card-body,
.accounting-shell .liasse-fiscale__body,
.accounting-shell .fixed-asset-index__body,
.accounting-shell .expense-personal-use-report__result > .card-body,
.accounting-shell .accounting-vat__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.accounting-shell .grand-livre__scroll,
.accounting-shell .balance-generale__scroll,
.accounting-shell .interrogation-comptes__scroll,
.accounting-shell .journal-ecritures__scroll,
.accounting-shell .fichier-fec__scroll,
.accounting-shell .liasse-fiscale__scroll,
.accounting-shell .fixed-asset-index__scroll,
.accounting-shell .expense-personal-use-report__scroll,
.accounting-shell .plan-comptable__table-wrap,
.accounting-shell .account-ledger__table-wrap,
.accounting-shell .accounting-vat__scroll {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

/* Vue desktop (.accounting-vat__scroll:has(.table-responsive)) : contient un .table-responsive
   Bootstrap qui a lui-meme overflow:auto — deux conteneurs de defilement imbriques causeraient un
   conflit sur le thead sticky (meme raison que .bilan-interne__sheet plus bas). Le scroll
   utilisateur se fait alors sur .table-responsive, donc .accounting-vat__scroll reste hidden dans
   ce cas ; la vue mobile (cartes, sans .table-responsive) garde son propre overflow:auto ci-dessus. */
.accounting-shell .accounting-vat__scroll:has(.table-responsive) {
  overflow: hidden;
}

.accounting-shell .accounting-vat__scroll > .table-responsive {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.accounting-shell .accounting-vat__body > *:not(.accounting-vat__scroll) {
  flex-shrink: 0;
}

/* .bilan-interne__sheet contient un .table-responsive Bootstrap qui a lui-même overflow:auto —
   deux conteneurs de défilement imbriqués causeraient un conflit sur le thead sticky.
   Le scroll utilisateur se fait sur .table-responsive, donc .bilan-interne__sheet reste hidden. */
.accounting-shell .bilan-interne__sheet {
  flex: 1;
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.accounting-shell .bilan-interne__sheet > .table-responsive {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.accounting-shell .fixed-asset-index__toolbar,
.accounting-shell .bilan-interne__tabs {
  flex-shrink: 0;
}

.accounting-edition-tabs-bar {
  background: #fff;
  padding-top: 0.35rem;
}

.accounting-edition-tabs {
  border-bottom: 0;
  gap: 0.15rem;
  flex-wrap: nowrap;
}

.accounting-edition-tabs .nav-item {
  margin-bottom: 0;
}

.accounting-edition-tabs .nav-link {
  border: 0;
  border-radius: 0.35rem 0.35rem 0 0;
  padding: 0.45rem 0.9rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
  background: transparent;
  white-space: nowrap;
}

.accounting-edition-tabs .nav-link:hover,
.accounting-edition-tabs .nav-link:focus {
  color: var(--primary-color, #6366f1);
  background: rgba(var(--primary-rgb), 0.06);
  border-color: transparent;
}

.accounting-edition-tabs .nav-link.active {
  color: var(--primary-color, #6366f1);
  background: #f8fafc;
  border-bottom: 2px solid var(--primary-color, #6366f1);
  font-weight: 600;
}

.accounting-edition-tabs .nav-link:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Filtres segmentés (écran lettrage — pas des onglets workspace) */
.accounting-segmented {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem;
  border-radius: 0.45rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  gap: 0.1rem;
}

.accounting-segmented__btn {
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  border-radius: 0.35rem;
  line-height: 1.3;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.accounting-segmented__btn:hover:not(:disabled) {
  color: #334155;
  background: rgba(255, 255, 255, 0.65);
}

.accounting-segmented__btn--active {
  background: #fff;
  color: var(--primary-color, #6366f1);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  font-weight: 600;
}

.accounting-segmented__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Tableau rapports comptables (balance, lettrage, interrogation…) */
.accounting-report-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid #cbd5e1;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

.accounting-report-table td,
.accounting-report-table tfoot td {
  font-size: 0.78rem;
  vertical-align: middle;
  border-color: #f1f5f9;
  padding: 0.28rem 0.55rem;
}

.accounting-report-table th:last-child,
.accounting-report-table td:last-child {
  padding-right: 1rem;
}

.accounting-report-table tbody tr:hover td {
  background: rgba(var(--primary-rgb), 0.04);
}

.accounting-report-table__amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 5rem;
}

.accounting-report-table__row--total td,
.accounting-report-table tfoot tr td {
  background: #f1f5f9;
  border-top: 2px solid #cbd5e1;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.accounting-report-table__row--selected td {
  background: rgba(var(--primary-rgb), 0.08);
}

.accounting-report-table__caption {
  caption-side: top;
  padding: 0;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.accounting-report-table__caption-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}

.accounting-report-scroll {
  max-height: calc(100vh - 16rem);
  overflow: auto;
}

.accounting-edition__result.accounting-edition__result--tabs {
  max-height: calc(100vh - 14rem);
}

@media print {
  .accounting-edition-header {
    display: none !important;
  }

  .accounting-edition__result {
    max-height: none;
  }
}

/* —— Liasse fiscale ISOC 275.1 —— */
.liasse-fiscale {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.liasse-fiscale__result {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.liasse-fiscale__summary {
  flex-shrink: 0;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.liasse-fiscale__summary-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.55rem 0.75rem;
  height: 100%;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.liasse-fiscale__summary-code {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--primary-color, #6366f1);
  letter-spacing: 0.04em;
}

.liasse-fiscale__summary-label {
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.25;
  margin: 0.2rem 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.liasse-fiscale__summary-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.liasse-fiscale__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.liasse-fiscale__scroll {
  overflow: auto;
  flex: 1;
  min-height: 0;
  padding-right: 0.15rem;
}

.liasse-fiscale__supplementary {
  flex-shrink: 0;
}

.tva-declaration__tabs {
  flex-shrink: 0;
}

.tva-declaration__nav-tabs {
  border-bottom: none;
  gap: 0.25rem;
}

.tva-declaration__nav-tabs .nav-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 0.35rem 0.35rem 0 0;
  padding: 0.45rem 0.85rem;
}

.tva-declaration__nav-tabs .nav-link:hover {
  color: #334155;
  background: rgba(255, 255, 255, 0.6);
}

.tva-declaration__nav-tabs .nav-link.active {
  color: #6366f1;
  background: #fff;
  border-color: var(--default-border);
}

.tva-declaration__tab-count {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.7;
  margin-left: 0.35rem;
}

.liasse-fiscale__table {
  --bs-table-hover-bg: rgba(var(--primary-rgb), 0.05);
  table-layout: fixed;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.liasse-fiscale__col-code {
  width: 5rem;
}

.liasse-fiscale__col-label {
  width: auto;
}

.liasse-fiscale__col-amount {
  width: 10.5rem;
}

.liasse-fiscale__caption {
  caption-side: top;
  padding: 0;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 4;
}

.liasse-fiscale__caption-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.55rem 0.85rem;
}

.liasse-fiscale__caption-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}

.liasse-fiscale__table thead th {
  position: sticky;
  top: 2.35rem;
  z-index: 3;
  background: #f8fafc;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  border-color: #e2e8f0;
  vertical-align: middle;
  padding: 0.45rem 0.65rem;
  border-bottom: 2px solid #cbd5e1;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.06);
}

.liasse-fiscale__col-amount-h {
  border-left: 1px solid #e8edf3;
}

.liasse-fiscale__sticky {
  position: sticky;
  z-index: 1;
  background: inherit;
}

.liasse-fiscale__sticky--code {
  left: 0;
  width: 5rem;
  min-width: 5rem;
  max-width: 5rem;
  font-size: 0.78rem;
  color: #64748b;
  z-index: 2;
  box-shadow: 2px 0 4px rgba(15, 23, 42, 0.04);
}

.liasse-fiscale__sticky--label {
  left: 5rem;
  min-width: 14rem;
  z-index: 2;
  box-shadow: 2px 0 4px rgba(15, 23, 42, 0.04);
}

.liasse-fiscale__head-row .liasse-fiscale__sticky {
  z-index: 4;
  background: #f8fafc;
}

.liasse-fiscale__table td {
  font-size: 0.8125rem;
  vertical-align: middle;
  border-color: #f1f5f9;
  padding: 0.28rem 0.65rem;
}

.liasse-fiscale__table td:last-child,
.liasse-fiscale__table th:last-child {
  padding-right: 1rem;
}

.liasse-fiscale__label-text {
  line-height: 1.35;
  color: #334155;
}

.liasse-fiscale__amount-cell {
  text-align: right;
  border-left: 1px solid #f1f5f9;
}

.liasse-fiscale__amount {
  display: block;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #334155;
  padding: 0.2rem 0.35rem;
}

.liasse-fiscale__amount--calculated {
  font-weight: 600;
  color: #1e293b;
}

.liasse-fiscale__amount-input {
  width: 100%;
  max-width: none;
  margin: 0;
  font-variant-numeric: tabular-nums;
  border-color: #e2e8f0;
  background: #fff;
  padding: 0.2rem 0.45rem;
  font-size: 0.8125rem;
}

.liasse-fiscale__amount-input:focus {
  border-color: var(--primary-color, #6366f1);
  box-shadow: 0 0 0 0.15rem rgba(var(--primary-rgb), 0.15);
}

.liasse-fiscale__row--section td {
  font-weight: 700;
  background: #f1f5f9 !important;
  color: #334155;
  border-top: 1px solid #e2e8f0;
}

.liasse-fiscale__row--section .liasse-fiscale__sticky {
  background: #f1f5f9;
}

.liasse-fiscale__row--subsection td {
  font-weight: 600;
  background: #f8fafc !important;
  color: #475569;
}

.liasse-fiscale__row--subsection .liasse-fiscale__sticky {
  background: #f8fafc;
}

.liasse-fiscale__row--calculated td {
  background: rgba(239, 246, 255, 0.65) !important;
}

.liasse-fiscale__row--calculated .liasse-fiscale__sticky {
  background: rgba(239, 246, 255, 0.65);
}

.liasse-fiscale__row--calculated .liasse-fiscale__amount-cell {
  background: rgba(238, 242, 255, 0.45);
}

.liasse-fiscale__table tbody tr:not(.liasse-fiscale__row--section):not(.liasse-fiscale__row--subsection):hover td {
  background: rgba(var(--primary-rgb), 0.04);
}

.liasse-fiscale__table tbody tr:not(.liasse-fiscale__row--section):not(.liasse-fiscale__row--subsection):hover .liasse-fiscale__sticky {
  background: rgba(var(--primary-rgb), 0.04);
}

@media print {
  .liasse-fiscale__result {
    max-height: none;
  }

  .liasse-fiscale__scroll {
    overflow: visible;
  }

  .liasse-fiscale__sticky {
    position: static;
    box-shadow: none;
  }
}

/* —— Toasts au-dessus du header fixe (Blazored.Toast z-index: 1 par défaut) —— */
body:has(.accounting-shell) .blazored-toast-container {
  z-index: 2000 !important;
}

body:has(.accounting-shell) .blazored-toast-container.position-top-right,
body:has(.accounting-shell) .blazored-toast-container.position-top-left,
body:has(.accounting-shell) .blazored-toast-container.position-top-center {
  top: calc(var(--accounting-header-height, 5rem) + 0.75rem) !important;
}

/* —— Onglets de travail —— */
.accounting-workspace-tab-host {
  position: relative;
}

.accounting-tab-pane--hidden {
  display: none !important;
}

.accounting-workspace-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem 0;
  background: #eef1f6;
  border-bottom: 1px solid var(--accounting-header-border, #e8ecf1);
  min-height: 2.35rem;
  position: sticky;
  top: var(--accounting-header-height, 5rem);
  z-index: 1600;
}

.accounting-workspace-tabs__scroll {
  display: flex;
  align-items: flex-end;
  gap: 0.2rem;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: thin;
}

.accounting-workspace-tabs__tab {
  display: inline-flex;
  align-items: center;
  max-width: 14rem;
  border: 1px solid #d5dbe5;
  border-bottom: none;
  border-radius: 0.4rem 0.4rem 0 0;
  background: #f8fafc;
  color: #475569;
  flex-shrink: 0;
}

.accounting-workspace-tabs__tab--active {
  background: #fff;
  color: #111827;
  border-color: #c5cedb;
  border-top: 2px solid #7c3aed;
  box-shadow: 0 -1px 0 #fff inset;
  position: relative;
  z-index: 1;
}

.accounting-workspace-tabs__tab--active .accounting-workspace-tabs__label {
  font-weight: 600;
}

.accounting-workspace-tabs__tab--dirty .accounting-workspace-tabs__label {
  font-style: italic;
}

.accounting-workspace-tabs__dirty-mark {
  color: #f59e0b;
  font-size: 0.55rem;
  margin-right: 0.25rem;
  vertical-align: middle;
}

.accounting-workspace-tabs__label {
  border: 0;
  background: transparent;
  padding: 0.4rem 0.55rem 0.4rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 11rem;
}

.accounting-workspace-tabs__close {
  border: 0;
  background: transparent;
  color: #94a3b8;
  padding: 0.2rem 0.45rem 0.2rem 0;
  line-height: 1;
  font-size: 1rem;
}

.accounting-workspace-tabs__close:hover {
  color: #ef4444;
}

.accounting-workspace-tabs__close-all {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  border: 1px solid #d5dbe5;
  border-radius: 0.35rem;
  background: #fff;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.55rem;
  line-height: 1.2;
  white-space: nowrap;
}

.accounting-workspace-tabs__close-all:hover {
  color: #ef4444;
  border-color: #fecaca;
  background: #fff5f5;
}

.accounting-workspace-tabs__close-all i {
  font-size: 1rem;
  line-height: 1;
}

.accounting-workspace-tabs__badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  background: #fff;
  border: 1px solid #d5dbe5;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  flex-shrink: 0;
}

/* Codes TVA — en-tête de colonnes qui restait visible en apparence mais défilait avec les lignes.
   La règle générique .accounting-bounded-list > .table-responsive (plus haut) ne matche pas ici :
   .table-responsive n'est pas un enfant DIRECT de .accounting-bounded-list dans cette page (il est
   niché sous .card > .card-body > .d-none.d-md-block), contrairement aux pages qui utilisent cette
   règle générique. Chaîne flex dédiée, sur le vrai chemin du DOM de cette page précise. */
.accounting-vat.accounting-bounded-list {
  display: flex;
  flex-direction: column;
}

.accounting-vat > .card {
  /* flex-shrink: 1 !important nécessaire : la règle générique
     .accounting-bounded-list > *:not(.card-body) (plus haut) cible aussi ce .card — ici enfant
     direct de .accounting-bounded-list au lieu de .card-body comme sur les autres pages bornées —
     et lui impose flex-shrink:0 avec une spécificité supérieure (3 classes vs 2 ici). Sans cet
     !important, .card ne se réduit jamais, prend toute la hauteur de son contenu (ex. 909 lignes
     TVA) et se fait simplement couper par overflow:hidden plus haut, sans aucune scrollbar. */
  flex: 1;
  flex-shrink: 1 !important;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.accounting-vat > .card > .card-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

/* display: flex conditionné aux mêmes seuils que .d-none/.d-md-block/.d-md-none de Bootstrap :
   une règle inconditionnelle écraserait leur display:none (spécificité plus forte ici) et
   afficherait tableau desktop + cartes mobile en même temps. */
@media (min-width: 768px) {
  .accounting-vat > .card > .card-body > .d-none.d-md-block {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
}

@media (max-width: 767.98px) {
  .accounting-vat > .card > .card-body > .d-md-none {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
}

.accounting-vat .table-responsive {
  /* Filet de securite independant de toute la chaine flex parente : sur cette page, la chaine
     .accounting-workspace/.accounting-main-content/.accounting-tab-pane ne se borne pas a 100vh
     comme attendu ailleurs (min-height:100vh reste sans effet - cause non identifiee, chaine
     flex/vh cassee quelque part au-dessus, confirme en direct via devtools) : flex:1/min-height:0
     n'ont donc rien a occuper et .table-responsive garde la hauteur de tout son contenu (ex.
     38000px pour 909 lignes), sans jamais declencher son propre scroll. max-height en vh est
     absolu (relatif a la fenetre, pas a un ancetre) : il fonctionne donc meme si la chaine flex
     parente est cassee. Valeur = 100vh moins l'espace fixe au-dessus (header 5rem/80px + onglets
     + en-tete de carte + recherche + marge) et en dessous (pied de pagination) de ce tableau. */
  flex: 1;
  min-height: 0;
  max-height: calc(100vh - 15rem);
  overflow-y: auto;
}

.accounting-vat > .card > .invoice-mailbox-footer {
  flex-shrink: 0;
}

.accounting-vat .table-responsive thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
}
