/* DIS gestion : surcouche sobre de Bootstrap 5.3 (charte DIS #15589B). */

:root {
	--bs-primary: #15589b;
	--bs-primary-rgb: 21, 88, 155;
	--bs-link-color: #15589b;
	--bs-link-color-rgb: 21, 88, 155;
	--bs-link-hover-color: #0f4274;
	--bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--bs-body-bg: #f4f6f9;
	--bs-border-radius: .6rem;
	--app-carte: #ffffff;
}

.btn-primary {
	--bs-btn-bg: #15589b;
	--bs-btn-border-color: #15589b;
	--bs-btn-hover-bg: #0f4274;
	--bs-btn-hover-border-color: #0f4274;
	--bs-btn-active-bg: #0c365f;
	--bs-btn-active-border-color: #0c365f;
	--bs-btn-disabled-bg: #15589b;
	--bs-btn-disabled-border-color: #15589b;
}
.btn-outline-primary {
	--bs-btn-color: #15589b;
	--bs-btn-border-color: #15589b;
	--bs-btn-hover-bg: #15589b;
	--bs-btn-hover-border-color: #15589b;
	--bs-btn-active-bg: #0f4274;
	--bs-btn-active-border-color: #0f4274;
}
.text-bg-primary { background-color: #15589b !important; }
/* Champs de saisie et listes : fond blanc et liseré net (contraste 3,5:1 sur blanc), lisibles sur le fond gris comme sur les cartes. */
.form-control, .form-select { background-color: #ffffff; border-color: #7d8a9c; }
.input-group-text, .form-check-input { border-color: #7d8a9c; }
.form-check-input:checked { background-color: #15589b; border-color: #15589b; }
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: #eef1f5; }
.form-control:focus, .form-select:focus { border-color: #6f9fd0; box-shadow: 0 0 0 .2rem rgba(21, 88, 155, .2); }

body { min-height: 100vh; display: flex; flex-direction: column; }

/* Barre du haut : bleu nuit de la charte (#0C447C), texte blanc, logo version fond foncé (demande de Benjamin, 14/10). */
.app-barre { --bs-navbar-padding-y: .55rem; background-color: #0c447c; }
.app-marque { display: flex; align-items: center; gap: .75rem; margin-right: 1.5rem; padding: 0; }
.app-logo-barre { height: 42px; width: auto; display: block; }
.app-barre .navbar-nav { gap: .35rem; }
.app-barre .nav-link { color: #ffffff; font-weight: 500; padding-left: .85rem; padding-right: .85rem; border-radius: .45rem; }
.app-barre .nav-link:hover, .app-barre .nav-link:focus-visible, .app-barre .show > .nav-link { color: #ffffff; background-color: rgba(255, 255, 255, .12); }
.app-barre .nav-link.active { color: #ffffff; background-color: rgba(255, 255, 255, .16); }
.app-barre .nav-link .bi { opacity: .85; }
.app-barre-compte { color: rgba(255, 255, 255, .85); white-space: nowrap; }
.app-barre .nav-link, .app-barre .btn { white-space: nowrap; }
.app-barre .navbar-toggler { color: #ffffff; border-color: rgba(255, 255, 255, .45); }
.app-barre .offcanvas { background-color: #0c447c; color: #ffffff; }
.dropdown-item .bi, .nav-link .bi { opacity: .75; margin-right: .2rem; }
.app-logo-connexion { width: 234px; max-width: 100%; height: auto; }
@media (max-width: 575.98px) {
	.app-logo-barre { height: 34px; }
	.app-marque { margin-right: .5rem; gap: .5rem; }
}
/* Écran large mais pas très large (1200 à 1400 px) : six menus tiennent sur une ligne, Déconnexion en icône seule (libellé gardé en infobulle). */
@media (min-width: 1200px) and (max-width: 1399.98px) {
	.app-marque { margin-right: 1rem; }
	.app-barre .navbar-nav { gap: .1rem; }
	.app-barre .nav-link { padding-left: .55rem; padding-right: .55rem; }
	.app-barre .btn-libelle { display: none; }
}

/* Contenu */
.app-contenu { flex: 1; padding-top: 1.25rem; padding-bottom: 2rem; }
.app-pied { color: var(--bs-secondary-color); font-size: .8rem; padding-bottom: 1rem; }
.app-titre { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.app-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-left: auto; justify-content: flex-end; }

.card { --bs-card-bg: var(--app-carte); border-color: #dfe4ec; box-shadow: 0 1px 3px rgba(16, 24, 40, .07); }
.card-header { background: transparent; font-weight: 600; }

/* Boutons à icône : libellé masqué sur petit écran */
.btn .bi + .btn-libelle { margin-left: .35rem; }
@media (max-width: 767.98px) {
	.app-ligne-actions .btn-libelle { display: none; }
	.app-ligne-actions .btn .bi + .btn-libelle { margin-left: 0; }
}
.app-ligne-actions { display: flex; gap: .3rem; justify-content: flex-end; flex-wrap: nowrap; }

/* Tableaux */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .6rem .75rem; vertical-align: middle; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--bs-secondary-color); font-weight: 600; white-space: nowrap; }
/* Relief des lignes : une ligne sur deux teintée, survol plus marqué que la teinte (demande de Benjamin, 14/10). */
.table > tbody > tr:nth-of-type(even) > * { --bs-table-bg-type: #eef2f7; }
.table > tbody > tr:hover > * { --bs-table-bg-state: #dce7f4; }
.app-montant { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Ligne de vente détaillée : montants sur la 1re ligne, description dessous sur toute la largeur. */
.app-ligne-avec-detail > td { border-bottom-width: 0; }
.app-ligne-detail > td { padding-top: 0; }
.app-desc-espace { margin-top: .6rem; }
.app-desc-point { padding-left: 1.3em; text-indent: -1.3em; }
/* Bon d'intervention : un bloc par travail, lisible d'un coup d'œil. */
.app-travail { display: flex; gap: 1rem; align-items: flex-start; padding-top: .9rem; padding-bottom: .9rem; }
/* Bord gauche : la liste « flush » de Bootstrap le met à 0, d'où le sélecteur plus précis. */
.app-travaux > .app-travail { border-left: 4px solid transparent; }
.app-travaux > .app-travail:nth-child(even) { background-color: rgba(var(--bs-primary-rgb), .07); }
.app-travaux > .app-travail-fact-1 { border-left-color: var(--bs-primary); }
.app-travaux > .app-travail-fact-2 { border-left-color: var(--bs-secondary-border-subtle); }
.app-travail-date { flex: 0 0 6.5rem; display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; }
.app-travail-num { display: inline-flex; align-items: center; justify-content: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background-color: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); font-size: .8rem; font-weight: 600; }
.app-travail-corps { flex: 1 1 auto; min-width: 0; }
.app-travail-texte { margin-top: .35rem; padding-left: .75rem; border-left: 2px solid var(--bs-border-color); overflow-wrap: anywhere; }
@media (max-width: 575.98px) {
	.app-travail { flex-wrap: wrap; gap: .5rem; }
	.app-travail-date { flex-basis: 100%; flex-direction: row; align-items: center; }
}
/* Ligne ouverte par un vrai lien (ui_lien_ligne, 27/11) : le lien de la première cellule couvre toute la ligne,
   donc clic droit « nouvel onglet », clic molette et Cmd-clic marchent partout sur la ligne.
   Les boutons, champs et autres liens de la ligne passent au-dessus et gardent leur propre action. */
.app-ligne-lien { position: relative; }
.app-lien-ligne::after { content: ""; position: absolute; inset: 0; }
.app-lien-ligne:focus-visible { outline: none; }
.app-lien-ligne:focus-visible::after { outline: 2px solid var(--bs-primary); outline-offset: -2px; }
.app-ligne-lien a:not(.app-lien-ligne), .app-ligne-lien button, .app-ligne-lien form, .app-ligne-lien input, .app-ligne-lien select, .app-ligne-lien label { position: relative; z-index: 1; }

/* Filtres */
.app-filtres { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
/* Type de document (devis et factures) : boutons à la suite, qui passent à la ligne sur téléphone. */
.app-types-document { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .75rem; }
.app-filtres .form-control, .app-filtres .form-select { width: auto; min-width: 10rem; }
@media (max-width: 575.98px) {
	.app-filtres .form-control, .app-filtres .form-select { width: 100%; }
}

/* Tuiles du tableau de bord */
.app-tuile { color: inherit; transition: border-color .15s; }
a.app-tuile:hover { border-color: #15589b; }
.app-tuile-libelle { font-size: .82rem; color: var(--bs-secondary-color); margin-bottom: .35rem; }
.app-tuile-valeur { font-size: 1.45rem; font-weight: 650; font-variant-numeric: tabular-nums; }

.app-raccourcis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.app-raccourci {
	display: flex; flex-direction: column; align-items: flex-start; gap: .4rem;
	background: var(--app-carte); border: 1px solid #e3e7ee; border-radius: .6rem;
	padding: .8rem .9rem; color: inherit; text-decoration: none; font-size: .9rem;
}
.app-raccourci:hover { border-color: #15589b; }

/* Fiches */
.app-fiche dt { font-weight: 500; color: var(--bs-secondary-color); font-size: .85rem; }
.app-fiche dd { margin-bottom: .7rem; }

.app-vide { text-align: center; color: var(--bs-secondary-color); padding: 2.5rem 1rem; }

/* Connexion */
.app-connexion { max-width: 400px; margin: 8vh auto 0; }

/* Graphiques SVG */
.app-graphe { width: 100%; height: auto; }
.app-graphe text { font: 14px system-ui, sans-serif; fill: #5b6574; }
.app-graphe-classement { max-width: 760px; }

@media print {
	.app-barre, .app-actions, .app-ligne-actions, .app-filtres, .app-types-document, .app-pied { display: none !important; }
	body { background: #fff; }
}
.card-header .form-select { width: auto; }

/* Icônes (sprite SVG) */
.bi { width: 1em; height: 1em; display: inline-block; vertical-align: -.125em; fill: currentColor; flex-shrink: 0; }
.app-raccourci .bi { width: 1.3rem; height: 1.3rem; color: #15589b; }
.app-vide > .bi { width: 2rem; height: 2rem; display: block; margin: 0 auto .5rem; }
.navbar-toggler .bi { width: 1.4rem; height: 1.4rem; }
.app-quantite { width: 4.5rem; }
.app-recherche-prospect { margin-bottom: 1rem; }
.app-recherche-prospect .form-control { font-size: 1.05rem; padding: .6rem .9rem; }

/* Menu « Documents » : intertitres sur deux colonnes en grand écran (le menu compte une vingtaine de liens). */
.app-barre .dropdown-header { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #5b6b7d; padding-top: .6rem; }
@media (min-width: 1200px) {
	.app-menu-colonnes.show { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); grid-auto-flow: column; grid-template-rows: repeat(12, auto); column-gap: .5rem; }
}
/* Déconnexion : le petit bonhomme à côté du prénom (infobulle « Logout »). */
.app-logout { color: #ffffff; border: 0; padding: .15rem .35rem; font-size: 1.35rem; line-height: 1; border-radius: .45rem; }
.app-logout:hover, .app-logout:focus-visible { color: #ffffff; background-color: rgba(255, 255, 255, .16); }
.app-logout .btn-libelle { display: none; }

/* Saisie d'une pièce déposée : bloc achat ou bloc charge selon le classement choisi, sans script. */
.app-saisie-piece:has(#classement_charge:checked) .app-bloc-achat { display: none; }
.app-saisie-piece:not(:has(#classement_charge:checked)) .app-bloc-charge { display: none; }
.app-champ-court { min-width: 5.5rem; }
