/* =====================================================================
   Écran du GU : présence par usine, journal, QR codes. Mobile d'abord,
   colonnes au-delà de 900 px. Feuilles imprimables en fin de fichier.
   ===================================================================== */
.hd-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hd-user { display: flex; align-items: center; gap: 8px; color: #c8cfd9; font-size: 14px; }
.hd-btn { background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.18); border-radius: var(--r-2);
          min-height: 40px; padding: 0 12px; cursor: pointer; font-size: 14px; font-weight: 600; }
.hd-btn:hover { background: rgba(255,255,255,.15); }
.hd-btn:focus-visible { outline: 3px solid #ff861d; outline-offset: 2px; }

.tabs { display: flex; gap: 4px; margin-top: 18px; overflow-x: auto; }
.tab { background: transparent; border: 0; color: #aab2bf; padding: 10px 14px; border-radius: var(--r-2) var(--r-2) 0 0;
       font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap; min-height: 44px; }
.tab[aria-selected="true"] { background: var(--gray-50); color: var(--gray-900); }
.tab:focus-visible { outline: 3px solid #ff861d; outline-offset: -3px; }
.hd.with-tabs { padding-bottom: 0; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 18px 16px calc(32px + env(safe-area-inset-bottom)); }
.bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.bar .grow { flex: 1; }

/* Tuiles de comptage */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--gray-75); border: 1px solid var(--gray-300); border-radius: var(--r-3); padding: 12px 14px;
        display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow-1); }
