/* PunchMaster : feuille de style commune (application, gestion, console).
   Aucun style en ligne dans les pages : la CSP n'autorise que ce fichier (style-src 'self'). */
:root {
  --fond: #f4f5f7;
  --surface: #ffffff;
  --texte: #16202c;
  --texte-doux: #5b6675;
  --bordure: #d9dee5;
  --marque: #ff7a00;          /* orange PunchMaster ; remplacé par la couleur de la société */
  --marque-texte: #16181d;
  --barre: #16181d;
  --barre-texte: #ffffff;
  --accent: #16181d;
  --vert: #18864b;
  --vert-fonce: #116b3b;
  --rouge: #c0392b;
  --rouge-fonce: #9e2e22;
  --orange: #a85a00;
  --jaune-fond: #fff6db;
  --rayon: 14px;
  --ombre: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0f141a;
    --surface: #18202a;
    --texte: #e8edf3;
    --texte-doux: #9aa6b4;
    --bordure: #2a3542;
    --barre: #000000;
    --accent: #e8edf3;
    --vert: #2fae6a;
    --vert-fonce: #25915a;
    --rouge: #e5604f;
    --rouge-fonce: #c94c3d;
    --orange: #f0a040;
    --jaune-fond: #3a3018;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100vh; min-height: 100dvh; }

.cache { display: none !important; }

header.barre {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--barre); color: var(--barre-texte);
  border-bottom: 4px solid var(--marque);
}
header.barre h1 { margin: 0; font-size: 18px; font-weight: 800; }
header.barre h1 span { color: var(--marque); }
header.barre h1 small { display: block; font-size: 12px; font-weight: 600; opacity: .8; }
header.barre .qui {
  font-size: 14px; opacity: .9; min-width: 0; max-width: 40vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
header.barre button, header.barre select {
  background: transparent; color: inherit; border: 1px solid currentColor; border-radius: 8px;
  padding: 6px 10px; font-size: 14px; width: auto;
}
header.barre select option { color: var(--texte); background: var(--surface); }
.barre-droite { display: flex; gap: 8px; align-items: center; flex: 0 1 auto; min-width: 0; }
header.barre h1 { min-width: 0; }

main { max-width: 560px; margin: 0 auto; padding: 16px; }
main.large { max-width: 1240px; }

.carte {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 16px;
  margin-bottom: 16px;
}
.carte.etroite { max-width: 440px; margin: 24px auto; }
.carte.moyenne { max-width: 760px; }

h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 6px; color: var(--texte-doux); }
label.case { display: flex; gap: 8px; align-items: center; color: var(--texte); }
label.case input { width: auto; }

input, select, textarea {
  width: 100%;
  font: inherit; font-size: 17px;
  padding: 12px;
  border: 1px solid var(--bordure);
  border-radius: 10px;
  background: var(--surface); color: var(--texte);
}
input[type="color"] { height: 48px; padding: 4px; }
input[type="checkbox"] { width: auto; }
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--marque) 55%, transparent);
  outline-offset: 1px;
}

button { font: inherit; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }

