/* ============================================================
   VUES
   ============================================================ */

/* ---------- Connexion / activation ---------- */
.accueil-public {
  min-height: 100dvh;
  display: grid; place-items: center;
  padding: calc(var(--safe-top) + var(--s-6)) var(--page-pad) calc(var(--safe-bottom) + var(--s-6));
}
.accueil-public__boite { width: 100%; max-width: 420px; }
.accueil-public__marque { text-align: center; margin-bottom: var(--s-6); }
.accueil-public__marque .marque__mx { font-size: 46px; display: block; margin-bottom: var(--s-2); }
.accueil-public__marque h1 { font-size: 22px; }
.accueil-public__marque p { color: var(--text-2); margin-top: var(--s-2); font-size: 15px; }
.accueil-public .carte { padding: var(--s-6); }

/* ---------- Saisie d'une journee ---------- */
.jour-tete { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-4); }
.jour-tete__date { flex: 1; text-align: center; position: relative; }
.jour-tete__date strong { display: block; font: 700 20px/1.2 var(--font-titre); }
.jour-tete__date span { font-size: 14px; color: var(--text-2); }
.jour-tete__date input[type="date"] { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }

.creneau {
  border: 1px solid var(--line); border-radius: var(--r-l);
  padding: var(--s-4); background: var(--surface-2);
}
.creneau + .creneau { margin-top: var(--s-3); }
.creneau__tete { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-3); }
.creneau__num { white-space: nowrap; font-weight: 700; font-size: 14px; color: var(--text-2); display: flex; align-items: center; gap: var(--s-2); }
.creneau__duree { font-weight: 700; color: var(--accent); }
.creneau__heures { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: var(--s-2); }
.creneau__fleche { padding-bottom: 14px; color: var(--text-3); }
.creneau__fleche svg { width: 20px; height: 20px; }
.saisie--cible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); }
.heures-rapides { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-3); }
.puce--heure { min-height: 40px; padding: 0 var(--s-3); font-size: 15px; font-variant-numeric: tabular-nums; color: var(--text); background: var(--bg); border-color: var(--line); }
.puce--heure:hover { border-color: var(--accent); }
.puce--heure:active { background: var(--primaire); border-color: var(--primaire); color: #fff; }
.creneau__minuit { margin-top: var(--s-2); font-size: 13px; color: var(--alerte); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.creneau__minuit svg { width: 16px; height: 16px; }

.total-jour {
  position: sticky;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--s-2));
  z-index: 5;
  margin-top: var(--s-5);
}
@media (min-width: 960px) { .total-jour { bottom: var(--s-4); } }
.total-jour .carte { padding: var(--s-4) var(--s-5); border-color: var(--line-fort); box-shadow: var(--ombre); }
.total-jour__ligne { display: flex; align-items: center; gap: var(--s-4); }
.total-jour__val { font: 800 30px/1 var(--font); }
.total-jour__detail { flex: 1; font-size: 13px; color: var(--text-2); line-height: 1.45; }

/* ---------- Lignes de jours (mois, semaine, feuille) ---------- */
.jour-ligne { display: grid; grid-template-columns: 52px 1fr auto; gap: var(--s-3); align-items: center; padding: var(--s-3) 0; text-decoration: none; color: inherit; }
.jour-ligne:hover .jour-ligne__val { color: var(--accent); }
.jour-ligne__date { text-align: center; line-height: 1.1; }
.jour-ligne__date b { display: block; font-size: 20px; }
.jour-ligne__date span { font-size: 12px; color: var(--text-3); font-weight: 700; text-transform: uppercase; }
.jour-ligne--weekend .jour-ligne__date { opacity: 0.6; }
.jour-ligne--aujourdhui .jour-ligne__date b { color: var(--accent); }
.jour-ligne__info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.jour-ligne__plages { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.jour-ligne__lieux { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jour-ligne__tags { display: flex; flex-wrap: wrap; gap: 4px; }
.jour-ligne__val { font-weight: 800; font-size: 16px; text-align: right; white-space: nowrap; }
.jour-ligne__val small { display: block; font-size: 12px; color: var(--text-3); font-weight: 600; }

/* ---------- Semaine ---------- */
.barres-semaine { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s-2); align-items: end; height: 120px; margin: var(--s-4) 0 var(--s-2); }
.barres-semaine a { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; text-decoration: none; color: var(--text-2); font-size: 12px; font-weight: 700; gap: 4px; }
.barres-semaine span.b { width: 100%; max-width: 34px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--mx-blue-bright), var(--mx-primary)); min-height: 3px; }
.barres-semaine span.b--abs { background: repeating-linear-gradient(45deg, var(--text-3) 0 3px, transparent 3px 7px); border: 1px solid var(--text-3); }

/* ---------- Releve (totaux) ---------- */
.releve { display: grid; gap: var(--s-2) var(--s-5); grid-template-columns: 1fr auto; font-size: 15px; }
.releve dt { color: var(--text-2); }
.releve dd { margin: 0; font-weight: 700; text-align: right; white-space: nowrap; }
.releve .releve__fort { font-weight: 800; color: var(--text); }
.releve .releve__sep { height: 1px; background: var(--line); margin: var(--s-1) 0; }
.releve .releve__indent { padding-left: var(--s-4); font-size: 14px; }

/* ---------- Direction ---------- */
.kpi { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; }
.kpi .stat__val { font-size: 32px; }
.kpi--alerte .stat__val { color: var(--alerte); }
.filtres { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: end; margin-bottom: var(--s-4); }
.filtres .champ { min-width: 160px; flex: 1; }
.filtres .saisie { min-height: 44px; font-size: 15px; }
.barre-lot {
  position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--s-2)); z-index: 5;
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
  padding: var(--s-3) var(--s-4); border-radius: var(--r-l);
  background: var(--surface-3); border: 1px solid var(--line-fort); box-shadow: var(--ombre); margin-top: var(--s-4);
}
@media (min-width: 960px) { .barre-lot { bottom: var(--s-4); } }
.repartition { display: grid; gap: var(--s-3); }
.repartition__ligne { display: grid; grid-template-columns: 140px 1fr auto; gap: var(--s-3); align-items: center; font-size: 14px; }

.journal-entree { padding: var(--s-3) 0; }
.journal-entree__tete { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: baseline; }
.journal-entree__tete b { font-size: 15px; }
.journal-entree__motif { margin-top: 4px; font-size: 14px; color: var(--text); }
.journal-entree__motif::before { content: "Motif : "; color: var(--text-3); }

/* ---------- Signature ---------- */
.signature-apercu {
  display: grid; place-items: center; min-height: 110px; padding: var(--s-3);
  background: #fff; border-radius: var(--r-m); border: 1px solid var(--line-fort);
}
.signature-apercu img { max-height: 90px; max-width: 100%; object-fit: contain; }
.signature-apercu .faible { color: #5F6A9E; }
.pad-signature {
  display: block; width: 100%; aspect-ratio: 3 / 1; margin-top: var(--s-3);
  background: #fff; border-radius: var(--r-m); border: 2px dashed var(--line-fort);
  touch-action: none; cursor: crosshair;
}

/* ---------- PDF : aucun effet en mode document ---------- */
body.pdf-mode *, body.pdf-mode *::before, body.pdf-mode *::after {
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
  animation: none !important; box-shadow: none !important; transition: none !important;
}

@media print {
  .entete, .onglets, .lateral, .total-jour, .barre-lot, .actions, .toasts { display: none !important; }
  body { background: #fff; color: #000; }
  .carte { border-color: #ccc; background: #fff; backdrop-filter: none; }
}
