/*
 * Charte TCS appliquée au thème Sneat (Bootstrap 5).
 * Sneat lit --bs-primary : on le remplace, les variantes (survol, actif) sont calculées par le thème.
 * À charger APRÈS vendor/css/core.css.
 * Le vert du logo (#028A02) offre 4,5:1 avec du texte blanc : il sert directement aux boutons et liens.
 */
:root {
  --tcs-logo: #028a02;
  --tcs-primary: #028a02;
  --tcs-primary-dark: #016601;
  --tcs-tint: #e6f4e6;

  --bs-primary: var(--tcs-primary);
  --bs-primary-rgb: 2, 138, 2;
  --bs-primary-contrast: #fff;
  --bs-primary-text-emphasis: var(--tcs-primary-dark);
  --bs-primary-bg-subtle: var(--tcs-tint);
  --bs-primary-border-subtle: #b3dbb3;
  --bs-link-color: var(--tcs-primary);
  --bs-link-color-rgb: 2, 138, 2;
  --bs-link-hover-color: var(--tcs-primary-dark);
  --bs-link-hover-color-rgb: 1, 102, 1;
}

.btn-primary {
  --bs-btn-bg: var(--tcs-primary);
  --bs-btn-border-color: var(--tcs-primary);
  --bs-btn-hover-bg: var(--tcs-primary-dark);
  --bs-btn-hover-border-color: var(--tcs-primary-dark);
  --bs-btn-active-bg: var(--tcs-primary-dark);
  --bs-btn-active-border-color: var(--tcs-primary-dark);
  --bs-btn-disabled-bg: var(--tcs-primary);
  --bs-btn-disabled-border-color: var(--tcs-primary);
}

.form-check-input:checked,
.form-switch .form-check-input:checked {
  background-color: var(--tcs-primary);
  border-color: var(--tcs-primary);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--tcs-primary);
  box-shadow: 0 0 0 0.2rem rgba(2, 138, 2, 0.15);
}

/* Logo dans la barre latérale */
.app-brand-logo img,
.tcs-logo {
  height: 40px;
  width: auto;
  display: block;
}

/*
 * Lisibilité des messages et des étiquettes d'état.
 * Le thème écrit les textes d'alerte et d'étiquette dans la couleur vive de l'état (contraste de 1,6:1
 * pour le vert sur fond pâle) : on les remplace par des teintes foncées (6:1 et plus).
 */