.bouton {
  display: block; width: 100%;
  padding: 14px 16px;
  border: 0; border-radius: 12px;
  font-size: 17px; font-weight: 700;
  background: var(--marque); color: var(--marque-texte);
  text-decoration: none; text-align: center;
}
.bouton.secondaire { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
.bouton.petit { display: inline-block; width: auto; padding: 8px 12px; font-size: 14px; border-radius: 9px; }
.bouton.danger { background: var(--rouge); color: #fff; }
.lien { background: none; border: 0; padding: 8px 0; color: var(--texte-doux); text-decoration: underline; font-size: 14px; }

.punch {
  display: block; width: 100%;
  padding: 26px 16px;
  border: 0; border-radius: 18px;
  font-size: 26px; font-weight: 800; letter-spacing: .5px;
  color: #fff;
}
.punch.in { background: var(--vert); }
.punch.in:active { background: var(--vert-fonce); }
.punch.out { background: var(--rouge); }
.punch.out:active { background: var(--rouge-fonce); }

.horloge { text-align: center; font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.date-du-jour { text-align: center; color: var(--texte-doux); margin-bottom: 8px; }

.en-cours { border-left: 6px solid var(--vert); }
.en-cours .duree { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.en-cours .detail { color: var(--texte-doux); }

.etiquette {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px;
  background: var(--fond); border: 1px solid var(--bordure); color: var(--texte-doux);
}
.etiquette.alerte { background: var(--jaune-fond); color: var(--orange); border-color: var(--orange); }
.etiquette.ok { color: var(--vert); border-color: var(--vert); }
.pastille { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--bordure); vertical-align: middle; }

.message { padding: 12px; border-radius: 10px; margin: 12px 0; font-weight: 600; }
.message.erreur { background: color-mix(in srgb, var(--rouge) 14%, transparent); color: var(--rouge); }
.message.info { background: color-mix(in srgb, var(--vert) 14%, transparent); color: var(--vert); }
.message.attente { background: var(--jaune-fond); color: var(--orange); }

.ligne { display: flex; gap: 8px; align-items: center; }
.ligne > * { flex: 1; }
.ligne > .fixe { flex: 0 0 auto; }
.ligne.envelopper { flex-wrap: wrap; }
.pousse { flex: 1 1 auto; }
.espace { height: 12px; }
.espace-haut { margin-top: 12px; }
.doux { color: var(--texte-doux); font-size: 14px; }
.centre { text-align: center; }
.sans-marge { margin: 0; }

nav.onglets {
  display: flex; gap: 4px; overflow-x: auto; padding: 8px 16px 0;
  background: var(--surface); border-bottom: 1px solid var(--bordure);
}
nav.onglets button {
  border: 0; background: transparent; padding: 10px 14px; font-weight: 600; color: var(--texte-doux);
  border-bottom: 3px solid transparent; white-space: nowrap;
}
nav.onglets button.actif { color: var(--texte); border-bottom-color: var(--marque); }

.jour { margin-bottom: 12px; }
.jour-titre { display: flex; justify-content: space-between; font-weight: 700; padding: 6px 0; border-bottom: 1px solid var(--bordure); }
.entree { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--bordure); font-size: 15px; }
.entree:last-child { border-bottom: 0; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--bordure); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--texte-doux); }
td.actions { white-space: nowrap; }
td.actions .bouton + .bouton { margin-left: 4px; }
td.nombre, th.nombre { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; background: var(--fond); }
tr.alerte td { background: var(--jaune-fond); }
tr.inactif td { color: var(--texte-doux); }
.tableau { overflow-x: auto; }

.liste-choix { max-height: 50vh; overflow-y: auto; border: 1px solid var(--bordure); border-radius: 10px; }
.liste-choix label {
  display: flex; gap: 10px; align-items: center; margin: 0; padding: 12px;
  border-bottom: 1px solid var(--bordure); color: var(--texte); font-weight: 500;
}
.liste-choix input { width: auto; transform: scale(1.4); }

