/* Translead Export : impression depuis l'écran (charte AGL, documents sur fond blanc).
   Toujours imprimé en thème clair : fond blanc, textes noirs, titres marine, accent bleu, tableaux à en-tête marine,
   aucun or, logo bleu. KnI.imprimer (js/06-impression.js) ajoute l'en-tête et le pied AGL ; Ctrl+P aussi (beforeprint). */

/* Bloc d'en-tête / pied ajouté pour l'impression : invisible à l'écran. */
.kni-entete, .kni-pied { display: none; }

@page { size: A4 portrait; margin: 14mm 12mm 18mm 12mm;
  @bottom-right { content: "Page " counter(page) " / " counter(pages); font: 8.5px Arial, Helvetica, sans-serif; color: #000; }
  @bottom-left { font: 8.5px Arial, Helvetica, sans-serif; color: #000; }
  @top-right { font: 8.5px Arial, Helvetica, sans-serif; color: #0a2240; } }
@page paysage { size: A4 landscape; }

@media print {
  /* Thème clair forcé, même si l'écran est en sombre (jetons de app.css et de tableaux.css). */
  :root, :root[data-theme="light"], :root[data-theme="dark"] {
    --bg: #ffffff; --panel: #ffffff; --panel2: #f7fafd; --line: #dde5ef; --chip: #e7edf4; --hl: #e2ecf7;
    --ink: #000000; --mut: #1a1a1a; --acc: #14467c; --acc-ink: #ffffff; --btn: #0a2240; --btn-ink: #ffffff;
    --th: #0a2240; --th-ink: #ffffff; --ok: #146314; --warn: #8a5f00; --bad: #a3121f; --info: #14467c;
    --ok-bg: #e6f3e6; --warn-bg: #fff4d6; --bad-bg: #fde8ea; --info-bg: #e2ecf7; --marque: #14467c;
    --c-kko: #8a4b1c; --c-deri: #e07a2e; --c-evea: #1f7a45; --c-coto: #4f8fd6; --c-cafe: #8e3a6c;
    --c-boid: #9a8a1e; --c-divs: #00839c; --c-logt: #5b45b8; --c-kjou: #d2668f;
    --s-1: #2a78d6; --s-2: #eb6834; --s-3: #1baf7a; --s-4: #eda100; --s-5: #e87ba4; --s-6: #008300; --s-7: #6250d6; --s-8: #e34948;
    --k-grille: #dde5ef; --k-axe: #1a1a1a; --k-bulle: #0a2240; --k-bulle-ink: #ffffff; --k-chaleur: #14467c;
    --shadow: none;
    color-scheme: light;
  }
  html, body { background: #fff !important; color: #000 !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { font: 11.5px/1.45 Arial, Helvetica, sans-serif; }
  html.kni-paysage body { page: paysage; }

  /* Masqués : navigation, filtres, boutons, notifications, commandes. */
  .entete, .menu, #kn-menu, .toasts, .btn, button, .tbl .barre, .pagination, .filtres, .filtre, .tb-filtres,
  .maj-auto, .kg-legende, .recherche, .onglets, .voile, .modale, .noprint, .kni-masque,
  input[type="search"], select { display: none !important; }
  .coquille { display: block !important; }
  .zone, #kn-zone { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .carte, .tbl, .kpi, .verre { box-shadow: none !important; background: #fff !important; backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important; border-color: #dde5ef !important; }
  .carte, .kpi, figure, svg { break-inside: avoid; }
  h1, h2, h3, .surtitre { color: #0a2240 !important; break-after: avoid; }
  .liser { background: #14467c !important; }
  a { color: #000 !important; text-decoration: none; }
  * { animation: none !important; transition: none !important; }

  /* Tableaux : en-tête marine texte blanc, répété sur chaque page ; lignes non coupées ; chiffres à droite. */
  table { border-collapse: collapse; width: 100%; page-break-inside: auto; }
  thead { display: table-header-group; } tfoot { display: table-footer-group; }
  tr { break-inside: avoid; page-break-inside: avoid; }
  th { background: #0a2240 !important; color: #fff !important; }
  td { color: #000 !important; border-color: #b8c6d6; }
  td.n, td.num, th.n, th.num, td.nombre, td.montant { text-align: right !important; }

  /* En-tête AGL (logo bleu) et pied de traçabilité ajoutés par KnI.imprimer. */
  .kni-entete { display: flex !important; align-items: flex-start; gap: 16px; padding-bottom: 8px;
    border-bottom: 3px solid #14467c; margin-bottom: 14px; }
  .kni-entete img { height: 38px; width: auto; flex: none; }
  .kni-entete .kni-rs { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: #0a2240; }
  .kni-entete .kni-titre { font-size: 19px; font-weight: 700; color: #0a2240; margin-top: 2px; }
  .kni-entete .kni-refs { margin-left: auto; text-align: right; font-size: 10.5px; color: #000; white-space: nowrap; }
  .kni-pied { display: flex !important; flex-wrap: wrap; gap: 4px 18px; margin-top: 18px; padding-top: 6px;
    border-top: 2px solid #0a2240; font-size: 9.5px; color: #000; }
  .kni-pied b { color: #0a2240; }
  .kni-pied .kni-pagination { display: none; }
}
