:root {
  --encre: #17211F;
  --papier: #F2F5F4;
  --sapin: #0F4C45;
  --sapin-fonce: #0A3631;
  --laiton: #C4952F;
  --entree: #1B7A50;
  --sortie: #B0362F;
  --ligne: #D8E0DD;
  --doux: #5A6763;
  --bs-body-font-family: 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
body { background: var(--papier); color: var(--encre); }
h1, .h1, h2, .h2, h3, .h3, h4, .h4 { font-weight: 700; letter-spacing: -0.01em; }

.num, .montant, .solde { font-variant-numeric: tabular-nums; }
td.num, th.num { text-align: right; white-space: nowrap; }
.entree { color: var(--entree) !important; }
.sortie { color: var(--sortie) !important; }

/* Barre de navigation */
.barre { background: var(--sapin); }
.barre .navbar-brand { font-weight: 700; display: flex; align-items: center; gap: .55rem; min-width: 0; max-width: calc(100% - 4rem); }
.marque { width: .8rem; height: .8rem; background: var(--laiton); transform: rotate(45deg); border-radius: 2px; display: inline-block; }
.barre .nav-link { color: rgba(255,255,255,.78); white-space: nowrap; }
.barre .nav-link:hover { color: #fff; }
.barre .nav-link.active { color: #fff; box-shadow: inset 0 -3px 0 var(--laiton); }
@media (max-width: 1199.98px) { .barre .nav-link.active { box-shadow: inset 3px 0 0 var(--laiton); padding-left: .6rem; } }

/* Boutons */
.btn-primary {
  --bs-btn-bg: var(--sapin); --bs-btn-border-color: var(--sapin);
  --bs-btn-hover-bg: var(--sapin-fonce); --bs-btn-hover-border-color: var(--sapin-fonce);
  --bs-btn-active-bg: var(--sapin-fonce); --bs-btn-active-border-color: var(--sapin-fonce);
  --bs-btn-disabled-bg: var(--sapin); --bs-btn-disabled-border-color: var(--sapin);
}
.btn-entree { --bs-btn-bg: var(--entree); --bs-btn-border-color: var(--entree); --bs-btn-color: #fff; --bs-btn-hover-bg: #146040; --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: #146040; }
.btn-sortie { --bs-btn-bg: var(--sortie); --bs-btn-border-color: var(--sortie); --bs-btn-color: #fff; --bs-btn-hover-bg: #8e2a24; --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: #8e2a24; }

/* Panneaux */
.panneau { background: #fff; border: 1px solid var(--ligne); border-radius: 10px; }
.panneau + .panneau { margin-top: 1.25rem; }
.panneau-tete { padding: .8rem 1rem; border-bottom: 1px solid var(--ligne); display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.panneau-tete h2 { font-size: 1rem; margin: 0; font-weight: 600; }
.panneau-corps { padding: 1rem; }

/* Cartes de solde par méthode : bande latérale à la couleur de l'opérateur */
.ticket { background: #fff; border: 1px solid var(--ligne); border-left: 6px solid var(--c, #6c757d); border-radius: 8px; padding: .8rem 1rem; color: inherit; text-decoration: none; display: block; }
a.ticket:hover { border-color: var(--c); color: inherit; }
.ticket .nom { font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.ticket .solde { font-size: 1.4rem; font-weight: 700; margin: .15rem 0 .45rem; }
.ticket dl { display: grid; grid-template-columns: auto 1fr; gap: .1rem .75rem; margin: 0; font-size: .82rem; color: var(--doux); }
.ticket dt { font-weight: 400; }
.ticket dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* Bandeau des totaux */
.bandeau { background: var(--sapin); color: #fff; border-radius: 10px; overflow: hidden; }
.bandeau > div { padding: .85rem 1.1rem; display: flex; flex-direction: column; gap: .15rem; min-width: 0; box-shadow: inset 0 1px 0 rgba(255,255,255,.14), inset 1px 0 0 rgba(255,255,255,.14); }
.bandeau span { font-size: .8rem; color: rgba(255,255,255,.72); }
.bandeau strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bandeau .bandeau-principal strong { font-size: 1.6rem; }
.bandeau .entree { color: #9EE2BF !important; }
.bandeau .sortie { color: #F7B3AD !important; }

/* Tableaux */
.table { --bs-table-bg: transparent; }
.table thead th { font-size: .8rem; font-weight: 600; color: var(--doux); background: #EEF2F0; border-bottom-color: var(--ligne); white-space: nowrap; }
.table tfoot td { border-top: 2px solid var(--encre); }
.table-ops tr.annulee td { opacity: .55; }
.table-ops tr.annulee td.num { text-decoration: line-through; }
.badge-entree { background: #E1F2E9; color: var(--entree); font-weight: 600; }
.badge-sortie { background: #F7E3E1; color: var(--sortie); font-weight: 600; }
.puce { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--c); margin-right: .4rem; vertical-align: .05em; }

/* Choix entrée / sortie */
.bascule { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.bascule a { border: 2px solid var(--ligne); border-radius: 8px; padding: .7rem; text-align: center; text-decoration: none; color: var(--doux); font-weight: 600; background: #fff; }
.bascule a.actif-entree { border-color: var(--entree); color: var(--entree); background: #F1FAF5; }
.bascule a.actif-sortie { border-color: var(--sortie); color: var(--sortie); background: #FCF3F2; }
.saisie-montant { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.dispo { font-size: .9rem; }

/* Connexion */
.connexion { min-height: 100vh; display: grid; place-items: center; background: var(--sapin); padding: 1rem; }
.connexion .carte { background: #fff; border-radius: 12px; padding: 2rem; width: min(390px, 100%); }
.connexion h1 { font-size: 1.35rem; }

/* Reçu */
.recu { max-width: 400px; margin: 0 auto; background: #fff; border: 1px dashed #97A39F; padding: 1.4rem; }
.recu .montant { font-size: 2rem; font-weight: 700; }
.recu dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 0; }
.recu dt { font-weight: 400; color: var(--doux); }
.recu dd { margin: 0; text-align: right; font-weight: 500; }

:focus-visible { outline: 3px solid var(--laiton); outline-offset: 2px; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; font-size: 12px; }
  main { padding: 0 !important; max-width: none !important; }
  .panneau { border: 0; }
  .panneau-tete { padding-left: 0; padding-right: 0; }
  .bandeau { background: #fff; color: #000; border: 1px solid #000; }
  .bandeau span { color: #333; }
  .bandeau .entree, .bandeau .sortie { color: #000 !important; }
  .recu { border: 0; }
  a { text-decoration: none; color: inherit; }
}


/* Billetage */
.billetage { border: 1px dashed var(--laiton); background: #FFFBF1; border-radius: 8px; padding: .75rem; margin-bottom: 1rem; }
.billetage-tete { font-weight: 600; margin-bottom: .5rem; }
.billetage-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .35rem .9rem; }
.coupure { display: grid; grid-template-columns: 5.2rem 1rem 4.2rem 1fr; align-items: center; gap: .3rem; margin: 0; }
.coupure-nom { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.coupure-x { color: var(--doux); text-align: center; }
.coupure-st { color: var(--doux); font-size: .85rem; text-align: right; font-variant-numeric: tabular-nums; }
.billetage-total { margin-top: .6rem; padding-top: .5rem; border-top: 1px solid #EADFC4; }
.billetage-total strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
input[readonly].saisie-montant { background: #F4F1E8; }
.coupure-groupe { grid-column: 1 / -1; font-size: .8rem; font-weight: 600; color: var(--doux); margin-top: .35rem; }
.releves { border: 1px dashed var(--ligne); background: #F7FAF9; border-radius: 8px; padding: .75rem; }
.billetage-lecture { background: #FFFDF6; }
.billetage-lecture .coupure { grid-template-columns: 6.5rem 1rem 3rem 1fr; }

/* Double authentification */
.connexion .carte-large { width: min(460px, 100%); }
.qr-activation { width: 220px; max-width: 100%; margin: .5rem auto 1rem; padding: .5rem; background: #fff; border: 1px solid var(--ligne); border-radius: 8px; }
.qr-activation svg { display: block; width: 100%; height: auto; }
.code-otp { font-size: 1.8rem; letter-spacing: .35em; font-variant-numeric: tabular-nums; }
.cle-secrete { display: block; font-size: 1rem; letter-spacing: .08em; padding: .5rem; background: #F2F5F4; border-radius: 6px; word-break: break-all; color: var(--encre); }
.bascule-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (min-width: 1200px) and (max-width: 1399.98px) { .barre .nav-link { padding-left: .45rem !important; padding-right: .45rem !important; font-size: .94rem; } }

/* Les libellés .visually-hidden (position absolue) des tableaux ne doivent pas élargir la page */
.table-responsive { position: relative; }
/* Les contenus longs ne doivent jamais forcer la largeur d'une colonne Bootstrap */
.row > * { min-width: 0; }
