/* App de punch CJL : styles repris du prototype mobile (prototype/index.html). */

/* Polices hébergées avec l'app (jamais chargées depuis Google : Loi 25) */
@font-face { font-family: 'Montserrat'; src: url('polices/montserrat-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('polices/montserrat-800.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Roboto'; src: url('polices/roboto-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Roboto'; src: url('polices/roboto-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Roboto'; src: url('polices/roboto-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  /* Image de marque CJL (codes À CONFIRMER avec le guide officiel) */
  --rouge: #EA1F25; --anthracite: #35363A; --beige: #E8E3DD; --gris: #E0E0E0; --noir: #000000;
  /* Couleurs de travail */
  --surface: #FBF9F6; --surface-2: #F1ECE6; --texte: #35363A; --muted: #5E5A55; --bordure: #CFC7BD;
  --vert: #1E6B3A; --vert-doux: #D9ECDF; --orange: #8A4B00; --orange-doux: #F7E3C6;
  --erreur: #A3161B; --erreur-doux: #F9DADB; --nav-inactif: #C9C9CC;
  --police-titres: 'Montserrat', system-ui, sans-serif; --police-texte: 'Roboto', system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--beige); color: var(--texte);
  font: 16px/1.45 var(--police-texte);
  -webkit-text-size-adjust: 100%;
}
body.avec-menu { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--anthracite); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--police-titres); font-weight: 700; }
[hidden] { display: none !important; }
.ico { flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Bandeau de l'environnement de développement (fausses données) */
.bandeau-dev {
  background: var(--gris); color: var(--noir); font-size: 14px; padding: 6px 16px; border-bottom: 1px dashed #9a958f; text-align: center;
}

/* En-tête */
.app-head {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  background: var(--beige); padding: 10px 16px; border-bottom: 1px solid var(--bordure);
}
.logo {
  width: 36px; height: 36px; border-radius: 9px; background: var(--anthracite); color: #fff;
  display: flex; align-items: center; justify-content: center; font: 800 17px/1 var(--police-titres); letter-spacing: -.02em;
}
.logo span { color: var(--rouge); }
.app-titre { font: 700 18px var(--police-titres); flex: 1; min-width: 0; }
.app-titre small { display: block; font: 500 13px var(--police-texte); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-tete {
  min-height: 44px; padding: 0 12px; border: 2px solid var(--anthracite); border-radius: 12px; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; font-weight: 700;
}

/* Pastilles d'état : toujours une icône et un mot */
.pastille {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px 2px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-2); color: var(--texte); font-weight: 500;
}
.pastille.ok { background: var(--vert-doux); color: var(--vert); }
.pastille.attente { background: var(--orange-doux); color: var(--orange); }

/* Menu du bas : 5 emplacements, Punch au centre */
nav.barre {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--anthracite);
  display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 2px calc(6px + env(safe-area-inset-bottom));
}
nav.barre button {
  position: relative; background: none; border: 0; color: var(--nav-inactif); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px;
  min-height: 60px; padding: 4px 0; font: 500 14px/1.1 var(--police-texte);
}
nav.barre button[aria-current="page"] { color: #fff; font-weight: 700; }
nav.barre button[aria-current="page"]:not(.centre)::before {
  content: ''; position: absolute; top: -6px; left: 22%; right: 22%; height: 4px; border-radius: 0 0 4px 4px; background: var(--rouge);
}
nav.barre .centre .disque {
  width: 66px; height: 66px; margin-top: -30px; border-radius: 50%; background: var(--rouge); color: #fff;
  display: grid; place-items: center; box-shadow: 0 0 0 5px var(--anthracite), 0 6px 14px rgba(0, 0, 0, .25);
}

/* Écrans mobile */
.ecran { max-width: 480px; margin: 0 auto; padding: 16px 16px 24px; }
.ecran h1 { font-size: 26px; margin: 0 0 12px; }
.bientot {
  background: var(--surface); border-radius: 18px; padding: 24px 16px; text-align: center; margin-top: 8px;
}
.bientot .ico { color: var(--muted); }
.bientot p { margin: 8px 0 0; }

/* Formulaires */
.formulaire { background: var(--surface); border-radius: 18px; padding: 16px; }
.etiquette { display: block; font-weight: 700; margin: 16px 0 6px; }
.formulaire > .etiquette:first-child { margin-top: 0; }
.formulaire input[type="tel"], .formulaire input[type="password"], .formulaire input[type="text"] {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 2px solid var(--bordure); border-radius: 12px; background: #fff; font-size: 16px;
}
.formulaire input.code { font: 700 24px/1 var(--police-titres); letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.aide { margin-top: 6px; }
.erreur-champ { display: flex; gap: 6px; align-items: center; margin-top: 10px; color: var(--erreur); font-weight: 500; }
.btn-principal {
  width: 100%; min-height: 56px; margin-top: 16px; border: 0; border-radius: 14px; background: var(--anthracite); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700;
}
.btn-principal:disabled { opacity: .6; cursor: progress; }
.btn-envoyer { background: var(--rouge); font: 700 20px var(--police-titres); }
.lien-bas { display: block; width: 100%; min-height: 48px; margin-top: 10px; background: none; border: 0; text-decoration: underline; cursor: pointer; font-weight: 500; }
.message-info { background: var(--surface); border-radius: 18px; padding: 16px; }
.message-info.alerte { background: var(--orange-doux); color: var(--orange); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20;
  background: var(--anthracite); color: #fff; padding: 12px 16px; border-radius: 12px; opacity: 0; transition: opacity .2s;
  pointer-events: none; max-width: calc(100% - 32px);
}
body.avec-menu .toast { bottom: calc(104px + env(safe-area-inset-bottom)); }
.toast.show { opacity: 1; }

/* Mode ordinateur (Comptabilité et Administrateur) */
.bureau { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 57px); }
.bureau-menu { background: var(--surface); border-right: 1px solid var(--bordure); padding: 12px 8px; display: flex; flex-direction: column; gap: 4px; }
.bureau-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px;
  background: transparent; cursor: pointer; text-align: left; font-weight: 500;
}
.bureau-menu button[aria-current="page"] { background: var(--anthracite); color: #fff; font-weight: 700; }
.bureau-contenu { padding: 24px; max-width: 1100px; }
.bureau-contenu h1 { font-size: 26px; margin: 0 0 12px; }
@media (max-width: 760px) {
  .bureau { grid-template-columns: 1fr; }
  .bureau-menu { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--bordure); }
  .bureau-menu button { width: auto; white-space: nowrap; }
  .bureau-contenu { padding: 16px; }
}