dialog {
  border: 1px solid var(--bordure); border-radius: var(--rayon); background: var(--surface); color: var(--texte);
  max-width: 560px; width: calc(100% - 32px); padding: 20px; max-height: 90vh; overflow-y: auto;
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog ul, .avis ul { padding-left: 20px; }
dialog li, .avis li { margin-bottom: 6px; }

.qr { display: block; margin: 12px auto; background: #fff; padding: 8px; border-radius: 8px; }
code.secret { font-size: 15px; font-weight: 700; letter-spacing: 1px; word-break: break-all; }
ol.etapes { padding-left: 20px; }
.historique { border-left: 3px solid var(--bordure); padding-left: 10px; margin: 8px 0; font-size: 14px; }

@media (max-width: 640px) {
  .masquer-mobile { display: none; }
  th, td { padding: 6px 4px; }
}

/* ---------------------------------------------------------------------------
   Feuille de temps de l'employé (D-20) : Mes feuilles, une semaine, saisie, signature
   --------------------------------------------------------------------------- */
.droite { margin-left: auto; text-align: right; }
.bloc { display: block; }
.texte-erreur { color: var(--rouge); font-weight: 600; font-size: 14px; }
.total-semaine { font-size: 18px; font-variant-numeric: tabular-nums; }

.liste-semaines { border-top: 1px solid var(--bordure); }
.semaine-ligne {
  display: flex; width: 100%; gap: 12px; align-items: center; justify-content: space-between;
  padding: 14px 4px; min-height: 64px; border: 0; border-bottom: 1px solid var(--bordure);
  background: transparent; color: var(--texte); text-align: left; font-size: 16px;
}
.semaine-ligne:active { background: var(--fond); }
.semaine-droite { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: 0 0 auto; }
.semaine-total { font-size: 17px; font-variant-numeric: tabular-nums; }

.jour-carte { padding: 12px 14px; margin-bottom: 10px; }
.jour-carte > .doux { display: block; padding-top: 6px; }
.journee {
  display: block; width: 100%; margin: 8px 0; padding: 10px 12px; text-align: left;
  border: 1px solid var(--bordure); border-radius: 10px; background: var(--fond); color: var(--texte); font-size: 15px;
}
.journee > span { display: block; }
.journee .etiquette { margin-top: 4px; }
button.journee:active { border-color: var(--marque); }
.ajouter-journee { min-height: 44px; margin-top: 4px; }

/* Fenêtre du bas (saisie d'une journée, envoi de la feuille) */
dialog.feuille-bas { padding: 16px; }
@media (max-width: 640px) {
  dialog.feuille-bas {
    width: 100%; max-width: 100%; max-height: 94vh; max-height: 94dvh;
    margin: auto 0 0; border-radius: 18px 18px 0 0; border-bottom: 0;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}
.panneau h2 { margin-bottom: 8px; }
.barre-bas {
  position: sticky; bottom: -16px; z-index: 1; display: flex; gap: 8px;
  margin: 16px -16px -16px; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--bordure);
}
.barre-bas > .bouton { flex: 1; width: auto; }
.bouton.gros { padding: 18px 16px; font-size: 18px; }

.entete-journee { border-bottom: 1px solid var(--bordure); padding-bottom: 10px; }
.projet-entete {
  display: block; width: 100%; padding: 4px 0; border: 0; background: transparent; color: var(--texte);
  text-align: left; font-size: 17px; min-height: 44px;
}
.projet-entete .doux { text-decoration: underline; }
.date-journee { color: var(--texte-doux); font-weight: 600; }

.resume-journee { margin-top: 12px; }
.ligne-resume {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 0; border-bottom: 1px solid var(--bordure); min-height: 48px;
}
.ligne-resume .valeur, .ligne-resume strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.ligne-resume .vide { color: var(--rouge); font-weight: 700; }
.compteur { display: inline-flex; align-items: center; gap: 10px; }
.compteur .bouton.petit { min-width: 48px; min-height: 44px; font-size: 22px; padding: 4px 10px; }
.compteur output { min-width: 64px; text-align: center; }

.taches { margin-top: 4px; }
.tache { display: grid; grid-template-columns: minmax(0, 1fr) 84px 44px; gap: 6px; align-items: center; margin-bottom: 6px; }
.tache select, .tache input { padding: 10px 8px; font-size: 16px; }
.retirer { border: 0; background: transparent; color: var(--rouge); font-size: 18px; min-height: 44px; }

.liste-projets {
  max-height: 56vh; max-height: 56dvh; overflow-y: auto; margin-top: 12px;
  border: 1px solid var(--bordure); border-radius: 10px;
}
.projet-ligne { display: flex; align-items: stretch; border-bottom: 1px solid var(--bordure); }
.projet-ligne.choisi { background: var(--jaune-fond); }
.etoile { flex: 0 0 48px; border: 0; background: transparent; font-size: 24px; color: var(--texte-doux); }
.etoile.active { color: var(--orange); }
.projet-choix {
  flex: 1; min-height: 52px; padding: 10px 8px; border: 0; background: transparent; color: var(--texte);
  text-align: left; font-size: 16px;
}

.deux-colonnes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset.pauses { border: 1px solid var(--bordure); border-radius: 10px; padding: 4px 12px 8px; margin: 16px 0 0; }
fieldset.pauses legend { font-weight: 700; padding: 0 4px; }
.pause-ligne { padding: 8px 0; border-bottom: 1px dashed var(--bordure); }
.pause-ligne:last-child { border-bottom: 0; }
.pause-prise { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.pause-ligne label.case { margin: 4px 0; min-height: 40px; font-weight: 600; }
.pause-ligne label.non-prise { font-weight: 500; color: var(--texte-doux); }
.pause-ligne input[type="checkbox"], .liste-choix input { transform: scale(1.35); }
.pause-ligne input[type="time"] { margin: 4px 0 8px; }
.plage { color: var(--texte-doux); font-variant-numeric: tabular-nums; }
.calcul-direct { margin-top: 12px; padding: 12px; background: var(--fond); border-radius: 10px; font-size: 17px; }

.zone-signature {
  display: block; width: 100%; height: 180px; margin-top: 4px;
  background: #fff; border: 2px dashed var(--bordure); border-radius: 10px; touch-action: none;
}
.resume-envoi { padding-left: 20px; margin: 4px 0; }

/* Bureau : feuille d'un employé comme Comworker (grille, pauses, signature, notes) */
tr.choisie td { background: var(--jaune-fond); }
.actions-feuille { margin: 8px 0 12px; }
.grille-feuille { min-width: 980px; font-size: 13px; }
.grille-feuille th.projet { min-width: 150px; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--texte); font-weight: 500; }
.grille-feuille td.case { min-width: 112px; }
.grille-feuille thead th { white-space: nowrap; }
.journee-case { padding: 6px; margin-bottom: 6px; border: 1px solid var(--bordure); border-radius: 8px; background: var(--fond); }
.journee-case .plage-case { font-variant-numeric: tabular-nums; white-space: nowrap; }
.journee-case .total-case { font-size: 18px; font-weight: 800; }
.journee-case .ventilation { font-size: 12px; }
.journee-case.diff { background: var(--jaune-fond); border-color: var(--orange); }
.note-diff { margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--orange); }
.actions-case { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.ligne-pause th { text-transform: none; letter-spacing: 0; font-size: 12px; }
.ligne-pause td { font-size: 12px; color: var(--texte-doux); }
.total-feuille { text-align: right; font-size: 17px; margin: 8px 0 0; }
.signature-bloc { margin-top: 16px; }
.signature-svg { display: block; width: 100%; max-width: 360px; height: 120px; color: #111827; background: #fff;
  border: 1px solid var(--bordure); border-radius: 8px; }
.notes-bureau { margin-top: 16px; }
.notes-impression { display: none; }
.pause-reglage { padding: 8px 0; border-bottom: 1px dashed var(--bordure); }
.pause-reglage:last-of-type { border-bottom: 0; }
.feuille-originale h2 { margin-bottom: 4px; }

/* Télécharger PDF : impression de la feuille officielle seulement (navigateur → « Enregistrer en PDF »). */
@media print {
  @page { size: letter landscape; margin: 10mm; }
  html, body { background: #fff; color: #000; font-size: 11pt; }
  header.barre, nav.onglets, #message, dialog, .pas-imprimer, .vue-non-imprimee { display: none !important; }
  main, main.large { max-width: none; padding: 0; }
  .carte { border: 0; box-shadow: none; padding: 0; margin: 0 0 8mm; background: #fff; }
  .tableau { overflow: visible; }
  .grille-feuille { min-width: 0; font-size: 8.5pt; }
  .grille-feuille th, .grille-feuille td { padding: 3px; border: 1px solid #999; color: #000; }
  .journee-case { border: 0; background: none; padding: 0; }
  .journee-case.diff { background: none; }
  .etiquette { border-color: #999; color: #000; background: none; }
  .notes-impression { display: block; margin-top: 4mm; white-space: pre-wrap; }
  .notes-impression.hors-pdf { display: none !important; }
  .signature-svg { border: 0; height: 30mm; }
}
