:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1a1d23;
  --muted: #6b7280;
  --primary: #16693f;
  --primary-dark: #0f4c2c;
  --danger: #b3261e;
  --warn: #b45309;
  --info: #1d5bbf;
  --border: #e2e4e9;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Conteneur des bannieres persistantes (simulation d'employe + retour au pointage en cours,
   voir app.js) - sticky plutot que fixed : reste visible en haut pendant le defilement, sans
   recouvrir le contenu ni necessiter de padding compensatoire sur #app. C'est LUI qui est
   sticky (et non chaque banniere individuellement) pour que plusieurs bannieres affichees en
   meme temps s'empilent proprement au lieu de se superposer. */
#status-banners {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
}
/* Chaque banniere individuelle : masquee par defaut (display:none inline, voir
   updateImpersonationBanner/updateActivePointageBanner), affichee en display:flex par JS
   uniquement quand elle s'applique. */
#impersonation-banner, #active-pointage-banner, #notif-bar, #priority-task-banner, #reprise-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: white;
  padding: 8px 16px;
  font-size: 0.82rem;
}
#impersonation-banner { background: var(--warn); }
#active-pointage-banner { background: var(--primary); }
/* Tache prioritaire envoyee par un admin/manager (voir updatePriorityTaskBanner) - couleur
   distincte (--danger, rouge) : c'est le bandeau le plus urgent de tous, doit sauter aux yeux
   meme empile avec les autres - demande explicite du 16/09/2026 ("qui n'apparaisse pas juste en
   notification mais qui vienne en page principale"). */
#priority-task-banner { background: var(--danger); font-weight: 600; }
/* Bandeau notifications (voir updateNotifBar) - present sur TOUTES les pages (sauf login et
   l'ecran Notifications lui-meme, deja affiche dessus) - demande explicite du 15/09/2026 ("les
   notifications doivent toujours etre presentes sur toutes les pages, voir s'ils en ont une et
   pouvoir en rediger une rapidement"). Couleur distincte (--info, bleu) des 2 autres bannieres
   pour ne pas les confondre quand elles s'empilent (simulation/pointage en cours + notifications
   en meme temps). */
#notif-bar { background: var(--info); }
#impersonation-banner button, #active-pointage-banner button, #notif-bar button, #priority-task-banner button, #reprise-banner button {
  background: white;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  width: auto;
  flex-shrink: 0;
}
#impersonation-banner button { color: var(--warn); }
#active-pointage-banner button { color: var(--primary-dark); }
#notif-bar button { color: var(--info); }
#priority-task-banner button { color: var(--danger); }
/* Journee ouverte mais AUCUN pointage en cours (voir updateRepriseBanner) - orange, entre le
   bleu informatif des notifications et le rouge de la tache prioritaire : ce n'est pas une
   urgence envoyee par quelqu'un, mais du temps qui ne se compte pas. */
#reprise-banner { background: var(--warn); font-weight: 600; }
#reprise-banner button { color: var(--warn); }
#notif-bar .notif-bar-left { display: flex; align-items: center; gap: 6px; }

