:root {
  --alstor-primary: #34424E;
  --alstor-darkest: #05080A;
  --alstor-accent: #EA9908;
  --alstor-accent-dark: #C77F06;
  --alstor-bg: #F4F7F9;
  --alstor-border: #DCE2E7;
  --alstor-text: #1D232B;
  --alstor-text-light: #F4F7F9;
  --alstor-muted: #6B7680;
  --alstor-danger: #B3261E;
  --alstor-success: #1E6B3A;
  --alstor-info: #0288D1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Urbanist', -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 300;
  background: var(--alstor-bg);
  color: var(--alstor-text);
}

h1, h2, h3, .brand, th, label, .btn { font-weight: 600; }

.accroche {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  color: var(--alstor-accent);
}

a { color: var(--alstor-primary); }

/* --- Page de connexion --- */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--alstor-darkest);
}

.auth-logo-dark {
  display: block;
  max-width: 360px;
  width: 80%;
  margin: 0 auto 2rem;
  filter: drop-shadow(0 10px 30px rgba(0,0,0,.35));
}

.auth-card {
  background: var(--alstor-primary);
  padding: 2.5rem;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  width: 100%;
  max-width: 380px;
  color: var(--alstor-text-light);
}

.auth-card h1 {
  font-size: 1.3rem;
  margin-bottom: .25rem;
  color: #fff;
}

.auth-card p.subtitle {
  margin-top: 0;
  color: #C6D0D8;
  font-size: .9rem;
  font-weight: 300;
}

.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: .35rem; font-size: .85rem; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid var(--alstor-border);
  border-radius: 6px;
  font-size: .95rem;
  font-family: inherit;
  background: var(--alstor-bg);
  color: var(--alstor-text);
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  font-size: .82rem;
  margin-bottom: 1.25rem;
}
.checkbox-label { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; font-weight: 300; }
.checkbox-label input { accent-color: var(--alstor-accent); }
/* Cases "Règlement chez nous" / "RG" du tableau Encours client : sans
   accent-color explicite, un navigateur les affiche dans son bleu par
   défaut plutôt que dans la charte orange de l'appli. */
.cheque-checkbox, .rg-checkbox { accent-color: var(--alstor-accent); }

