/* Couleurs et tailles reprises des maquettes (README-CLAUDE-CODE.md, « Repères visuels »). */
:root {
  --fond: #141312;
  --carte: #242220;
  --carte-2: #2F2C29;
  --ligne: #3A3633;
  --texte: #F6F2EE;
  --texte-2: #ABA49D;
  --rouge: #E63A1C;
  --rouge-fonce: #C42E15;
  --jaune: #F2C14E;
  --vert: #2E8B3E;
  --vert-clair: #4CAF6A;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--fond);
  color: var(--texte);
  font-family: Poppins, Roboto, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button, input { font-family: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.35; cursor: not-allowed; }

.ecran { height: 100%; display: flex; flex-direction: column; }

/* En-tête et onglets */
.entete { display: flex; align-items: center; gap: 20px; padding: 14px 24px 10px; }
.titre { display: flex; flex-direction: column; line-height: 1.2; min-width: 170px; }
.sur-titre { color: var(--rouge); font-size: 12px; font-weight: 700; letter-spacing: 0.14em; }
.titre strong { font-size: 20px; font-weight: 800; }
.version { color: var(--texte-2); font-size: 12px; }
.onglets { flex: 1; display: flex; gap: 8px; }
.onglets button {
  flex: 1; min-height: 60px; border: none; border-radius: 14px;
  background: var(--carte); font-size: 17px; font-weight: 700;
}
.onglets button.actif { background: var(--texte); color: var(--fond); }
.etats { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.pastille { background: var(--carte); border-radius: 10px; padding: 4px 10px; font-size: 13px; white-space: nowrap; }
.pastille.ok { background: #1F2A21; color: var(--vert-clair); }
.pastille.ko { background: #3D1D16; color: #FF8A73; }
.recharger { display: none; }
.etats .recharger { display: block; border: 1px solid var(--ligne); background: none; border-radius: 10px; font-size: 20px; padding: 0 14px; }

.bandeau-pedale {
  margin: 0 24px; padding: 8px 16px; border-radius: 12px; background: var(--carte);
  color: var(--texte-2); font-size: 17px;
}
.bandeau-pedale.flash { animation: flash 0.6s ease-out; }
@keyframes flash { from { background: var(--jaune); color: var(--fond); } to { background: var(--carte); color: var(--texte-2); } }

/* Sections */
main { flex: 1; overflow-y: auto; padding: 16px 24px 24px; }
.section { display: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
.section.visible { display: grid; }
.colonne { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
h1 { margin: 0; font-size: 40px; font-weight: 800; line-height: 1.1; }
.sous-titre { font-size: 14px; font-weight: 700; letter-spacing: 0.1em; color: var(--texte-2); }
.consignes { margin: 0; padding-left: 26px; font-size: 18px; line-height: 1.45; color: var(--texte); }
.consignes li { margin-bottom: 4px; }
.info { margin: 0; min-height: 26px; font-size: 17px; color: var(--jaune); }
.details { font-size: 16px; color: var(--texte-2); line-height: 1.45; word-break: break-word; }

.ligne-boutons { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.etiquette-ligne { font-size: 18px; color: var(--texte-2); }
.valeur { font-size: 30px; font-weight: 800; min-width: 70px; text-align: center; }

.bouton, .choix {
  min-height: 68px; padding: 0 22px; border: 3px solid transparent; border-radius: 18px;
  background: var(--carte-2); font-size: 19px; font-weight: 700;
}
.bouton.principal { background: var(--rouge); color: #fff; }
.bouton.petit { min-width: 68px; font-size: 28px; padding: 0; }
.choix.choisi { border-color: var(--texte); background: var(--carte-2); }
.choix { background: var(--carte); }

input[type="range"] { flex: 1; height: 48px; accent-color: var(--rouge); }

.carte-mesure { background: var(--carte); border-radius: 18px; padding: 14px 18px; display: flex; flex-direction: column; gap: 6px; }
.compteurs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gros { font-size: 64px; font-weight: 800; line-height: 1; }
.barre { height: 16px; border-radius: 8px; background: var(--ligne); overflow: hidden; }
.barre > div { height: 100%; width: 0; background: var(--jaune); }
.verdict { font-size: 44px; font-weight: 800; }
.verdict.long { color: var(--jaune); }
.compte { font-size: 150px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.heure { font-size: 64px; font-weight: 800; line-height: 1.1; }

.liste { margin: 0; padding-left: 26px; font-size: 16px; color: var(--texte-2); line-height: 1.5; }

/* Résultats à noter */
.criteres { display: flex; flex-direction: column; gap: 8px; }
.critere { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; background: var(--carte); border-radius: 14px; padding: 8px 8px 8px 16px; font-size: 16px; }
.critere button { min-height: 56px; min-width: 112px; border: none; border-radius: 12px; background: var(--carte-2); font-size: 16px; font-weight: 700; }
.critere button.ok.choisi { background: var(--vert); color: #fff; }
.critere button.ko.choisi { background: var(--rouge-fonce); color: #fff; }

/* Résumé */
.tableau { width: 100%; border-collapse: collapse; font-size: 15px; }
.tableau th { text-align: left; color: var(--texte-2); font-weight: 600; padding: 4px 12px 4px 0; width: 38%; vertical-align: top; }
.tableau td { padding: 4px 0; word-break: break-word; }
.tableau tr + tr { border-top: 1px solid var(--ligne); }
.resultat-test { background: var(--carte); border-radius: 14px; padding: 10px 14px; margin-bottom: 8px; font-size: 15px; }
.resultat-test strong { display: block; margin-bottom: 4px; }
.r-ok { color: var(--vert-clair); }
.r-ko { color: #FF8A73; }
.r-vide { color: var(--texte-2); }

/* Alarme du minuteur */
.bandeau-alarme {
  display: none; position: fixed; left: 24px; right: 24px; bottom: 20px; min-height: 96px;
  border: none; border-radius: 20px; background: var(--jaune); color: var(--fond);
  font-size: 30px; font-weight: 800; animation: clignote 1s steps(2, start) infinite;
}
body.alarme .bandeau-alarme { display: block; }
@keyframes clignote { to { background: var(--texte); } }

/* Étiquette 62 mm (aperçu à l'écran et impression) */
.apercu { background: var(--carte); border-radius: 18px; padding: 18px; height: 300px; overflow: hidden; }
#apercu-etiquette { transform: scale(1.75); transform-origin: top left; width: 62mm; }
.etiquette {
  width: 62mm; padding: 3mm 3.5mm; background: #fff; color: #111;
  font-family: Poppins, Arial, sans-serif; display: flex; flex-direction: column; gap: 0.6mm;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.e-entete { font-size: 6.5pt; font-weight: 700; letter-spacing: 0.16em; }
.e-format { font-size: 20pt; font-weight: 800; line-height: 1.05; }
.e-lot { font-size: 11pt; font-weight: 700; }
.e-fab { font-size: 8pt; }
.e-dlc { font-size: 14pt; font-weight: 800; margin-top: 0.8mm; }
.e-mentions { font-size: 7pt; font-weight: 700; margin-top: 0.8mm; }

/* Modèle HACCP (design/Design-System.html de l'app HACCP, ramené de 310 px à 62 mm) */
.etiquette.haccp { gap: 1.6mm; padding: 3.2mm 3.6mm; }
.h-entete { display: flex; justify-content: space-between; font-size: 6.8pt; font-weight: 800; letter-spacing: 0.12em; }
.h-nom { font-size: 14.5pt; font-weight: 800; line-height: 1.1; }
.h-dlc { background: #000; color: #fff; padding: 1.2mm 2mm; display: flex; justify-content: space-between; align-items: baseline; }
.h-dlc > span:first-child { font-size: 9pt; font-weight: 800; }
.h-dlc-date { font: 700 19pt/1 ui-monospace, 'Roboto Mono', monospace; }
.h-bas { display: flex; gap: 2.4mm; align-items: flex-start; }
.h-infos { flex: 1; display: flex; flex-direction: column; gap: 0.8mm; font-size: 7.4pt; line-height: 1.3; }
.h-infos .mono { font: 700 8pt ui-monospace, 'Roboto Mono', monospace; }
.h-qr { width: 16.8mm; height: 16.8mm; flex-shrink: 0; }
.h-qr svg { display: block; width: 100%; height: 100%; }

#zone-impression { display: none; }

@media print {
  html, body { background: #fff !important; height: auto; }
  body > *:not(#zone-impression) { display: none !important; }
  #zone-impression { display: block !important; }
  body[data-impression="fixe"] #zone-impression .etiquette { height: 50mm; overflow: hidden; }
  #zone-impression .etiquette { break-after: page; page-break-after: always; }
  #zone-impression .etiquette:last-child { break-after: auto; page-break-after: auto; }
}
