:root {
  --primary: #2c5282;
  --primary-dark: #1a365d;
  --primary-light: #4299e1;
  --secondary: #48bb78;
  --danger: #f56565;
  --danger-dark: #c53030;
  --warning: #ed8936;
  --info: #4299e1;
  --success: #48bb78;
  --dark: #1a202c;
  --gray-100: #f7fafc;
  --gray-200: #edf2f7;
  --gray-300: #e2e8f0;
  --gray-400: #cbd5e0;
  --gray-500: #a0aec0;
  --gray-600: #718096;
  --gray-700: #4a5568;
  --steel: #8891a5;
  --radius: 14px;
  --radius-sm: 9px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--gray-100);
  color: var(--dark);
  height: 100%;
}

body {
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: var(--gray-100);
  position: relative;
  display: flex;
  flex-direction: column;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

a { color: inherit; }

/* ---------- Ecran de connexion ---------- */
.login-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: linear-gradient(160deg, var(--primary-dark), var(--primary) 70%);
  color: #fff;
  min-height: 100vh;
}

/* Logo Qorvaltic (icone + wordmark vectoriels, identiques au Qorvaltic de bureau) */
.brand-icon { width: 30px; height: 30px; flex-shrink: 0; display: block; }
.brand-wordmark { height: 28px; width: auto; flex-shrink: 0; display: block; }
/* Cent-quarante-cinquieme passe : remplace le wordmark vectoriel "QORVALTIC" quand un nom
   personnalise (custAppName) est defini -- voir app.js, brandWordmark(). */
.brand-wordmark-text {
  height: 28px; display: flex; align-items: center;
  font-size: 22px; font-weight: 800; letter-spacing: .3px; color: #FFFFFF; white-space: nowrap;
}
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-tag {
  font-size: 11px; font-weight: 700; letter-spacing: 3px; color: var(--warning);
  margin: 8px 0 2px;
}

.login-sub {
  font-size: 13px;
  opacity: .8;
  margin: 20px 0 40px;
  text-align: center;
}

/* Cent-vingt-sixieme passe -- numero de build, discret, pour verifier en un coup d'oeil qu'un
   telephone donne a bien recharge la derniere version deployee (voir loginVersionBadge() dans
   app.js). Volontairement tres discret (petit, peu contraste) : utile a verifier, jamais genant au
   quotidien pour la personne qui se connecte. */
.login-version { font-size: 11px; opacity: .5; margin-top: 28px; letter-spacing: .5px; }

.login-choice {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 10px;
}

.login-btn {
  width: 100%;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}
.login-btn i { font-size: 20px; width: 24px; text-align: center; }
.login-btn:active { background: rgba(255,255,255,.22); }

.login-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-collab {
  width: 100%;
  background: #fff;
  color: var(--dark);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 600;
}
.login-collab .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-light); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}

.login-back {
  margin-top: 24px;
  color: rgba(255,255,255,.75);
  font-size: 13px;
  text-decoration: underline;
}

/* Ecran de connexion -- formulaire e-mail/mot de passe (connexion reelle a
   Supabase, voir app.js/submitLogin()). Le contexte est sombre (degrade
   .login-screen) : styles dedies plutot que de reutiliser .form-group, pense
   pour un fond clair (voir plus bas, utilise dans les "sheets"). */
.login-form { width: 100%; display: flex; flex-direction: column; gap: 14px; margin-bottom: 6px; }
.login-form label { font-size: 12px; font-weight: 700; opacity: .85; margin-bottom: 6px; display: block; }
.login-form input[type=email], .login-form input[type=password], .login-form input[type=text] {
  width: 100%; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.12); color: #fff; font-size: 16px; font-family: inherit;
}
.login-form input::placeholder { color: rgba(255,255,255,.55); }
.login-form input:focus { outline: none; border-color: #fff; background: rgba(255,255,255,.18); }

/* Bouton "oeil" du champ mot de passe (voir toggleLoginPasswordVisibility() dans app.js) --
   permet de relire le mot de passe en clair avant de se connecter. */
.pw-field { position: relative; }
.login-form .pw-field input[type=password], .login-form .pw-field input[type=text] { padding-right: 50px; }
.pw-toggle {
  position: absolute; top: 50%; right: 0; transform: translateY(-50%);
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.75); font-size: 15px; border-radius: 8px;
}
.pw-toggle:active { background: rgba(255,255,255,.14); }
.login-error {
  background: rgba(245,101,101,.22); border: 1px solid rgba(245,101,101,.55); color: #fff;
  border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 2px;
}
.login-btn[disabled] { opacity: .6; }
.login-btn-submit { justify-content: center; }
/* Cent-soixante-dix-septieme passe : ecran "session gardee, reessayez" (voir passerEnReprise() dans app.js) */
.login-link { color: rgba(255,255,255,.85); font-size: 14px; text-decoration: underline; min-height: 44px; padding: 0 12px; align-self: center; }