.link-muted { color: #C6D0D8; text-decoration: underline; }
.link-muted:hover { color: #fff; }

.auth-footer-link { text-align: center; margin: 1.25rem 0 0; font-size: .85rem; }
.auth-footer-link a { color: #C6D0D8; }
.auth-footer-link a:hover { color: #fff; }

.btn {
  display: inline-block;
  background: var(--alstor-accent);
  color: var(--alstor-darkest);
  border: none;
  padding: .6rem 1.1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: .95rem;
  text-decoration: none;
  font-family: inherit;
}
.btn:hover { background: var(--alstor-accent-dark); }
.btn-block { width: 100%; }
.btn-sm { padding: .35rem .7rem; font-size: .82rem; }

.btn-link {
  background: none;
  border: none;
  color: var(--alstor-primary);
  cursor: pointer;
  font-size: .85rem;
  text-decoration: underline;
  font-family: inherit;
  padding: 0;
}
.btn-link:hover { color: var(--alstor-accent-dark); }

.alert { padding: .7rem 1rem; border-radius: 6px; font-size: .9rem; margin-bottom: 1rem; }
.alert-error { background: #fbeceb; color: var(--alstor-danger); border: 1px solid #f2c6c3; }
.alert-success { background: #e9f5ed; color: var(--alstor-success); border: 1px solid #bfe3cb; }

/* To-do list CRM : post-it par catégorie (jamais la couleur seule — toujours
   une icône + un libellé à côté, voir templates/crm/todo.php). */
.postit { border-radius: 8px; padding: .85rem 1rem; margin-bottom: .75rem; }
.postit-retard { background: #fbeceb; border: 1px solid #f2c6c3; }
.postit-retard .postit-label { color: var(--alstor-danger); }
.postit-stagnant { background: #f1e9fb; border: 1px solid #ddc9f2; }
.postit-stagnant .postit-label { color: #6a3fa0; }
.postit-depasse { background: #fdf2df; border: 1px solid #f0dcae; }
.postit-depasse .postit-label { color: var(--alstor-accent-dark); }
.postit-label { font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }


.relance-edit-field { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; }
.relance-edit-field input, .relance-edit-field select { width: 100%; }

/* --- Application (après connexion) --- */
.page-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: var(--alstor-primary);
  color: var(--alstor-text-light);
  padding: .8rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
}
.topbar-brand:hover { color: var(--alstor-accent); }
.topbar-nav { display: flex; align-items: center; gap: .5rem; margin-left: 1.5rem; }
.topbar-nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--alstor-accent);
  border: 1px solid transparent;
}
.topbar-nav-link svg { width: 20px; height: 20px; }
.topbar-nav-link:hover, .topbar-nav-link:focus-visible {
  background: rgba(234, 153, 8, .15);
  border-color: var(--alstor-accent);
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.topbar-user { display: flex; align-items: center; gap: 1rem; }
.topbar-profile {
  display: inline-flex;
  align-items: center;
  color: var(--alstor-text-light);
  text-decoration: none;
}
.topbar-profile:hover { color: #fff; text-decoration: underline; }
.topbar .role-badge {
  background: var(--alstor-accent);
  color: var(--alstor-darkest);
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  margin-left: .5rem;
}
.topbar form { display: inline; }
.topbar .btn-link {
  background: none; border: none; color: #D8E0E6; cursor: pointer; font-size: .85rem; text-decoration: underline;
  font-family: inherit;
}
.topbar .btn-link:hover { color: #fff; }

.content { padding: 2rem 1.75rem; flex: 1; background: var(--alstor-bg); }
.content h1 { color: var(--alstor-primary); margin-top: 0; }

.breadcrumb { font-size: .85rem; color: var(--alstor-muted); margin-bottom: .5rem; }
.breadcrumb a { color: var(--alstor-primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { margin: 0 .4rem; }

/* --- Grille de modules (page d'accueil) --- */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.25rem;
  max-width: 780px;
  margin: 2rem auto 0;
}
.module-tile {
  background: var(--alstor-primary);
  color: var(--alstor-text-light);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 1.75rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.module-tile:hover, .module-tile:focus-visible {
  border-color: var(--alstor-accent);
  transform: translateY(-2px);
}
.module-tile-icon { width: 40px; height: 40px; color: var(--alstor-accent); }
.module-tile-label { font-weight: 600; }
.module-tile-readonly { font-size: .72rem; font-weight: 300; opacity: .75; }

.card { background: #fff; border: 1px solid var(--alstor-border); border-radius: 8px; padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; }

.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--alstor-border); }
th { color: var(--alstor-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }

/* Table "Historique des chiffres" (Suivi activité) : peu de colonnes très
   courtes (S30, S31…) à côté d'une colonne de libellés — en table-layout
   auto, la largeur inutilisée se répartit en priorité sur la première
   colonne (déjà la plus large), ce qui pousse les chiffres loin à droite. */
.table-historique { table-layout: fixed; }
.table-historique th:first-child, .table-historique td:first-child { width: 230px; }

/* CRM, vue liste : même souci qu'au-dessus — sans largeurs explicites, la
   colonne Client s'étale trop et éloigne la colonne N° devis. */
.table-crm-liste { table-layout: fixed; }
.table-crm-liste th:nth-child(1), .table-crm-liste td:nth-child(1) { width: 9%; }
.table-crm-liste th:nth-child(2), .table-crm-liste td:nth-child(2) { width: 13%; }
.table-crm-liste th:nth-child(3), .table-crm-liste td:nth-child(3) { width: 7%; }
.table-crm-liste th:nth-child(4), .table-crm-liste td:nth-child(4) { width: 7%; }
.table-crm-liste th:nth-child(5), .table-crm-liste td:nth-child(5) { width: 9%; }
.table-crm-liste th:nth-child(6), .table-crm-liste td:nth-child(6) { width: 7%; }
.table-crm-liste th:nth-child(7), .table-crm-liste td:nth-child(7) { width: 15%; }
.table-crm-liste th:nth-child(8), .table-crm-liste td:nth-child(8) { width: 5%; }

.inline-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem;
  font-size: .85rem;
}
.rh-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.rh-toolbar-exports { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.inline-form select {
  padding: .35rem .5rem;
  border: 1px solid var(--alstor-border);
  border-radius: 6px;
  font-family: inherit;
  font-size: .85rem;
  background: #fff;
  color: var(--alstor-text);
}

.salarie-chip {
  display: inline-block;
  background: var(--alstor-bg);
  border: 1px solid var(--alstor-border);
  color: var(--alstor-primary);
  padding: .45rem 1rem;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.salarie-chip:hover { border-color: var(--alstor-accent); color: var(--alstor-accent-dark); }
.salarie-chip-actif, .salarie-chip-actif:hover {
  background: var(--alstor-primary);
  border-color: var(--alstor-primary);
  color: var(--alstor-text-light);
}

/* Documents CRM (fiche devis) — carte par fichier avec pastille de score
   bien visible pour les notes de performance commerciale. */
.doc-card {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem .9rem; border: 1px solid var(--alstor-border); border-radius: 8px;
  margin-bottom: .6rem; background: #fff;
}
.doc-card-icon { font-size: 1.4rem; line-height: 1; flex-shrink: 0; }
.doc-card-body { flex: 1; min-width: 0; }
.doc-card-title {
  font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--alstor-primary);
}
.doc-card-meta { color: var(--alstor-muted); font-size: .78rem; margin-top: .15rem; }
.doc-score {
  flex-shrink: 0; text-align: center; border-radius: 10px; padding: .3rem .65rem;
  font-weight: 700; font-size: 1.05rem; line-height: 1.1;
}
.doc-score small { display: block; font-weight: 400; font-size: .62rem; opacity: .85; }
.doc-score-high { background: #e9f5ed; color: var(--alstor-success); }
.doc-score-mid { background: #fdf2df; color: var(--alstor-accent-dark); }
.doc-score-low { background: #fbeceb; color: var(--alstor-danger); }
/* Version compacte pour la colonne Score de la vue liste. */
.doc-score-inline { padding: .1rem .5rem; border-radius: 999px; font-weight: 700; font-size: .78rem; }

.badge { padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-a_planifier { background: #fdf2df; color: #8a5a12; }
.badge-en_cours { background: #e1eefc; color: #1a5fa8; }
.badge-termine { background: #e9f5ed; color: var(--alstor-success); }
.badge-suspendu { background: #fbeceb; color: var(--alstor-danger); }

.badge-commercial-xan { background: #fbe4ec; color: #a8285a; }
.badge-commercial-lucas { background: #e1eefc; color: #1a5fa8; }
.badge-commercial-alan { background: #fdf2df; color: #8a5a12; }
.badge-commercial-william { background: #e9f5ed; color: var(--alstor-success); }

.badge-type-sav_dep { background: #fdf2df; color: #8a5a12; }
.badge-type-pose { background: #fbeceb; color: var(--alstor-danger); }

/* Appel client : ligne sans aucune modification depuis 48h (voir
   App\Core\AppelClientRappel) — liseré + fond pâle pour repérer ces
   lignes d'un coup d'œil dans le tableau, sans se confondre avec les
   couleurs des badges de type. */
.appel-ligne-retard { border-left: 4px solid var(--alstor-danger); background: #fffaf3; }

.badge-cdi { background: #e9f5ed; color: var(--alstor-success); }

.badge-ppsp-brouillon { background: #eceef1; color: var(--alstor-muted); }
.badge-ppsp-a_controler { background: #fdf2df; color: #8a5a12; }
.badge-ppsp-valide { background: #e9f5ed; color: var(--alstor-success); }
.badge-ppsp-archive { background: #fbeceb; color: var(--alstor-danger); }

.ppsp-filtres { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; }
.ppsp-filtres .field { flex: 1 1 140px; min-width: 120px; margin-bottom: 0; }
.ppsp-filtres .field:last-child { flex: 0 0 auto; white-space: nowrap; }

.ppsp-travaux-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem 1rem; margin-bottom: 1rem; }
.ppsp-travaux-item { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
@media (max-width: 900px) { .ppsp-travaux-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .ppsp-travaux-grid { grid-template-columns: 1fr; } }
.badge-cdd { background: #e1eefc; color: #1a5fa8; }
.badge-apprenti { background: #fdf2df; color: #8a5a12; }
.badge-present { background: #e9f5ed; color: var(--alstor-success); }
.badge-parti { background: #eceff1; color: var(--alstor-muted); }

/* --- CRM Devis : statuts du pipeline --- */
.badge-crm-lead { background: #eceff1; color: var(--alstor-muted); }
.badge-crm-chiffrage { background: #e1eefc; color: #1a5fa8; }
.badge-crm-envoye { background: #f0eafc; color: #6b3fa0; }
.badge-crm-relance { background: #fdf2df; color: #8a5a12; }
.badge-crm-gagne { background: #e9f5ed; color: var(--alstor-success); }
.badge-crm-perdu { background: #fbeceb; color: var(--alstor-danger); }
.badge-annotation-probleme_comportement { background: #fbeceb; color: var(--alstor-danger); }
.badge-annotation-erreur_poste { background: #fdf2df; color: #8a5a12; }
.badge-annotation-absence_non_justifiee { background: #fbeceb; color: var(--alstor-danger); }
.badge-annotation-reussite_individuelle { background: #e9f5ed; color: var(--alstor-success); }
.badge-annotation-fin_journee_anticipee { background: #e1eefc; color: #1a5fa8; }
.badge-annotation-rdv_direction { background: #ede7f6; color: #5e35b1; }

.badge-categorie-paie { background: #e1eefc; color: #1a5fa8; }
.badge-categorie-avoir { background: #fdf2df; color: #8a5a12; }
.badge-categorie-rh { background: #e9f5ed; color: var(--alstor-success); }
.badge-categorie-support_cj { background: #f1e7fb; color: #6a3fa0; }
.badge-categorie-support_lea { background: #e0f5f3; color: #0f766e; }
.badge-categorie-sav { background: #fde8d2; color: #b35900; }
.badge-categorie-dep { background: #e4e7fb; color: #3f4a8a; }
.badge-categorie-fin_chantier { background: #eaf5df; color: #4d7c0f; }
.badge-categorie-assurance { background: #fbeceb; color: var(--alstor-danger); }
.badge-categorie-autre { background: #eceff1; color: var(--alstor-muted); }

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-tile {
  background: #fff;
  border: 1px solid var(--alstor-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.stat-tile-value { font-size: 1.4rem; font-weight: 600; color: var(--alstor-primary); }
.stat-tile-label { font-size: .78rem; color: var(--alstor-muted); text-transform: uppercase; letter-spacing: .03em; }
.stat-tile-annotations { grid-column: span 2; min-width: 0; }
.stat-tile-annotations-scroll { max-height: 140px; overflow-y: auto; }
.stat-tile-annotations-scroll table { font-size: .78rem; }
.stat-tile-annotations-scroll th, .stat-tile-annotations-scroll td { padding: .3rem .4rem; }
.stat-tile-annotations-scroll td:last-child { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

details.card summary { cursor: pointer; font-weight: 600; color: var(--alstor-primary); list-style: none; }
details.card summary::-webkit-details-marker { display: none; }
details.card[open] summary { margin-bottom: 1rem; }

/* Petit bouton qui déplie un panneau de formulaire juste en dessous (ex.
   tuile Process, "+ Déposer un process" / "+ Créer une catégorie") — le
   bouton reste compact, le panneau prend la largeur qu'il lui faut. */
.dropdown-details summary { list-style: none; cursor: pointer; }
.dropdown-details summary::-webkit-details-marker { display: none; }
.dropdown-panel {
  background: #fff; border: 1px solid var(--alstor-border); border-radius: 8px;
  padding: 1rem; margin-top: .5rem; min-width: 26rem; max-width: 100%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}

th a { color: inherit; text-decoration: none; }
th a:hover { text-decoration: underline; }

.rh-input { width: 6rem; padding: .3rem .4rem; font-size: .82rem; border: 1px solid var(--alstor-border); border-radius: 4px; font-family: inherit; }
.rh-input-narrow { width: 4.5rem; }

.annotation-plus { cursor: pointer; color: var(--alstor-accent-dark); font-weight: 700; margin-left: .3rem; list-style: none; }
.annotation-plus::-webkit-details-marker { display: none; }
.annotation-quick {
  background: var(--alstor-bg);
  border: 1px solid var(--alstor-border);
  border-radius: 6px;
  padding: .6rem;
  margin-top: .3rem;
  min-width: 420px;
}
.annotation-quick select, .annotation-quick textarea {
  display: block;
  width: 100%;
  margin-bottom: .4rem;
  font-size: .82rem;
  padding: .35rem;
  border: 1px solid var(--alstor-border);
  border-radius: 4px;
  font-family: inherit;
}
.annotation-quick a { display: inline-block; margin-top: .3rem; font-size: .8rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; align-items: end; }
@media (max-width: 700px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .modules-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* --- Module Plan de resa --- */
.cascade-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: start; }
.cascade-row > .field { flex: 1 1 150px; min-width: 150px; }
.repere-layout { display: flex; flex-wrap: wrap; gap: 1.75rem; align-items: start; margin-top: 1rem; }
.repere-layout[hidden] { display: none; }
.repere-layout .visuel-col { flex: 2 1 640px; min-width: 320px; }
.repere-layout .fiche-col { flex: 1 1 260px; min-width: 220px; max-width: 320px; }
.repere-layout .fiche-col .field { margin-bottom: 1rem; }
.schema-visuel img { max-width: 1000px; width: 100%; border: 1px solid var(--alstor-border); border-radius: 8px; display: block; }
.schema-visuel figcaption { color: var(--alstor-muted); font-size: .82rem; margin-top: .35rem; }

.carousel-overlay {
  position: fixed; inset: 0; background: rgba(20, 26, 32, .95); z-index: 1000;
  align-items: center; justify-content: center; padding: 2rem;
}
.carousel-overlay:not([hidden]) { display: flex; }
.carousel-content { max-width: 1100px; width: 100%; max-height: 90vh; overflow-y: auto; text-align: center; }
.carousel-content h2 { color: #fff; margin: 0 0 .25rem; }
.carousel-content img { max-width: 100%; max-height: 60vh; border-radius: 8px; background: #fff; }
.carousel-dims { color: #fff; display: flex; gap: 1.5rem; justify-content: center; margin: 1rem 0 .5rem; flex-wrap: wrap; font-size: 1.05rem; }
.carousel-observation { color: #D8E0E6; max-width: 700px; margin: 0 auto; }
.carousel-position { color: var(--alstor-muted); margin-top: .5rem; }
.carousel-arrow {
  background: rgba(255,255,255,.12); border: none; color: #fff; font-size: 2rem; line-height: 1;
  width: 56px; height: 56px; border-radius: 50%; cursor: pointer; flex-shrink: 0;
}
.carousel-arrow:hover { background: rgba(255,255,255,.25); }
.carousel-close {
  position: absolute; top: 1.25rem; right: 1.5rem; background: none; border: none;
  color: #fff; font-size: 2rem; line-height: 1; cursor: pointer;
}

/* --- Module Photo --- */
.photo-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.photo-cat-card {
  position: relative;
  display: block;
  height: 140px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--alstor-primary);
  text-decoration: none;
  border: 2px solid transparent;
}
.photo-cat-card:hover, .photo-cat-card:focus-visible { border-color: var(--alstor-accent); }
.photo-cat-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .45; }
.photo-cat-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
  color: var(--alstor-text-light); text-align: center; padding: .5rem;
}
.photo-cat-icon { width: 32px; height: 32px; color: var(--alstor-accent); }
.photo-cat-label { font-weight: 600; }
.photo-cat-count { font-size: .78rem; opacity: .85; }

.photo-toolbar { margin-bottom: .8rem; }
.photo-reorder-hint { color: var(--alstor-muted); font-size: .82rem; margin: 0 0 .6rem; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .8rem;
}
.photo-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
}
.photo-tile[draggable="true"] { cursor: grab; }
.photo-tile.dragging { opacity: .4; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile-check {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px;
  border-radius: 50%; background: rgba(255,255,255,.85); color: var(--alstor-primary);
  align-items: center; justify-content: center; font-size: .8rem; font-weight: 700;
  display: none;
}
.photo-grid-selectmode .photo-tile-check { display: flex; }
.photo-grid-selectmode .photo-tile { border-color: var(--alstor-border); }
.photo-tile.selected { border-color: var(--alstor-accent); }
.photo-tile.selected .photo-tile-check { background: var(--alstor-accent); color: var(--alstor-darkest); }
.photo-tile-cover {
  position: absolute; top: 6px; left: 6px; width: 22px; height: 22px;
  border-radius: 50%; background: rgba(5,8,10,.65); color: var(--alstor-accent);
  display: flex; align-items: center; justify-content: center; font-size: .85rem;
}

.photo-bulkbar {
  position: sticky; bottom: 0;
  margin-top: 1rem; padding: .8rem 1rem;
  background: var(--alstor-primary); color: var(--alstor-text-light);
  border-radius: 8px;
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
}
.photo-bulkbar[hidden] { display: none; }
.photo-bulkbar select { padding: .3rem .5rem; border-radius: 6px; border: 1px solid var(--alstor-border); }

.photo-modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.photo-modal[hidden] { display: none; }
.photo-modal-backdrop { position: absolute; inset: 0; background: rgba(5,8,10,.8); }
.photo-modal-content {
  position: relative; background: #fff; border-radius: 10px; padding: 1.2rem;
  max-width: min(90vw, 900px); max-height: 90vh; overflow: auto;
  display: flex; flex-direction: column; gap: 1rem; align-items: center;
}
.photo-modal-content img { max-width: 100%; max-height: 65vh; border-radius: 6px; }
.photo-modal-close {
  position: absolute; top: .5rem; right: .7rem; background: none; border: none;
  font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--alstor-muted);
}
.photo-modal-actions { display: flex; gap: .8rem; flex-wrap: wrap; justify-content: center; }
.photo-modal-actions form { display: flex; gap: .4rem; align-items: center; }
.photo-modal-actions select { padding: .3rem .5rem; border-radius: 6px; border: 1px solid var(--alstor-border); }

.photo-modal-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 210;
  width: 46px; height: 46px; border-radius: 50%; border: none;
  background: rgba(5,8,10,.55); color: #fff; font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.photo-modal-nav:hover, .photo-modal-nav:focus-visible { background: rgba(5,8,10,.8); }
.photo-modal-nav[hidden] { display: none; }
.photo-modal-prev { left: 2vw; }
.photo-modal-next { right: 2vw; }

/* --- Chantiers Eric (suivi activité) --- */
.chantiers-eric-table { width: 100%; border-collapse: collapse; }
.chantiers-eric-table th, .chantiers-eric-table td { padding: .4rem .5rem; border-bottom: 1px solid var(--alstor-border); text-align: left; vertical-align: middle; }
.chantiers-eric-table .col-nom { max-width: 160px; overflow-wrap: break-word; }
.chantiers-eric-table th.col-statut, .chantiers-eric-statut-cell { width: 110px; }
.chantiers-eric-statut-cell { padding: 0; text-align: center; }
.chantiers-eric-statut-btn {
  width: 100%; height: 2rem; border: none; cursor: pointer; display: block;
  background: transparent;
}
.chantiers-eric-statut-btn:hover { background: var(--alstor-border); opacity: .5; }
.chantiers-eric-statut-btn.actif { opacity: 1; }
.chantiers-eric-statut-btn.actif.statut-ok { background: var(--alstor-success); }
.chantiers-eric-statut-btn.actif.statut-resolu { background: var(--alstor-info); }
.chantiers-eric-statut-btn.actif.statut-non_resolu { background: var(--alstor-danger); }
/* Responsable + Description : élargis (demande Clément, trop tassés à
   droite du tableau) — le tableau déborde alors dans .table-scroll plutôt
   que de re-tasser les colonnes précédentes. */
.chantiers-eric-table th.col-responsable, .chantiers-eric-table td.col-responsable { min-width: 220px; }
.chantiers-eric-table th.col-description, .chantiers-eric-table td.col-description { min-width: 420px; }
.chantiers-eric-responsable-select { min-width: 180px; }
.chantiers-eric-fournisseur-input { width: 100%; margin-top: .3rem; padding: .25rem .4rem; font-size: .82rem; border: 1px solid var(--alstor-border); border-radius: 4px; }
.chantiers-eric-description-input { width: 100%; min-height: 3.5rem; padding: .4rem .5rem; font-size: .88rem; border: 1px solid var(--alstor-border); border-radius: 4px; resize: vertical; font-family: inherit; }

/* --- Bandeau de navigation par semaine (suivi activité) --- */
.nav-semaine {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.2rem; height: 1.9rem; border-radius: 6px; font-size: .8rem;
  text-decoration: none; color: var(--alstor-text); background: var(--alstor-bg);
  border: 1px solid var(--alstor-border);
}
.nav-semaine:hover { border-color: var(--alstor-accent); }
.nav-semaine-affichee { border: 2px solid var(--alstor-primary); font-weight: 700; }
.nav-semaine-actuelle { background: var(--alstor-accent); color: #fff; font-weight: 700; border-color: var(--alstor-accent); }

/* --- Gestion des salariés : panneau focalisé (Mon compte) --- */
.perm-panel { display: grid; grid-template-columns: 260px 1fr; gap: 0; margin: 0 -1.5rem; border-top: 1px solid var(--alstor-border); }
.perm-side { border-right: 1px solid var(--alstor-border); padding: 1rem; }
.perm-search { width: 100%; margin-bottom: .75rem; }
.perm-emp-list { display: flex; flex-direction: column; gap: .15rem; max-height: 32rem; overflow-y: auto; }
.perm-emp-item {
  display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left;
  border: none; background: transparent; border-radius: 8px; padding: .5rem .6rem;
  cursor: pointer; font: inherit; color: inherit;
}
.perm-emp-item:hover { background: var(--alstor-bg); }
.perm-emp-item.actif { background: var(--alstor-accent); color: #fff; }
.perm-emp-item[hidden] { display: none; }
.perm-avatar {
  flex-shrink: 0; width: 1.9rem; height: 1.9rem; border-radius: 7px; display: flex;
  align-items: center; justify-content: center; font-size: .72rem; font-weight: 700;
  background: #fdf2df; color: var(--alstor-accent-dark);
}
.perm-emp-item.actif .perm-avatar { background: rgba(255,255,255,.25); color: #fff; }
.perm-emp-name { flex: 1; font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perm-emp-count { font-size: .72rem; color: var(--alstor-muted); }
.perm-emp-item.actif .perm-emp-count { color: rgba(255,255,255,.85); }
.perm-main { padding: 1.25rem 1.5rem; }
.perm-detail[hidden] { display: none; }
.perm-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem; margin-bottom: 1rem; }
.perm-detail-head .perm-avatar { width: 2.6rem; height: 2.6rem; border-radius: 10px; font-size: 1rem; }
.perm-detail-head .perm-id { display: flex; flex-direction: column; gap: .15rem; }
.perm-detail-head .perm-email { font-size: .8rem; color: var(--alstor-muted); }
.perm-detail-head input[name="nom"] { font-size: 1rem; font-weight: 700; padding: .3rem .5rem; }
.perm-detail-toggles { display: flex; gap: 1.25rem; margin-left: auto; }
.perm-cat { margin-bottom: 1.4rem; }
.perm-cat-title {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--alstor-muted);
  font-weight: 700; margin-bottom: .5rem; padding-bottom: .3rem; border-bottom: 1px solid var(--alstor-border);
}
.perm-mod-row { display: flex; align-items: center; gap: 1rem; padding: .45rem 0; flex-wrap: wrap; }
.perm-mod-row .perm-mod-name { flex: 1; min-width: 10rem; font-size: .88rem; }
.perm-seg { display: inline-flex; border: 1px solid var(--alstor-border); border-radius: 8px; overflow: hidden; }
.perm-seg-label {
  font-size: .74rem; font-weight: 700; padding: .35rem .6rem; cursor: pointer;
  color: var(--alstor-muted); border-right: 1px solid var(--alstor-border); white-space: nowrap;
}
.perm-seg-label:last-of-type { border-right: none; }
.perm-seg-input:checked + .perm-seg-label-none { background: var(--alstor-bg); color: var(--alstor-muted); }
.perm-seg-input:checked + .perm-seg-label-read { background: #e3f2fb; color: var(--alstor-info); }
.perm-seg-input:checked + .perm-seg-label-write { background: #e9f5ed; color: var(--alstor-success); }
.perm-seg-input:focus-visible + .perm-seg-label { outline: 2px solid var(--alstor-accent); outline-offset: -2px; }
.perm-restricted { font-size: .8rem; color: var(--alstor-danger); font-style: italic; }
.perm-admin-note { color: var(--alstor-muted); font-style: italic; font-size: .88rem; }
.perm-actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px dashed var(--alstor-border); }
@media (max-width: 760px) {
  .perm-panel { grid-template-columns: 1fr; margin: 0; }
  .perm-side { border-right: none; border-bottom: 1px solid var(--alstor-border); }
}