h1, h2, h3 { margin: 0 0 4px; }
h1 { font-size: 1.3rem; }
h2 { font-size: 1.1rem; }
p.muted, span.muted { color: var(--muted); font-size: 0.9rem; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

button {
  font: inherit;
  border-radius: 12px;
  border: none;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary { background: var(--primary); color: white; width: 100%; }
.btn-primary:active { background: var(--primary-dark); }
.btn-secondary { background: #eef0f3; color: var(--text); width: 100%; }
.btn-danger { background: var(--danger); color: white; width: 100%; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); width: 100%; }
.btn-outline.active { background: var(--primary); border-color: var(--primary); color: white; }
.btn-small { padding: 8px 12px; font-size: 0.85rem; width: auto; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: white;
}
textarea { resize: vertical; min-height: 70px; }
/* Champ fige (ex: debut = fin de la ligne precedente dans le rattrapage) : doit se voir comme tel,
   sinon on croit a une panne quand la saisie ne prend pas (24/09/2026). */
input[readonly] { background: #f3f4f6; color: var(--muted); }
label { font-size: 0.85rem; color: var(--muted); display: block; margin-bottom: 4px; }

.entity-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: white;
  border: 1px solid var(--border);
  padding: 18px;
  font-size: 1.05rem;
  margin-bottom: 10px;
}
.entity-btn:active { background: #f0fbf5; border-color: var(--primary); }

.list-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  background: white;
}
.list-item:active { border-color: var(--primary); background: #f0fbf5; }
.list-item .title { font-weight: 600; }
.list-item .sub { color: var(--muted); font-size: 0.85rem; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #eaf6ee;
  color: var(--primary-dark);
}
.badge.warn { background: #fdf1e2; color: var(--warn); }
.badge.danger { background: #fbeaea; color: var(--danger); }

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.error-msg { color: var(--danger); font-size: 0.9rem; }

.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: white;
  font-size: 0.9rem;
  cursor: pointer;
}
.chip.selected { background: var(--primary); color: white; border-color: var(--primary); }

.photo-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); }

.timer { font-size: 2rem; font-weight: 700; text-align: center; color: var(--primary-dark); }

.link-btn { background: none; border: none; color: var(--primary); text-decoration: underline; padding: 4px; width: auto; font-weight: 500; }

/* Bouton "← Retour" (21/09/2026 : "il est difficile a selectionner"). Il etait un simple lien
   souligne de 4px de marge : une cible d'a peine 28px de haut, au doigt sur un telephone c'est
   rate une fois sur deux. On en fait une vraie pastille : 44px de haut minimum (taille de cible
   recommandee sur mobile), bordure, fond, largeur au contenu et calee a gauche, sans changer le
   markup (40 ecrans l'utilisent). #fp-back : le retour de "mot de passe oublie", meme traitement. */
#back-btn, #fp-back {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  align-self: flex-start;
  min-height: 44px; padding: 10px 18px 10px 14px;
  background: var(--card); color: var(--primary-dark);
  border: 1px solid var(--border); border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  text-decoration: none; font-weight: 600; font-size: 1rem; line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
#back-btn:active, #fp-back:active { background: #e6f2ec; border-color: var(--primary); }
#fp-back { align-self: center; }

.overview-scroll { overflow-x: auto; }
.overview-scroll table { min-width: 480px; }
.status-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.status-present { background: var(--primary); }
.status-repos { background: #cbd0d6; }
/* "absent" = conge (hors maladie) - bleu ; "maladie" a part - rouge - distinction demandee le
   15/09/2026 ("je veux voir en bleu les conges et en rouge les malades"), voir routes/planning.ts. */
.status-absent { background: var(--info); }
.status-maladie { background: var(--danger); }
.status-inconnu { background: transparent; border: 1px dashed var(--border); }
.status-ferme { background: #1a1d23; }
.exc-cell { cursor: pointer; }
.exc-cell:active { background: #f0fbf5; }
#exc-kind-menu button.active { background: var(--primary); border-color: var(--primary); color: white; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-weekday { text-align: center; font-size: 0.75rem; color: var(--muted); font-weight: 600; padding: 4px 0; }
.cal-cell { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 6px 2px; min-height: 46px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cal-cell-out { opacity: 0.35; }
.cal-cell-has-data { cursor: pointer; }
.cal-cell-has-data:active { border-color: var(--primary); background: #f0fbf5; }
.cal-daynum { font-size: 0.8rem; font-weight: 600; }
.cal-dots { display: flex; gap: 3px; min-height: 8px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-red { background: var(--danger); }
.dot-blue { background: #1d4ed8; }
.dot-orange { background: #c2680d; }

/* ---------------------------------------------------------------------------
   Sections repliables ("groupes a developper" - demande du 17/09/2026 : certaines
   pages etaient devenues trop longues a faire defiler). Construites sur <details>/
   <summary> natifs : aucun JavaScript n'est necessaire pour ouvrir/fermer (donc ca
   marche meme si un rendu echoue), le clavier et les lecteurs d'ecran les gerent
   deja, et l'etat ouvert/ferme est simplement memorise par app.js (voir wireGroups).
   --------------------------------------------------------------------------- */
details.group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
details.group + details.group { margin-top: -4px; }
details.group > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
/* Safari/iOS dessine son propre triangle : on le retire pour garder le chevron ci-dessous. */
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--muted);
  transition: transform 0.15s ease;
}
details.group[open] > summary::after { transform: rotate(180deg); }
details.group > summary .group-count {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.8rem;
}
details.group > .group-body {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Preparation des salaires (02/10/2026) : vue large sur ordinateur, inchangee sur telephone. */
body.vue-large #app { max-width: 1280px; }
body.vue-large table td, body.vue-large table th { padding: 4px 6px; }