.alert-success, .alert-success .alert-heading { --bs-alert-color: #1b5e10; --bs-alert-link-color: #1b5e10; color: #1b5e10; }
.alert-warning, .alert-warning .alert-heading { --bs-alert-color: #7a4f00; --bs-alert-link-color: #7a4f00; color: #7a4f00; }
.alert-danger,  .alert-danger  .alert-heading { --bs-alert-color: #a3200b; --bs-alert-link-color: #a3200b; color: #a3200b; }
.alert-info,    .alert-info    .alert-heading { --bs-alert-color: #0b5e73; --bs-alert-link-color: #0b5e73; color: #0b5e73; }

.bg-label-success   { color: #1b5e10 !important; }
.bg-label-warning   { color: #7a4f00 !important; }
.bg-label-danger    { color: #a3200b !important; }
.bg-label-info      { color: #0b5e73 !important; }
.bg-label-secondary { color: #4a5568 !important; }
.bg-label-primary   { color: var(--tcs-primary-dark) !important; }
.text-danger { color: #a3200b !important; }

/* Boutons gris (secondaires) : texte foncé, le gris du thème est trop clair sur son fond (2,7:1). */
.btn-label-secondary { --bs-btn-color: #4a5568; --bs-btn-hover-color: #2d3748; --bs-btn-active-color: #2d3748; color: #4a5568; }
.btn-label-secondary:hover, .btn-label-secondary:focus { color: #2d3748; }
.text-body-secondary { color: #5b6677 !important; }

/* Remplacent des styles écrits dans les pages (mêmes valeurs qu'avant) */
.tcs-logo-auth {
  height: 44px;
  width: auto;
}

.tcs-ref-spaced {
  letter-spacing: 2px;
}

.tcs-phone-code {
  max-width: 11rem;
}

.tcs-no-upper {
  text-transform: none;
}

/* Colonne d'actions des tableaux : largeur du contenu */
th.cell-fit {
  width: 1%;
  white-space: nowrap;
}

/* Cellules de tableaux : textes longs coupés, largeurs minimales (remplacent les style="" en ligne) */
.tcs-cell-truncate {
  max-width: 20rem;
}

.tcs-cell-truncate-lg {
  max-width: 22.5rem;
}

.tcs-cell-min {
  min-width: 10rem;
}

.tcs-cell-min-lg {
  min-width: 16rem;
}

/* Textes saisis : retours à la ligne conservés (remplacent white-space en ligne) */
.tcs-pre-wrap {
  white-space: pre-wrap;
}

.tcs-pre-line {
  white-space: pre-line;
}

/* Barre de progression épaisse (envoi de fichier) */
.tcs-progress-lg {
  height: 10px;
}

/* Médiathèque du site : aperçu d'un emplacement d'image */
.tcs-media-preview {
  min-height: 8rem;
}

.tcs-media-image {
  max-height: 11rem;
}

/*
 * Contrastes WCAG AA (4,5:1 et plus) : le thème écrit le vert, l'orange, le gris et le bleu vifs en texte ou en fond de bouton
 * (1,7:1 à 3,1:1). Teintes assombries, #028A02 reste la couleur principale.
 */
.text-success { color: #1b5e10 !important; }
.text-warning { color: #7a4f00 !important; }
.text-info { color: #0b5e73 !important; }
.text-secondary { color: #4a5568 !important; }
.btn-label-primary { --bs-btn-color: var(--tcs-primary-dark); color: var(--tcs-primary-dark); }
.btn-label-success { --bs-btn-color: #1b5e10; color: #1b5e10; }
.btn-label-warning { --bs-btn-color: #7a4f00; color: #7a4f00; }
.btn-label-info { --bs-btn-color: #0b5e73; color: #0b5e73; }
.btn-label-danger { --bs-btn-color: #a3200b; color: #a3200b; }
.btn-label-primary:hover, .btn-label-success:hover, .btn-label-warning:hover, .btn-label-info:hover, .btn-label-danger:hover { color: #fff; }
.btn-success { --bs-btn-bg: #2e7d12; --bs-btn-border-color: #2e7d12; --bs-btn-hover-bg: #236010; --bs-btn-hover-border-color: #236010; --bs-btn-active-bg: #236010; --bs-btn-active-border-color: #236010; --bs-btn-disabled-bg: #2e7d12; --bs-btn-disabled-border-color: #2e7d12; }
.btn-warning { --bs-btn-color: #2b1a00; --bs-btn-hover-color: #2b1a00; --bs-btn-active-color: #2b1a00; --bs-btn-disabled-color: #2b1a00; color: #2b1a00; }
.btn-info { --bs-btn-bg: #0b6f8a; --bs-btn-border-color: #0b6f8a; --bs-btn-hover-bg: #085a71; --bs-btn-hover-border-color: #085a71; --bs-btn-active-bg: #085a71; --bs-btn-active-border-color: #085a71; --bs-btn-disabled-bg: #0b6f8a; --bs-btn-disabled-border-color: #0b6f8a; }
.btn-secondary { --bs-btn-bg: #5b6677; --bs-btn-border-color: #5b6677; --bs-btn-hover-bg: #485160; --bs-btn-hover-border-color: #485160; --bs-btn-active-bg: #485160; --bs-btn-active-border-color: #485160; --bs-btn-disabled-bg: #5b6677; --bs-btn-disabled-border-color: #5b6677; }
.badge.bg-success, .badge.bg-warning, .badge.bg-info { color: #fff; }
.badge.bg-success { background-color: #2e7d12 !important; }
.badge.bg-info { background-color: #0b6f8a !important; }
.badge.bg-warning { background-color: #ffab00 !important; color: #2b1a00; }


/* En-tête du centre d'aide : dégradé vert de la charte à la place de l'image violette du thème */
.tcs-faq-header { background: linear-gradient(135deg, #e6f4e6 0%, #b3dbb3 100%); border-radius: 0.5rem; }

/*
 * Affichage : correctifs de la recette visuelle (20 nov. 2026).
 */

/* Majuscule à chaque mot : le thème l'impose aux onglets (text-transform: capitalize), ce qui défigure les libellés français
   (« Identité Vérifiée », « Délais Et Conservation »). Les phrases s'affichent comme elles sont écrites. */
.nav-tabs .nav-link,
.nav-pills .nav-link {
  text-transform: none;
}

/* Onglets : retour à la ligne plutôt qu'un débordement hors de l'écran (téléphone). */
.nav-tabs,
.nav-pills:not(.flex-column) {
  flex-wrap: wrap;
}
.nav-pills:not(.flex-column) .nav-link {
  white-space: normal;
}

/* Une pastille ne se déforme jamais dans une ligne flexible. */
.avatar,
.avatar-initial {
  flex-shrink: 0;
}

/* Boutons « label » : texte foncé (vert pâle sur vert pâle = 1,6:1). */
.btn-label-success { --bs-btn-color: #1b5e10; color: #1b5e10; }
.btn-label-primary { --bs-btn-color: var(--tcs-primary-dark); color: var(--tcs-primary-dark); }
.btn-label-danger { --bs-btn-color: #a3200b; color: #a3200b; }
.btn-label-warning { --bs-btn-color: #7a4f00; color: #7a4f00; }
.btn-label-info { --bs-btn-color: #0b5e73; color: #0b5e73; }
.btn-label-success:hover, .btn-label-success:focus { color: #fff; }
.btn-label-primary:hover, .btn-label-primary:focus { color: #fff; }
.btn-label-danger:hover, .btn-label-danger:focus { color: #fff; }
.btn-label-warning:hover, .btn-label-warning:focus { color: #fff; }
.btn-label-info:hover, .btn-label-info:focus { color: #fff; }

/* En-tête de carte avec titre + texte à droite : le texte passe dessous quand la place manque. */
.card-header.d-flex.justify-content-between {
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
}

/* Menu latéral : les libellés longs passent à la ligne au lieu d'être coupés par « … ». */
.layout-menu.menu-vertical .menu-item .menu-link > div:not(.badge) {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.3;
}
.layout-menu .menu-link {
  align-items: flex-start;
}
.layout-menu .menu-link .menu-icon {
  margin-top: 0.1rem;
}

/* Tableaux : message « aucune ligne » lisible (pas de défilement pour une seule cellule fusionnée). */
.table-responsive table:has(tbody > tr:only-child > td[colspan]) th {
  white-space: normal;
}
.table-responsive table:has(tbody > tr:only-child > td[colspan]) td[colspan] {
  white-space: normal;
  min-width: 12rem;
}

/* Pied de page des espaces connectés */
.footer-container .footer-link {
  display: inline-block;
}

/* Barre d'outils des tableaux (DataTables) sur téléphone : recherche pleine largeur, boutons lisibles. */
@media (max-width: 767.98px) {
  div.dt-container div.dt-layout-row {
    gap: 0.75rem;
  }
  div.dt-container div.dt-search {
    width: 100%;
    margin: 0;
  }
  div.dt-container div.dt-search input {
    width: 100% !important;
    margin-left: 0 !important;
  }
  div.dt-container div.dt-buttons,
  div.dt-container div.dt-length {
    margin: 0;
  }
  div.dt-container div.dt-buttons > .btn-primary {
    width: 100%;
  }
  .badge.tcs-badge-wrap {
    white-space: normal;
    text-align: start;
  }
}

/* Cartes de totaux : sur téléphone les cartes sont empilées, le trait vertical de séparation n'a plus lieu d'être. */
@media (max-width: 575.98px) {
  .card-widget-separator .border-end {
    border-inline-end: 0 !important;
  }
  .card-widget-separator .col-sm-6 + .col-sm-6 {
    border-top: 1px solid var(--bs-border-color);
    padding-top: 1rem;
  }
}

/* Reçus à imprimer, affichés à l'écran sur téléphone : le thème impose 768 px de large (pour l'impression),
   ici l'écran s'adapte ; l'impression garde la mise en page du thème. */
@media screen and (max-width: 767.98px) {
  .invoice-print {
    min-inline-size: 0 !important;
    padding: 1rem !important;
    overflow-wrap: anywhere;
  }
  .invoice-print .d-flex.flex-row,
  .invoice-print .row.d-flex {
    flex-wrap: wrap;
    gap: 1rem;
  }
  .invoice-print .w-50 {
    width: 100% !important;
  }
  .invoice-print img,
  .invoice-print table {
    max-width: 100%;
  }
}

/* Reçu à l'écran (téléphone) : totaux sous la note, jamais comprimés dans une colonne étroite. */
@media (max-width: 575.98px) {
  .tcs-invoice-totals tr {
    display: flex;
    flex-wrap: wrap;
  }
  .tcs-invoice-totals td:first-child {
    flex: 0 0 100%;
    padding-inline-end: 0 !important;
    padding-block: 1rem 0.5rem !important;
  }
  .tcs-invoice-totals td:not(:first-child) {
    flex: 1 1 auto;
    width: auto !important;
    padding-block: 0.5rem 1rem !important;
  }
}

/* Reçus à l'écran (téléphone) : en-têtes et cellules plus serrés pour que la colonne « Montant » reste visible. */
@media screen and (max-width: 575.98px) {
  .invoice-preview-card .table.m-0:not(.table-borderless) th,
  .invoice-print .table.m-0:not(.table-borderless) th {
    white-space: normal;
  }
  .invoice-preview-card .table.m-0:not(.table-borderless) > :not(caption) > * > *,
  .invoice-print .table.m-0:not(.table-borderless) > :not(caption) > * > * {
    padding-inline: 0.5rem;
  }
  .invoice-preview-card {
    padding: 1rem !important;
  }
  .invoice-preview-card .invoice-preview-header {
    padding: 1rem;
  }
}
@media screen and (max-width: 575.98px) {
  .invoice-preview-card .table.m-0:not(.table-borderless) th,
  .invoice-print .table.m-0:not(.table-borderless) th {
    font-size: 0.7rem;
    letter-spacing: 0.2px;
  }
  .invoice-preview-card .table.m-0:not(.table-borderless) th.text-nowrap,
  .invoice-preview-card .table.m-0:not(.table-borderless) td.text-nowrap {
    white-space: normal !important;
  }
}