/* ---------- Structure app ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary) 85%);
  color: #fff;
  /* BUG CORRIGE : une fois Qorvaltic Mobile installee en icone sur l'ecran d'accueil (voir README,
     "Quatre-vingt-quatorzieme passe"), l'application s'affiche en plein ecran -- c'est alors a elle,
     et non plus a Safari, de laisser la place pour l'horloge/le reseau/la batterie du telephone en
     haut de l'ecran. Sans cette ligne, ce bandeau du telephone se superposait au logo et au bouton
     "Deconnexion", le rendant impossible a toucher -- signale avec capture d'ecran (bouton
     "Deconnexion" inaccessible en haut a droite). Meme principe deja applique au bas de l'ecran
     (voir .bottomnav ci-dessous, pour la barre de gestes du telephone) -- il manquait seulement ici,
     en haut. Voir README, "Quatre-vingt-quinzieme passe". */
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 6px rgba(0,0,0,.16);
}
.tb-brand-row { display: flex; align-items: center; gap: 9px; }
.tb-brand .brand-icon { width: 19px; height: 19px; }
.tb-brand .brand-wordmark { height: 16px; }
.tb-brand .brand-wordmark-text { height: 16px; font-size: 14px; }
.tb-brand-tag {
  font-size: 9.5px; font-weight: 700; letter-spacing: 1.5px; color: var(--warning);
  border-left: 1px solid rgba(255,255,255,.3); padding-left: 8px; margin-left: 1px;
}
.tb-brand small { display: block; font-weight: 400; font-size: 11px; opacity: .78; margin-top: 3px; }
.topbar .tb-action { color: #fff; font-size: 13px; opacity: .85; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
/* Cent-soixante-dix-septieme passe : cible tactile >= 44 px (elle faisait 82x15). Le rembourrage agrandit la
   zone d'appui, les marges negatives compensent pour que la barre du haut ne grandisse pas. */
.topbar .tb-action { min-height: 44px; min-width: 44px; padding: 0 8px; margin: -6px -8px -6px 0; justify-content: center; }

.content {
  flex: 1;
  padding: 14px 14px 90px;
  overflow-y: auto;
}
/* Cent-soixante-dix-septieme passe : BUG CORRIGE -- 24 px seulement : le bouton flottant (+, 54 px a 22 px du
   bas) masquait le bouton "Supprimer" du dernier ticket. Marge basse >= 96 px (FAB + dégagement). */
.content.admin { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
/* Texte long SANS espace (nom de chantier/titre colle) : il debordait de l'ecran et repoussait le badge. */
.content, .sheet, .toast { overflow-wrap: anywhere; }
.content .tr-top > div, .content .team-card > div, .content .chantier-card, .content .mo-row span { min-width: 0; }

.bottomnav {
  position: sticky; bottom: 0; z-index: 20;
  background: #fff;
  border-top: 1px solid var(--gray-300);
  display: flex;
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
}
.bottomnav button {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 44px;
  padding: 6px 0;
  color: var(--gray-500);
  font-size: 11px;
  font-weight: 600;
}
.bottomnav button i { font-size: 17px; }
.bottomnav button.active { color: var(--primary); }

.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 10px 0;
  background: var(--primary-dark);
  overflow-x: auto;
}
.admin-tabs button {
  flex: 0 0 auto;
  color: rgba(255,255,255,.65);
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 13px;
  border-radius: 10px 10px 0 0;
}
.admin-tabs button.active { color: #fff; background: var(--gray-100); border-radius: 10px 10px 0 0; color: var(--primary-dark); }
/* Classe .admin-tabs elle-meme desormais inutilisee (remplacee par la grille .home-grid
   ci-dessous, voir adminAccueil() dans app.js) -- conservee sans risque, au cas ou. */

/* ---------- Admin : accueil (grille de cartes, remplace l'ancienne rangee d'onglets) ------- */
.home-back {
  display: flex; align-items: center; gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  font-size: 13px; font-weight: 700; color: var(--primary);
}
.home-back i { font-size: 12px; }

.home-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.home-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  opacity: 0;
  animation: home-card-in .38s ease-out forwards;
}
@keyframes home-card-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Meme animation d'entree (fondu + leger glissement vers le haut, en cascade) que la grille de
   cartes ci-dessus (adminAccueil()) -- reutilisee telle quelle sur l'ecran d'accueil du
   Collaborateur terrain (collabAccueil() dans app.js) pour lui donner la meme presentation animee,
   adaptee a son propre contenu (carte journee, ticket en cours, file d'attente) plutot qu'a une
   grille de sections. Voir README, "Quatre-vingt-douzieme passe". */
.fade-up-in { opacity: 0; animation: home-card-in .38s ease-out forwards; }
/* Cent-soixante-dix-septieme passe : un re-rendu du MEME ecran (action, tick de 30 s) ne rejoue pas l'animation
   d'apparition (clignotement) -- classe posee par render() (app.js). */
.sans-anim .fade-up-in, .sans-anim .home-card { opacity: 1; animation: none; }

/* Fleche "retour" des fiches detail : cible >= 44 px */
.back-btn { font-size: 18px; color: var(--gray-600); min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; margin-left: -10px; }
.form-group label.assigne-opt, .assigne-opt { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 0; margin: 0; font-size: 14px; font-weight: normal; color: var(--dark); }
/* Case a cocher : zone d'appui de 44 px, dessin de 22 px (pseudo-element) */
.assigne-opt input { -webkit-appearance: none; appearance: none; position: relative; width: 44px; height: 44px; margin: 0 -8px 0 -10px; flex: 0 0 auto; background: transparent; border: 0; cursor: pointer; }
.assigne-opt input::before { content: ''; position: absolute; inset: 11px; border: 2px solid var(--gray-400); border-radius: 5px; background: #fff; }
.assigne-opt input:checked::before { background: var(--primary); border-color: var(--primary); box-shadow: inset 0 0 0 3px #fff; }

.home-card .hc-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; margin-bottom: 12px;
}
.home-card.hc-blue .hc-icon { background: var(--primary); }
.home-card.hc-orange .hc-icon { background: var(--warning); }
.home-card.hc-steel .hc-icon { background: var(--steel); }
.home-card.hc-info .hc-icon { background: var(--primary-light); }

.home-card .hc-title { font-size: 14.5px; font-weight: 700; color: var(--dark); display: flex; align-items: center; gap: 6px; }
.home-card .hc-subtitle { font-size: 12px; color: var(--gray-600); margin-top: 3px; line-height: 1.35; }

.hc-badge {
  font-size: 11px; font-weight: 800; color: #fff; background: var(--gray-500);
  border-radius: 20px; padding: 1px 7px; line-height: 1.5;
}
.hc-badge.live { background: var(--success); animation: hc-pulse 1.8s ease-in-out infinite; }
.hc-badge.warn { background: var(--warning); }
.hc-badge.danger { background: var(--danger); }
@keyframes hc-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(72,187,120,.45); }
  50% { box-shadow: 0 0 0 5px rgba(72,187,120,0); }
}

/* ---------- Cartes generales ---------- */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.section-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin: 4px 2px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.greeting-row { display: flex; align-items: center; gap: 12px; }
.greeting-text { min-width: 0; }
.greeting-avatar { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; background: var(--primary-light, #3b82c4); color: #fff; font-weight: 800; font-size: 17px; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.greeting-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.greeting-name { font-size: 20px; font-weight: 800; color: var(--dark); }
.greeting-date { font-size: 13px; color: var(--gray-600); margin-top: 2px; text-transform: capitalize; }

/* ---------- Carte journee ---------- */
.day-card {
  border-radius: var(--radius);
  padding: 16px;
  margin: 14px 0;
  color: #fff;
  background: var(--gray-500);
}
.day-card.running { background: linear-gradient(135deg, #2f855a, #48bb78); }
.day-card.paused { background: linear-gradient(135deg, #b7791f, #ed8936); }
.day-card.off { background: var(--gray-400); color: var(--gray-700); }
.day-card .dc-status { font-size: 12.5px; font-weight: 700; letter-spacing: .4px; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.day-card .dc-row { display: flex; justify-content: space-between; font-size: 13px; opacity: .95; margin-bottom: 2px; }
.day-card .dc-time { font-size: 26px; font-weight: 800; margin: 6px 0 10px; }
.day-card .dc-actions { display: flex; gap: 10px; margin-top: 10px; }
.day-card .dc-actions button {
  flex: 1;
  min-height: 44px;
  background: rgba(255,255,255,.22);
  color: #fff;
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
}
.day-card.off .dc-actions button { background: rgba(0,0,0,.06); color: var(--gray-700); }
.day-card .dc-sub { font-size: 13px; opacity: .95; margin-top: 2px; }

.btn-start-day {
  width: 100%;
  background: var(--primary);
  color: #fff;
  padding: 16px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 14px 0;
  box-shadow: 0 3px 8px rgba(44,82,130,.35);
}
.btn-start-day:active { background: var(--primary-dark); }

/* ---------- Ticket en cours / liste ---------- */
.ticket-active {
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  background: #fff;
  border: 2px solid var(--danger);
  position: relative;
}
.ticket-active.prio-normale { border-color: var(--warning); }
.ticket-active.prio-basse { border-color: var(--success); }
.ticket-active.paused { border-color: var(--gray-400); background: var(--gray-100); }

.ticket-active .ta-label {
  font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px;
  color: var(--danger); margin-bottom: 6px; display: flex; align-items: center; gap: 6px;
}
.ticket-active.prio-normale .ta-label { color: var(--warning); }
.ticket-active.prio-basse .ta-label { color: var(--success); }
.ticket-active.paused .ta-label { color: var(--gray-600); }

.ticket-active .ta-chantier { font-size: 15px; font-weight: 700; color: var(--dark); }
.ticket-active .ta-titre { font-size: 13.5px; color: var(--gray-700); margin-top: 2px; }
.ticket-active .ta-desc { font-size: 12px; color: var(--gray-600); margin-top: 4px; }
.ticket-active .ta-time { font-size: 12.5px; color: var(--gray-600); margin-top: 10px; }
.ticket-active .ta-duree { font-size: 22px; font-weight: 800; color: var(--dark); margin-top: 2px; }
.ticket-active .ta-actions { display: flex; gap: 10px; margin-top: 14px; }
.ticket-active .ta-actions button {
  flex: 1;
  min-height: 44px;
  padding: 11px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
}
.ta-btn-pause { background: var(--gray-200); color: var(--gray-700); }
.ta-btn-resume { background: var(--success); color: #fff; }
.ta-btn-end { background: var(--danger); color: #fff; }
.ta-btn-photo { background: var(--gray-200); color: var(--gray-700); flex: 0 0 46px !important; }

.queue-item {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 9px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot.prio-urgente { background: var(--danger); }
.dot.prio-normale { background: var(--warning); }
.dot.prio-basse { background: var(--success); }
.queue-item .qi-main { flex: 1; min-width: 0; }
.queue-item .qi-chantier { font-size: 14px; font-weight: 700; color: var(--dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-item .qi-titre { font-size: 12.5px; color: var(--gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-item .qi-desc { font-size: 11.5px; color: var(--gray-500); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-item .qi-echeance { font-size: 11px; color: var(--gray-500); margin-top: 2px; }
.queue-item .qi-go { background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; padding: 8px 14px; border-radius: 8px; flex-shrink: 0; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
.queue-item.dim { opacity: .55; }

.btn-adhoc {
  width: 100%;
  background: #fff;
  border: 1.5px dashed var(--gray-400);
  color: var(--gray-600);
  padding: 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 4px;
  min-height: 44px;
}

.empty-state { text-align: center; padding: 30px 10px; color: var(--gray-500); font-size: 13.5px; }
.empty-state i { font-size: 26px; margin-bottom: 8px; display: block; color: var(--gray-400); }

/* ---------- Filtres chips ---------- */
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; }
.chip {
  flex: 0 0 auto;
  display: inline-flex; align-items: center;
  min-height: 44px;
  padding: 7px 15px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--gray-300);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-600);
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Badges de statut ---------- */
.badge-statut { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: .3px; }
.badge-nouveau { background: #ebf4ff; color: var(--primary); }
.badge-en_cours { background: #fff5eb; color: var(--warning); }
.badge-pause { background: var(--gray-200); color: var(--gray-600); }
.badge-bloque { background: #fff5f5; color: var(--danger); }
.badge-termine_collab { background: #f0fff4; color: #2f855a; }
.badge-valide { background: #ebf8f2; color: var(--success); }

/* ---------- Boutons generiques ---------- */
.btn { padding: 12px 16px; border-radius: 10px; font-size: 14px; font-weight: 700; min-height: 44px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: #fff; border: 1.5px solid var(--gray-300); color: var(--gray-700); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 8px 12px; font-size: 12.5px; }

/* ---------- Sheet / modal ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.overlay.center { align-items: center; padding: 20px; }
.sheet {
  width: 100%; max-width: 480px;
  background: #fff;
  border-radius: 18px 18px 0 0;
  max-height: 88vh;
  overflow-y: auto;
  padding: 18px 18px max(18px, env(safe-area-inset-bottom));
}
.overlay.center .sheet { border-radius: 16px; max-height: 85vh; }
.sheet-handle { width: 38px; height: 4px; background: var(--gray-300); border-radius: 4px; margin: 0 auto 14px; }
.sheet h3 { margin: 0 0 4px; font-size: 17px; }
.sheet .sheet-sub { font-size: 12.5px; color: var(--gray-600); margin-bottom: 16px; }
.sheet-close { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; font-size: 18px; color: var(--gray-500); background: none; border: 0; padding: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 700; color: var(--gray-600); margin-bottom: 6px; }
.form-group input[type=text], .form-group input[type=date], .form-group input[type=time], .form-group input[type=number], .form-group select, .form-group textarea {
  width: 100%; padding: 11px 12px; border-radius: 9px; border: 1.5px solid var(--gray-300);
  font-size: 16px; font-family: inherit; background: #fff; min-height: 44px;
}
.form-group textarea { resize: vertical; min-height: 70px; }

.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border-radius: 10px; border: 1.5px solid var(--gray-300);
  font-size: 13.5px; font-weight: 600; color: var(--gray-700); min-height: 44px;
}
.radio-opt.selected { border-color: var(--primary); background: #ebf4ff; color: var(--primary-dark); }
.radio-opt .rd { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--gray-400); flex-shrink: 0; }
.radio-opt.selected .rd { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 3px #fff; }

.sheet-actions { display: flex; gap: 10px; margin-top: 4px; }
.sheet-actions .btn { flex: 1; }

.photo-preview-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.photo-thumb { width: 62px; height: 62px; border-radius: 8px; object-fit: cover; border: 1px solid var(--gray-300); }
.photo-add-btn {
  width: 62px; height: 62px; border-radius: 8px; border: 1.5px dashed var(--gray-400);
  display: flex; align-items: center; justify-content: center; color: var(--gray-500); font-size: 17px;
}

/* ---------- Admin : équipe en direct ---------- */
.team-card {
  background: #fff; border-radius: var(--radius-sm); padding: 13px 14px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 12px;
}
.team-card .avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-light); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.team-card .tc-status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.tc-status-dot.on { background: var(--success); }
.tc-status-dot.pause { background: var(--warning); }
.tc-status-dot.off { background: var(--gray-400); }
.team-card .tc-name { font-size: 14.5px; font-weight: 700; color: var(--dark); }
.team-card .tc-detail { font-size: 12.5px; color: var(--gray-600); margin-top: 2px; }
.team-card .tc-time { font-size: 12px; color: var(--gray-500); margin-top: 1px; }

/* ---------- Admin : stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 16px; }
.stat-tile { background: #fff; border-radius: var(--radius-sm); padding: 12px 8px; text-align: center; }
.stat-tile .st-num { font-size: 20px; font-weight: 800; color: var(--dark); }
.stat-tile .st-label { font-size: 10.5px; color: var(--gray-600); font-weight: 600; margin-top: 2px; text-transform: uppercase; letter-spacing: .2px; }
.stat-tile.warn .st-num { color: var(--warning); }
.stat-tile.danger .st-num { color: var(--danger); }

.fab {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(calc(-50% + 190px));
  background: var(--primary);
  color: #fff;
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(44,82,130,.4);
  z-index: 30;
}
@media (max-width: 480px) {
  .fab { transform: none; right: 18px; left: auto; }
}

/* ---------- Admin : liste tickets ---------- */
.ticket-row {
  background: #fff; border-radius: var(--radius-sm); padding: 13px 14px; margin-bottom: 9px;
}
.tr-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
/* Cent-soixante-dix-septieme passe : un texte long sans espace elargissait la colonne de gauche (min-width:auto
   d'un enfant flex) et repoussait le badge hors de l'ecran -- min-width:0 + coupure n'importe ou. */
.tr-top > div:first-child { min-width: 0; flex: 1 1 auto; }
.tr-top .badge-statut { flex-shrink: 0; white-space: nowrap; }
.tr-chantier { font-size: 14px; font-weight: 700; color: var(--dark); min-width: 0; overflow-wrap: anywhere; }
.tr-titre { font-size: 12.5px; color: var(--gray-600); min-width: 0; overflow-wrap: anywhere; }
.tr-desc { font-size: 11.5px; color: var(--gray-500); margin-top: 2px; overflow-wrap: anywhere; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tr-meta { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 11.5px; color: var(--gray-500); }
.tr-meta span { display: flex; align-items: center; gap: 4px; }
.tr-actions { display: flex; gap: 8px; margin-top: 10px; }
.tr-actions { flex-wrap: wrap; }
.tr-actions button { flex: 1; min-height: 44px; padding: 8px; border-radius: 8px; font-size: 12px; font-weight: 700; }

/* ---------- Chantiers ---------- */
.chantier-card { background: #fff; border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px; }
.chantier-card .ch-nom { font-size: 15px; font-weight: 700; color: var(--dark); }
.chantier-card .ch-stats { display: flex; gap: 18px; margin-top: 8px; }
.chantier-card .ch-stats div { font-size: 12px; color: var(--gray-600); }
.chantier-card .ch-stats b { display: block; font-size: 16px; color: var(--dark); }

.mo-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--gray-200); font-size: 13px; }
.mo-row:last-child { border-bottom: none; font-weight: 700; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: var(--dark); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13px; z-index: 9500; max-width: 90%; text-align: center;   /* 241e : au-dessus de la fenetre de reception (9000) */
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  animation: toast-in .18s ease-out;
  pointer-events: none; /* un toast affiche pendant qu'une feuille est ouverte ne doit jamais
                            intercepter un appui sur un bouton situe en dessous */
}
@keyframes toast-in { from { opacity:0; transform: translate(-50%,10px);} to { opacity:1; transform: translate(-50%,0);} }

.journal-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--gray-200); font-size: 13.5px; }
.journal-row:last-child { border-bottom: none; }
.journal-row .jr-label { color: var(--gray-700); font-weight: 600; }
.journal-row .jr-time { color: var(--gray-500); }
.journal-row .jr-fix { font-size: 11px; color: var(--primary); }

.note-banner {
  background: #ebf8ff; border: 1px solid #bee3f8; color: #2c5282;
  border-radius: 10px; padding: 10px 12px; font-size: 12px; margin-bottom: 14px; line-height: 1.4;
}

.corr-item { background: #fff; border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 9px; font-size: 12.5px; }
.corr-item .ci-title { font-weight: 700; color: var(--dark); font-size: 13.5px; margin-bottom: 3px; }
.corr-item .ci-detail { color: var(--gray-600); }
.corr-item .ci-meta { color: var(--gray-500); margin-top: 4px; font-size: 11.5px; }

/* =========================================================================
   Photos (Cent-soixante-dix-septieme passe) : prise de vue multiple, galeries,
   visionneuse, indicateur d'attente. Cibles tactiles >= 44 px, aucun
   debordement horizontal (min-width:0 + texte coupe), pas de dependance a une
   police d'icones pour les commandes essentielles (libelles ecrits).
   ========================================================================= */
.btn.photo-pick { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 52px; font-size: 15px; text-align: center; cursor: pointer; width: 100%; margin-bottom: 10px; }
.photo-actions { margin: 4px 0 14px; }
.photo-actions .photo-pick:last-child { margin-bottom: 0; }

.pc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.pc-grid:empty { display: none; }
.pc-item { min-width: 0; }
.pc-img { position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: var(--gray-200); border: 1px solid var(--gray-300); display: flex; align-items: center; justify-content: center; }
.pc-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-item.etat-ok .pc-img { border-color: var(--success); box-shadow: 0 0 0 1.5px var(--success); }
.pc-item.etat-attente .pc-img { border-color: var(--warning); box-shadow: 0 0 0 1.5px var(--warning); }
.pc-item.etat-erreur .pc-img { border-color: var(--danger); box-shadow: 0 0 0 1.5px var(--danger); }
.pc-item.etat-envoi .pc-img img, .pc-item.etat-prep .pc-img img { opacity: .6; }
.pc-etat { font-size: 11px; font-weight: 600; text-align: center; margin-top: 4px; color: var(--gray-600); overflow-wrap: anywhere; }
.pc-item.etat-ok .pc-etat { color: #2f855a; }
.pc-item.etat-attente .pc-etat { color: #c05621; }
.pc-item.etat-erreur .pc-etat { color: var(--danger-dark); }
.pc-spin { width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--gray-300); border-top-color: var(--primary); animation: pc-tourne .8s linear infinite; }
@keyframes pc-tourne { to { transform: rotate(360deg); } }
.pc-x { position: absolute; top: 0; right: 0; width: 44px; height: 44px; display: flex; align-items: flex-start; justify-content: flex-end; padding: 2px 6px; font-size: 24px; line-height: 1; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.pc-vide { font-size: 12.5px; color: var(--gray-500); text-align: center; padding: 14px 0 4px; }
.pc-resume { font-size: 12px; color: var(--gray-600); text-align: center; margin-top: 8px; }

.photo-note { font-size: 12.5px; line-height: 1.4; border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; background: #ebf8ff; border: 1px solid #bee3f8; color: #2c5282; }
.photo-note.warn { background: #fffaf0; border-color: #fbd38d; color: #744210; }

/* indicateur discret "N photos en attente d'envoi" (en haut du contenu, tous les roles) */
.photo-banner { display: flex; align-items: center; gap: 10px; background: #ebf8ff; border: 1px solid #bee3f8; color: #2c5282; border-radius: 10px; padding: 6px 6px 6px 12px; margin-bottom: 12px; font-size: 12.5px; }
.photo-banner.warn { background: #fffaf0; border-color: #fbd38d; color: #744210; }
.photo-banner > i { flex-shrink: 0; }
.photo-banner .pb-txt { flex: 1; min-width: 0; line-height: 1.3; }
.photo-banner .pb-txt small { display: block; font-size: 11.5px; opacity: .85; margin-top: 2px; }
.photo-banner .pb-btn { flex-shrink: 0; min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 8px; font-size: 12.5px; font-weight: 700; background: #fff; border: 1px solid currentColor; color: inherit; }
.photo-banner .pb-btn:disabled { opacity: .6; }

/* galeries : grille de miniatures (ticket) / regroupement par jour (chantier) */
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.pg-cell { min-width: 0; }
.pg-item { position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: var(--gray-200); padding: 0; border: 1px solid var(--gray-300); min-height: 44px; }
.pg-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pg-item.pending { border-color: var(--warning); box-shadow: 0 0 0 1.5px var(--warning); }
.pg-vide { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--gray-500); font-size: 22px; }
.pg-badge { position: absolute; left: 4px; bottom: 4px; max-width: calc(100% - 8px); font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 10px; color: #fff; background: rgba(26,32,44,.78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-badge.wait { background: var(--warning); }
.pg-badge.warn { background: var(--danger); }
.pg-badge.bureau { background: var(--primary, #2563eb); }
.pg-meta { font-size: 11px; color: var(--gray-600); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-lieu { font-size: 10.5px; color: var(--gray-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-jour { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 14px 0 8px; font-size: 13px; font-weight: 800; color: var(--dark); }
.pg-jour small { font-size: 11.5px; font-weight: 600; color: var(--gray-500); text-transform: none; }
.pg-plus { margin-top: 6px; }
.count-pill { display: inline-block; min-width: 20px; padding: 1px 7px; border-radius: 10px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; text-align: center; margin-left: 4px; vertical-align: 1px; }
.tr-photos { color: var(--primary); font-weight: 600; }

/* onglets d'une fiche chantier */
.seg-tabs { display: flex; gap: 6px; background: var(--gray-200); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.seg-tabs button { flex: 1; min-height: 44px; border-radius: 9px; font-size: 13.5px; font-weight: 700; color: var(--gray-600); display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg-tabs button.active { background: #fff; color: var(--primary-dark); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.chantier-card .ch-adr { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.ch-adr { font-size: 12px; color: var(--gray-500); }

/* visionneuse plein ecran */
.photo-viewer {
  position: fixed; inset: 0; z-index: 60; background: #0d1117; color: #fff;
  display: flex; flex-direction: column; height: 100%; max-height: 100dvh;
  /* pincement a deux doigts = zoom natif du navigateur ; le balayage d'un doigt reste gere par l'application */
  touch-action: pan-x pan-y pinch-zoom;
}
.pv-top { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: max(8px, env(safe-area-inset-top)) 10px 8px; background: rgba(0,0,0,.45); }
.pv-btn { min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 10px; color: #fff; font-size: 13.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; background: rgba(255,255,255,.12); }
.pv-btn span { font-size: 22px; line-height: 1; }
.pv-count { font-size: 13px; font-weight: 700; opacity: .85; }
.pv-stage { position: relative; flex: 1 1 0; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pv-thumb { position: absolute; inset: 0; background-size: contain; background-position: center; background-repeat: no-repeat; filter: blur(2px); opacity: .9; }
.pv-img { position: relative; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; opacity: 0; transition: opacity .2s; user-select: none; -webkit-user-drag: none; }
.pv-img.ok { opacity: 1; }
.pv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 72px; display: flex; align-items: center; justify-content: center; color: #fff; background: rgba(0,0,0,.4); font-size: 34px; line-height: 1; z-index: 2; }
.pv-nav.prev { left: 0; border-radius: 0 12px 12px 0; }
.pv-nav.next { right: 0; border-radius: 12px 0 0 12px; }
.pv-info { flex: 0 0 auto; max-height: 46%; overflow-y: auto; padding: 10px 14px max(12px, env(safe-area-inset-bottom)); background: rgba(0,0,0,.55); font-size: 13px; }
.pv-meta { font-weight: 700; overflow-wrap: anywhere; }
.pv-wait { color: #fbd38d; margin-left: 6px; }
.pv-lieu { font-size: 12px; opacity: .75; margin-top: 2px; overflow-wrap: anywhere; }
.pv-notice { font-size: 12px; color: #fbd38d; margin-bottom: 6px; }
.pv-notice:empty { display: none; }
.pv-legende { display: flex; gap: 8px; margin-top: 10px; }
.pv-legende input { flex: 1; min-width: 0; min-height: 44px; border-radius: 9px; border: 1.5px solid rgba(255,255,255,.3); background: rgba(255,255,255,.1); color: #fff; font-size: 16px; padding: 0 12px; font-family: inherit; }
.pv-legende input::placeholder { color: rgba(255,255,255,.55); }
.pv-save { flex: 0 0 auto; min-height: 44px; padding: 0 14px; border-radius: 9px; background: var(--primary-light); color: #fff; font-weight: 700; font-size: 13.5px; }
.pv-save:disabled { opacity: .6; }
.pv-legende-txt { margin-top: 8px; font-size: 14px; overflow-wrap: anywhere; }
.pv-suppr { margin-top: 10px; min-height: 44px; padding: 0 14px; border-radius: 9px; color: #feb2b2; border: 1.5px solid rgba(254,178,178,.5); font-weight: 700; font-size: 13.5px; width: 100%; }
.overlay.center.top { z-index: 70; }
/* paysage (telephone couche) : la photo a gauche, les informations a droite -- la photo garde toute la hauteur */
@media (orientation: landscape) and (max-height: 520px) {
  .photo-viewer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 40%); grid-template-rows: auto minmax(0, 1fr); }
  .pv-top { grid-column: 1 / 3; }
  .pv-stage { grid-column: 1; grid-row: 2; }
  .pv-info { grid-column: 2; grid-row: 2; max-height: none; }
}
.photo-viewer { overscroll-behavior: contain; }

/* Cent-quatre-vingtieme passe : rapports de chantier (Qorvaltic Mobile) */
.rap-avancement { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.rap-avancement input[type=range] { flex: 1; min-height: 44px; accent-color: var(--primary); }
.rap-avancement b { min-width: 48px; text-align: right; font-size: 15px; color: var(--dark); }
.rapport-card { background: #fff; border: 1px solid var(--gray-200); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.rapport-card .rc-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--gray-600); margin-bottom: 6px; }
.rapport-card .rc-top b { color: var(--dark); }
.rapport-card .rc-ticket { font-size: 12.5px; color: var(--gray-600); margin-bottom: 6px; }
.rapport-card .rc-label { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: var(--gray-600); margin: 8px 0 2px; }
.rapport-card .rc-label.rc-warn { color: #b7791f; }
.rapport-card .rc-texte { font-size: 14px; line-height: 1.45; color: var(--dark); white-space: pre-wrap; overflow-wrap: anywhere; }
.rapport-card .rc-warn-txt { background: #fffaf0; border-left: 3px solid #ed8936; padding: 6px 8px; border-radius: 6px; }
.rapport-card .rc-av { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.rapport-card .rc-av-bar { flex: 1; height: 8px; background: var(--gray-200); border-radius: 6px; overflow: hidden; }
.rapport-card .rc-av-bar span { display: block; height: 100%; background: var(--primary); }
.rapport-card .rc-av b { font-size: 13px; min-width: 42px; text-align: right; }
.rapport-card .rc-photos { font-size: 12px; color: var(--gray-600); margin-top: 8px; }
.seg-tabs button { font-size: 13px; padding: 0 4px; }
.chantier-card .ch-stats { flex-wrap: wrap; }

/* ---------- Planning (186e passe) ---------- */
.plan-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.plan-nav-titre { flex: 1; text-align: center; font-weight: 700; color: var(--dark); font-size: 14px; }
.plan-bandeau { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-bottom: 10px; }
.plan-jour {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; min-height: 58px;
  background: #fff; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font: inherit; color: var(--dark); cursor: pointer;
}
.plan-jour span { font-size: 10.5px; color: var(--gray-600); text-transform: uppercase; }
.plan-jour b { font-size: 16px; }
.plan-jour.auj { border-color: var(--primary-light); }
.plan-jour.sel { background: var(--primary); border-color: var(--primary); color: #fff; }
.plan-jour.sel span { color: #cbd5e0; }
.plan-point { width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.plan-point.on { background: var(--warning); }
.plan-jour.sel .plan-point.on { background: #fff; }
.plan-jour-titre { font-weight: 700; font-size: 13.5px; color: var(--dark); margin: 12px 2px 6px; text-transform: capitalize; }
.plan-jour-titre.auj { color: var(--primary); }
.plan-carte {
  display: flex; gap: 10px; align-items: flex-start; background: #fff; border-radius: var(--radius-sm); padding: 11px 12px; margin-bottom: 8px;
  border-left: 4px solid var(--primary-light);
}
.plan-carte.plan-ticket { border-left-color: var(--warning); }
.plan-heure { min-width: 74px; font-weight: 700; font-size: 12.5px; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.plan-corps { flex: 1; min-width: 0; }
.plan-titre { font-weight: 700; font-size: 14px; color: var(--dark); overflow-wrap: anywhere; }
.plan-titre i { color: var(--gray-500); font-size: 12px; margin-right: 3px; }
.plan-sous { font-size: 12.5px; color: var(--gray-600); margin-top: 2px; overflow-wrap: anywhere; }
.plan-sous i { width: 14px; color: var(--gray-500); }
.plan-sous.plan-notes { font-style: italic; }
.plan-periode { font-weight: 400; font-size: 11.5px; color: var(--gray-600); }
.plan-cloche { color: var(--warning); font-size: 13px; margin-top: 2px; }
.plan-vide { padding: 22px 10px; }
.plan-vide-ligne { font-size: 12.5px; color: var(--gray-500); padding: 2px 4px 6px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-danger-outline { color: var(--danger-dark); border-color: var(--danger); flex: 0 0 48px !important; }
.heure-input { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }

/* Controle des heures avant validation (180e passe) */
.tr-heures { margin-top: 8px; font-size: 12px; color: var(--gray-700); background: var(--gray-100); border-radius: 8px; padding: 8px 10px; line-height: 1.5; }
.tr-heures .tr-h-total { font-weight: 800; font-size: 13px; color: var(--dark); }
.tr-heures .tr-h-ctl { font-size: 10.5px; font-weight: 700; color: var(--warning); text-transform: uppercase; margin-left: 6px; }
.tr-heures .tr-ctrl { color: #2f855a; font-weight: 700; margin-top: 2px; }
.ctl-personne { border: 1px solid var(--gray-300); border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.ctl-nom { font-weight: 700; font-size: 13.5px; margin-bottom: 8px; display: flex; justify-content: space-between; gap: 8px; }
.ctl-ligne { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 13px; }
.ctl-ligne .ctl-jour { width: 48px; flex: none; color: var(--gray-600); font-size: 12px; }
.ctl-ligne input.heure-input { width: 70px; min-height: 40px; text-align: center; padding: 6px; border: 1px solid var(--gray-300); border-radius: 8px; font-size: 15px; }
.ctl-ligne .ctl-x { min-width: 40px; min-height: 40px; border-radius: 8px; padding: 0; }
.ctl-ligne .btn-outline { min-height: 36px; padding: 4px 10px; border-radius: 8px; font-size: 12px; margin-left: auto; }
.ctl-suppr .ctl-barre { text-decoration: line-through; color: var(--gray-500); }
.ctl-total { font-size: 14px; margin: 4px 0 12px; text-align: right; }

/* Historique des heures validees (196e passe) */
.hist-annee { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.hist-annee > div { text-align: center; }
.hist-annee .btn-outline { min-width: 44px; min-height: 44px; border-radius: 10px; }
.ha-annee { font-size: 22px; font-weight: 800; color: var(--dark); }
.ha-total { font-size: 12.5px; color: var(--gray-600); }
.hist-grille { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hist-mois { background: #fff; border: 2px solid transparent; border-radius: var(--radius-sm); padding: 9px 8px; text-align: center; cursor: pointer; min-height: 64px; }
.hist-mois.active { border-color: var(--primary); background: #ebf4ff; }
.hist-mois.vide .hm-nom, .hist-mois.vide .hm-heures { color: var(--gray-500); }
.hist-mois .hm-nom { font-size: 12px; font-weight: 700; color: var(--gray-700); text-transform: uppercase; }
.hist-mois .hm-heures { font-size: 16px; font-weight: 800; color: var(--dark); margin: 2px 0 5px; }
.hist-mois .hm-barre { height: 4px; background: var(--gray-200); border-radius: 4px; overflow: hidden; }
.hist-mois .hm-barre span { display: block; height: 100%; background: var(--primary-light); }
.hist-ticket { background: #fff; border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 9px; }
.hist-ticket .ht-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 6px; }
.hist-ticket .ht-total { font-weight: 800; font-size: 15px; color: var(--primary-dark); white-space: nowrap; }
.hist-ticket .ht-jour { display: flex; gap: 8px; font-size: 12.5px; padding: 4px 0; border-top: 1px solid var(--gray-200); align-items: baseline; }
.hist-ticket .ht-date { width: 78px; flex: none; color: var(--gray-600); }
.hist-ticket .ht-plages { flex: 1; color: var(--gray-700); }
.hist-ticket .ht-h { font-weight: 700; }
.hist-fin-mois { display: flex; justify-content: space-between; align-items: center; background: var(--primary-dark); color: #fff; border-radius: var(--radius-sm); padding: 14px 16px; margin: 12px 0; font-size: 14px; }
.hist-fin-mois b { font-size: 20px; }

/* Informations du ticket / fiche chantier consultables en cours de ticket (199e passe) */
.info-bloc { background: #fff; border-radius: var(--radius-sm); padding: 4px 14px; margin-bottom: 10px; }
.sheet .info-bloc { background: var(--gray-100); }
.info-ligne { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--gray-200); font-size: 14px; color: var(--dark); word-break: break-word; }
.info-ligne:last-child { border-bottom: 0; }
.info-ligne > i { width: 20px; flex: none; text-align: center; color: var(--primary); margin-top: 16px; }
.info-ligne > div { flex: 1; min-width: 0; }
.info-ligne small { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--gray-600); margin-bottom: 2px; }
.info-texte { font-size: 13px; color: var(--gray-700); margin-top: 3px; white-space: pre-wrap; }
.info-lien { display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; padding: 6px 10px; min-height: 36px; border-radius: 8px; background: #ebf4ff; color: var(--primary-dark); font-weight: 700; font-size: 12.5px; text-decoration: none; }
.info-chrono { background: #fff5f5; color: var(--danger); border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.info-chrono .fa-circle { font-size: 8px; }
.ticket-active .ta-infos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ticket-active .ta-infos a { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border-radius: 10px; background: #ebf4ff; color: var(--primary-dark); font-size: 13px; font-weight: 700; text-decoration: none; max-width: 100%; }
.queue-item .qi-info { background: var(--gray-200); color: var(--gray-700); border-radius: 8px; min-width: 44px; min-height: 44px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }

/* 202e passe : horaires du ticket visibles sur les cartes */
.queue-item .qi-horaire { font-size: 12px; font-weight: 700; color: var(--primary-dark); margin-top: 3px; }
.queue-item .qi-horaire i, .ticket-active .ta-horaire i, .tr-horaire i { margin-right: 4px; }
.ticket-active .ta-horaire { font-size: 13px; font-weight: 700; margin-top: 6px; opacity: .95; }
.tr-horaire { font-size: 13.5px; font-weight: 700; color: var(--primary-dark); margin-top: 8px; }

/* 202e passe : CODE COULEUR des tickets -- urgent = rouge, normal = jaune, faible = vert */
:root { --prio-rouge: #e53e3e; --prio-jaune: #ecc94b; --prio-vert: #38a169; }
.dot.prio-urgente { background: var(--prio-rouge); }
.dot.prio-normale { background: var(--prio-jaune); }
.dot.prio-basse { background: var(--prio-vert); }
.ticket-active.prio-urgente { border-color: var(--prio-rouge); }
.ticket-active.prio-normale { border-color: var(--prio-jaune); }
.ticket-active.prio-basse { border-color: var(--prio-vert); }
.prio-bord-urgente { border-left: 6px solid var(--prio-rouge) !important; background-image: linear-gradient(90deg, rgba(229,62,62,.10), transparent 45%); }
.prio-bord-normale { border-left: 6px solid var(--prio-jaune) !important; background-image: linear-gradient(90deg, rgba(236,201,75,.16), transparent 45%); }
.prio-bord-basse { border-left: 6px solid var(--prio-vert) !important; background-image: linear-gradient(90deg, rgba(56,161,105,.10), transparent 45%); }
.prio-chip { display: inline-block; padding: 5px 14px; border-radius: 999px; font-size: 14px; line-height: 1.2; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; vertical-align: middle; margin: 0 8px 4px 0; color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.ticket-active .ta-prio { margin-bottom: 4px; }
.ticket-active .ta-prio .prio-chip { font-size: 15px; padding: 6px 16px; }
.dot.prio-urgente, .dot.prio-normale, .dot.prio-basse { width: 14px; height: 14px; }
.prio-bord-urgente, .prio-bord-normale, .prio-bord-basse { border-left-width: 9px !important; }
.prio-chip-urgente { background: var(--prio-rouge); }
.prio-chip-normale { background: var(--prio-jaune); color: #3b3410; }
.prio-chip-basse { background: var(--prio-vert); }
.tr-horaire-inline { font-weight: 700; color: var(--primary-dark); }
.tr-horaire-inline i { margin-right: 3px; }
/* pastille de priorite sur sa propre ligne, au-dessus du titre (lisible d'un coup d'oeil) */
.qi-titre .prio-chip, .tr-titre .prio-chip { display: block; width: fit-content; margin: 0 0 6px 0; }

/* LE TICKET ENTIER porte la couleur de sa priorite (fond teinte + cadre colore), pas seulement la pastille */
.prio-bord-urgente { background: rgba(229,62,62,.16) !important; border: 2px solid var(--prio-rouge) !important; border-left-width: 9px !important; }
.prio-bord-normale { background: rgba(236,201,75,.26) !important; border: 2px solid var(--prio-jaune) !important; border-left-width: 9px !important; }
.prio-bord-basse   { background: rgba(56,161,105,.16) !important; border: 2px solid var(--prio-vert) !important; border-left-width: 9px !important; }
.ticket-active.prio-urgente { background: rgba(229,62,62,.14); border-width: 3px; }
.ticket-active.prio-normale { background: rgba(236,201,75,.24); border-width: 3px; }
.ticket-active.prio-basse   { background: rgba(56,161,105,.14); border-width: 3px; }
.ticket-active.paused.prio-urgente { border-color: var(--prio-rouge); }
.ticket-active.paused.prio-normale { border-color: var(--prio-jaune); }
.ticket-active.paused.prio-basse   { border-color: var(--prio-vert); }

/* 202e passe : tuiles de statut cliquables (filtres) */
.stat-tile-filtre { cursor: pointer; border: 2px solid transparent; }
.stat-tile-filtre.active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(49,130,206,.18); }

/* 202e passe : date + heure sur la meme ligne (debut, puis fin) -- comme au bureau */
.ligne-date-heure { grid-template-columns: 3fr 2fr; align-items: end; }
.ligne-date-heure input[type="date"] { min-width: 0; width: 100%; }

/* 205e passe : journal du jour -- un creneau par ligne (date + debut -> fin) */
.journal-creneau { gap: 10px; align-items: baseline; }
.journal-creneau .jr-label { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.journal-creneau .jr-time { flex: 0 0 auto; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 229e passe : repere Chantier / Atelier */
.lieu-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; vertical-align: middle; margin-right: 4px; }
.lieu-chip i { font-size: 10px; }
.lieu-chip-chantier { background: #ebf8ff; color: #2c5282; border: 1px solid #bee3f8; }
.lieu-chip-atelier { background: #fffaf0; color: #9c4221; border: 1px solid #fbd38d; }

/* 237e passe : reception de travaux (fenetre de signature, a part du rendu automatique) */
.rec-overlay { position: fixed; inset: 0; height: 100%; z-index: 9000; background: rgba(15,23,42,.55); display: flex; align-items: flex-end; justify-content: center; }
.rec-overlay .hidden { display: none !important; }
.rec-page { background: var(--gray-100); width: 100%; max-width: 560px; max-height: 96vh; max-height: 96dvh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.rec-haut { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rec-titre { font-size: 17px; font-weight: 800; }
.rec-section { background: #fff; border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.rec-label { font-size: 12px; font-weight: 700; color: var(--gray-700); margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; }
.rec-lien { background: none; border: 0; color: var(--primary); font-weight: 700; font-size: 12px; padding: 2px 4px; }
.rec-texte, .rec-champ { width: 100%; font: inherit; font-size: 14px; padding: 9px 10px; border: 1px solid var(--gray-300); border-radius: 8px; background: #fff; color: var(--dark); }
.rec-texte[readonly] { background: var(--gray-100); }
.rec-choix { display: grid; gap: 8px; }
.rec-bouton { display: flex; align-items: center; gap: 10px; text-align: left; font: inherit; font-weight: 700; font-size: 15px; padding: 13px 14px; border: 2px solid var(--gray-300); border-radius: 10px; background: #fff; color: var(--dark); }
.rec-bouton.actif { border-color: var(--primary); background: #ebf4ff; color: var(--primary-dark); }
.rec-sig { display: block; width: 100%; border: 2px dashed var(--gray-400); border-radius: 10px; background: #fff; touch-action: none; }
.rec-coche { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--gray-200); }
.rec-coche input { width: 22px; height: 22px; flex-shrink: 0; margin-top: 1px; }
.rec-pied-zone { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); background: var(--gray-100); padding: 8px 0 calc(14px + env(safe-area-inset-bottom)); z-index: 2; }   /* 241e : le bouton Enregistrer (et le message de refus) restent toujours visibles et touchables */
.rec-pied { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 8px; }
.rec-erreur { background: #fff5f5; border: 1px solid #fc8181; color: #9b2c2c; border-radius: 10px; padding: 10px 12px; font-size: 14px; font-weight: 700; margin: 4px 0 0; }
.rec-erreur i { margin-right: 6px; }
.rec-invalide { border-color: #e53e3e !important; box-shadow: 0 0 0 2px rgba(229,62,62,.25); }
.topbar .tb-action.son-attente { opacity: .55; }
.rec-aide { font-size: 12.5px; color: var(--gray-600); margin: 6px 0; line-height: 1.45; }
.rec-badge { display: inline-block; font-size: 13px; font-weight: 800; padding: 4px 10px; border-radius: 999px; margin-bottom: 6px; }
.rec-success { background: #c6f6d5; color: #22543d; } .rec-warning { background: #feebc8; color: #7b341e; } .rec-muted { background: var(--gray-200); color: var(--gray-700); }
.rec-vignette { display: block; max-width: 220px; max-height: 80px; border: 1px solid var(--gray-300); border-radius: 6px; background: #fff; margin: 6px 0; }
.rec-reserve { font-size: 13.5px; padding: 4px 0; color: #7b341e; } .rec-reserve.rec-corrige { color: var(--gray-600); text-decoration: line-through; }

/* 262e passe : bandeau d'abonnement (essai, lecture seule, paiement en retard) */
.abo-bandeau-m { position: sticky; top: 0; z-index: 50; padding: 8px 14px; font-size: 0.85rem; line-height: 1.35; text-align: center; color: #fff; background: var(--info); }
.abo-bandeau-m.abo-warning { background: var(--warning); }
.abo-bandeau-m.abo-danger { background: var(--danger-dark); }

/* 262e passe : ecran de blocage (essai gratuit termine sans formule) */
.abo-blocage { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; color: #fff; background: var(--primary-dark); }
.abo-blocage h2 { margin: 0; }
.abo-blocage p { max-width: 420px; margin: 0; line-height: 1.45; }
.abo-blocage .btn-primary { min-height: 44px; padding: 0 22px; border: 0; border-radius: 10px; background: var(--secondary); color: #fff; font-size: 16px; }