.tile-v { font-family: var(--mono); font-size: 28px; font-weight: 600; line-height: 1.1; }
.tile-l { font-size: 13px; color: var(--gray-700); }
.tile.big { background: var(--gray-900); color: #fff; border-color: var(--gray-900); }
.tile.big .tile-l { color: #c8cfd9; }
.tile.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.tile.warn .tile-v, .tile.warn .tile-l { color: var(--warn-fg); }

/* Listes de présents par usine */
.groups { display: grid; gap: 12px; }
@media (min-width: 900px) { .groups { grid-template-columns: 1fr 1fr; } .groups .full { grid-column: 1 / -1; } }
.grp { background: var(--gray-75); border: 1px solid var(--gray-300); border-radius: var(--r-3); box-shadow: var(--shadow-1); overflow: hidden; }
.grp.warn { border-color: var(--warn-line); }
.grp-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 12px 16px;
         border-bottom: 1px solid var(--gray-300); }
.grp-h h3 { margin: 0; font-size: 16px; }
.grp-n { font-family: var(--mono); font-weight: 600; color: var(--gray-700); }
.grp-note { padding: 10px 16px; font-size: 13.5px; background: var(--warn-bg); color: var(--warn-fg); }
.grp-vide { padding: 14px 16px; color: var(--gray-600); font-size: 14px; }

.row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--gray-200); }
.row:first-of-type { border-top: 0; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-t { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-s { color: var(--gray-700); font-size: 13px; }
.row a.tel { color: var(--entree); font-family: var(--mono); font-size: 13px; text-decoration: none; white-space: nowrap;
             min-height: 36px; display: inline-flex; align-items: center; }
.row.annule .row-t { text-decoration: line-through; color: var(--gray-600); }
.ev-h { font-family: var(--mono); font-weight: 600; font-size: 14px; width: 46px; flex: none; }

/* Journal */
.jnav { display: flex; align-items: center; gap: 6px; }
.jnav .lbl-j { font-weight: 600; min-width: 150px; text-align: center; }
.navbtn { width: 44px; height: 44px; border-radius: var(--r-2); border: 1px solid var(--gray-400); background: var(--gray-75);
          font-size: 20px; cursor: pointer; color: var(--gray-900); }
.navbtn:disabled { opacity: .4; cursor: default; }
select.sel, input.sel { height: 44px; border: 1px solid var(--gray-400); border-radius: var(--r-2); padding: 0 10px;
                        background: var(--gray-75); color: var(--gray-900); font-size: 15px; }

/* QR codes */
.qr-grid { display: grid; gap: 12px; }
@media (min-width: 900px) { .qr-grid { grid-template-columns: 1fr 1fr; } }
.qr-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px 16px; }
.qr-cell { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.qr-cell .qr { width: 100%; max-width: 160px; aspect-ratio: 1; padding: 8px; border: 1px solid var(--gray-300); border-radius: var(--r-2); background: #fff; }
.qr-cell .qr svg { width: 100%; height: 100%; display: block; }
.qr-cell a { color: var(--entree); font-size: 13.5px; font-weight: 600; min-height: 32px; display: inline-flex; align-items: center; }

/* Fenêtres */
dialog { border: 0; border-radius: var(--r-3); padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(16,21,27,.3); }
dialog::backdrop { background: rgba(16, 21, 27, .45); }
.dlg-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 16px 18px 0; }
.dlg-h h2 { margin: 0; }
.dlg-b { padding: 6px 18px 18px; }
.x { width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; border-radius: var(--r-2); color: var(--gray-700); }
.x:hover { background: var(--gray-100); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--gray-100);
       border: 1px solid var(--gray-300); border-radius: var(--r-2); padding: 3px; }
.seg.cols2 { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
.seg button { min-height: 40px; border: 0; background: transparent; border-radius: var(--r-1); cursor: pointer; font-weight: 600;
              font-size: 14px; color: var(--gray-800); }
.seg button[aria-pressed="true"] { background: var(--gray-75); box-shadow: var(--shadow-1); color: var(--gray-900); }
.seg button[aria-pressed="true"].entree { background: var(--entree); color: #fff; }
.seg button[aria-pressed="true"].sortie { background: var(--sortie); color: #fff; }

#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
         background: var(--gray-900); color: #fff; padding: 12px 16px; border-radius: var(--r-2); font-size: 14.5px;
         box-shadow: var(--shadow-2); max-width: calc(100vw - 32px); opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.on { opacity: 1; }
#toast.err { background: var(--neg); }

.login { max-width: 420px; margin: 0 auto; padding: 24px 16px; }

/* ================================================================ Impression */
#print { display: none; }
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  #app, dialog, #toast { display: none !important; }
  #print { display: block; }
  #print.liste { padding: 14mm 14mm; font-size: 10.5pt; color: #000; }
}
#print.liste h1 { font-size: 16pt; margin: 0 0 2mm; }
#print.liste .ph { font-size: 10pt; color: #333; margin-bottom: 4mm; }
#print.liste h2 { font-size: 12pt; margin: 6mm 0 2mm; }
#print.liste table { width: 100%; border-collapse: collapse; }
#print.liste th, #print.liste td { border: 1px solid #555; padding: 1.6mm 2mm; text-align: left; vertical-align: top; }
#print.liste th { background: #eee; }
#print.liste .sign { margin-top: 10mm; }

/* Affiches de porte — reprennent les affiches A4 du téléphérique (794 × 1123 px = A4). */
.aff { width: 210mm; height: 297mm; box-sizing: border-box; padding: 52px 56px 48px; background: #fff; color: #10151b;
       font-family: var(--font); display: flex; flex-direction: column; gap: 26px; overflow: hidden;
       break-after: page; page-break-after: always; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.aff:last-child { break-after: auto; page-break-after: auto; }
.aff-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1.5px solid #cfd5dd; padding-bottom: 16px;
           font-family: var(--mono); font-weight: 600; font-size: 13px; letter-spacing: .08em; }
.aff-top .b { display: flex; align-items: center; gap: 12px; }
.aff-top .c { color: #5b6472; letter-spacing: .06em; }
.aff-t { display: flex; align-items: center; gap: 20px; }
.aff-badge { font-family: var(--mono); font-weight: 600; font-size: 30px; line-height: 1; padding: 10px 14px; border: 3px solid #10151b; border-radius: 12px; }
.aff-t h1 { margin: 0; font-size: 60px; line-height: 1; font-weight: 700; letter-spacing: -.01em; }
.aff-sites { display: flex; align-items: center; gap: 10px; font-size: 15px; color: #5b6472; margin-top: 18px; }
.aff-sites .dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #9aa3af; flex: none; }
.aff-sites .on { color: #10151b; font-weight: 700; }
.aff-sites .on.dot { background: #10151b; border-color: #10151b; }
.aff-sites .ln { flex: 1; height: 2px; background: #cfd5dd; min-width: 10px; }
.aff-band { color: #fff; border-radius: 22px; padding: 26px 34px; display: flex; align-items: center; gap: 26px; }
.aff-band.entree { background: #0d66d0; }
.aff-band.sortie { background: #1f7a5c; }
.aff-band svg { width: 78px; height: 78px; flex: none; }
.aff-band .v { display: block; font-size: 76px; font-weight: 700; line-height: .95; letter-spacing: .01em; }
.aff-band .s { display: block; font-size: 21px; font-weight: 500; margin-top: 6px; }
.aff-qr { align-self: center; width: 430px; height: 430px; box-sizing: border-box; padding: 34px; border: 2px solid #cfd5dd; border-radius: 20px; }
.aff-qr svg { width: 100%; height: 100%; display: block; }
.aff-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.aff-steps div { display: flex; flex-direction: column; gap: 6px; font-size: 17px; line-height: 1.35; font-weight: 600; }
.aff-steps .n { font-family: var(--mono); font-size: 15px; }
.aff-steps.entree .n { color: #0d66d0; }
.aff-steps.sortie .n { color: #1f7a5c; }
.aff-foot { margin-top: auto; display: flex; align-items: center; gap: 12px; background: #f4f6f8; border-radius: 14px;
            padding: 14px 18px; font-size: 16px; color: #3d4653; }
.aff-foot svg { width: 22px; height: 22px; flex: none; }

/* Planche d'étiquettes A4 3 × 7 (63,5 × 38,1 mm, type Avery L7160) — aussi lisible découpée aux ciseaux. */
.planche { width: 210mm; height: 297mm; box-sizing: border-box; padding: 15.15mm 7.2mm 0;
           display: grid; grid-template-columns: repeat(3, 63.5mm); grid-auto-rows: 38.1mm; column-gap: 2.5mm;
           break-after: page; page-break-after: always; background: #fff; }
.planche:last-child { break-after: auto; page-break-after: auto; }
.etiq { display: flex; align-items: center; gap: 2.5mm; padding: 2.5mm 3mm; box-sizing: border-box; overflow: hidden;
        color: #10151b; font-family: var(--font); outline: .2mm dashed #cfd5dd; outline-offset: -.1mm; }
.etiq-qr { width: 31mm; height: 31mm; flex: none; }
.etiq-qr svg { width: 100%; height: 100%; display: block; }
.etiq-t { display: flex; flex-direction: column; gap: 1mm; min-width: 0; }
.etiq-t b { font-size: 10pt; line-height: 1.15; overflow-wrap: anywhere; }
.etiq-t span { font-size: 7.5pt; color: #3d4653; }
.etiq-t em { font-size: 6.5pt; font-style: normal; color: #5b6472; }

/* Thème « signalétique de site » — écran du GU */
.hd-user { color: var(--marine-sub); }
.hd-btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.3); }
.tab { color: var(--marine-sub); }
.tab[aria-selected="true"] { background: var(--gray-50); color: var(--gray-900); font-weight: 700; }
.tiles { gap: 12px; }
.tile { border-top: 5px solid var(--gray-400); padding: 14px 16px; }
.tile-v { font-size: 34px; line-height: 1; }
.tile-l { margin-top: 4px; font-size: 14px; }
.tile.big { background: var(--marine); border-color: var(--marine); }
.tile.big .tile-l { color: var(--marine-sub); }
.tile.warn { border-top-color: var(--warn); }
.tile.neg { border-top-color: var(--neg); }
.tile.pos { background: var(--pos-bg); border-color: var(--pos-line); border-top-color: var(--pos); }
.tile.pos .tile-v, .tile.pos .tile-l { color: var(--pos-fg); }
.grp { border-color: var(--gray-300); }
.grp-h { align-items: center; }
.grp-h h3 { flex: 1; font-size: 17px; }
.row { border-top-color: var(--gray-200); padding: 12px 16px; }
.row-t { font-weight: 700; }
.code { font-family: var(--mono); font-weight: 600; font-size: 13px; padding: 5px 9px; border-radius: 8px;
         background: var(--app); color: #fff; flex: none; }
.tile.big { background: var(--app); border-color: var(--app); }
.tile.big .tile-l { color: #e9e2ff; }
.ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none;
       background: var(--app-soft); color: var(--app-fort); }
.ico.cle { background: var(--cle-soft); color: var(--cle); }
.row.sorti { border-left: 6px solid var(--app); }
.row.retard { border-left: 6px solid var(--neg); background: #fffafa; }
.row.long { border-left: 6px solid var(--warn); }
.tile.neg { background: var(--neg-bg); border-color: var(--neg-line); border-top-color: var(--neg); }
.tile.neg .tile-v, .tile.neg .tile-l { color: var(--neg-fg); }
