/* =============================================================
   Thème « Atlantique Services » — outil métier de gestion
   d'interventions. Esthétique logiciel : gris ardoise, blanc,
   accent orange sécurité. Zéro ressource externe.
   ============================================================= */

:root {
  --m-accent: #C2410C;          /* orange sécurité — boutons, statuts actifs */
  --m-accent-clair: #FFE3D0;
  --m-fonce: #14191E;           /* anthracite — en-tête, pieds de tableau */
  --m-nav-fond: #1E252C;
  --m-fond: #EEF1F4;            /* fond interface, gris clair */
  --m-surface: #E4E8EC;
  --m-carte: #FFFFFF;
  --m-ligne: #D3D9DF;
  --m-texte: #191E23;
  --m-doux: #58616C;
  --m-pied: #E4E8EC;
  --m-rayon: 8px;
  --m-titre: 'Sora', system-ui, sans-serif;
  --m-quote: 'Manrope', system-ui, sans-serif;

  /* Types d'intervention (utilisés dans le planning) */
  --t-depannage: #FBDDC7;
  --t-depannage-bord: #C2410C;
  --t-maintenance: #E0E5EA;
  --t-maintenance-bord: #77828F;
  --t-installation: #DCE8D9;
  --t-installation-bord: #4C7A45;
  --t-devis: #E4DFF0;
  --t-devis-bord: #63579A;
}

body { background: var(--m-fond); }

/* L'en-tête du socle est prévu pour un site clair : on le passe en anthracite. */
.site { border-bottom: 1px solid #10151A; box-shadow: 0 2px 10px rgba(15, 20, 25, .12); }
.site__barre { gap: 16px; }
.logo__pastille { box-shadow: inset 0 0 0 5px rgba(255, 255, 255, .16); }
.logo__texte b { color: #FFFFFF; }
.logo__texte small { color: #9AA4B0; letter-spacing: .04em; text-transform: uppercase; font-size: .66rem; }
.nav { gap: 20px; }
.nav a { color: #AEB7C1; font-weight: 600; white-space: nowrap; }
.nav a:hover { color: #FFFFFF; }
.nav a[aria-current="page"] { color: #FFFFFF; }
.nav a[aria-current="page"]::after {
  content: '';
  display: block;
  height: 3px;
  margin-top: 5px;
  border-radius: 3px;
  background: var(--m-accent);
}
.btn { border-radius: 6px; }
.btn--fantome { background: var(--m-surface); }

.enveloppe { max-width: 1160px; }
section { padding-block: clamp(18px, 2.6vw, 30px); }
section + section { border-top: 0; }

/* Utilitaire d'accessibilité */
.visuellement-cache {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ============================ BARRE DE CONTEXTE ============================ */
.barre-contexte { background: var(--m-carte); border-bottom: 1px solid var(--m-ligne); }
.contexte { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding-block: 14px; }
.contexte__identite { display: flex; align-items: center; gap: 12px; }
.contexte__avatar {
  width: 42px; height: 42px; border-radius: 6px; flex: none;
  background: var(--m-fonce); color: #fff;
  display: grid; place-items: center;
  font-family: var(--m-titre); font-weight: 800; font-size: .82rem; letter-spacing: .04em;
}
.contexte__identite b { display: block; font-family: var(--m-titre); font-size: .98rem; letter-spacing: -.01em; }
.contexte__identite span { display: block; font-size: .82rem; color: var(--m-doux); }
.contexte__actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 10px; }

/* ============================ PANNEAUX ============================ */
.grille-outils { display: grid; gap: 18px; }
.pile { display: grid; gap: 18px; }
.grille-outils--2 { grid-template-columns: 1.55fr 1fr; align-items: start; }
.grille-outils--large { grid-template-columns: 1fr; }

.panneau { background: var(--m-carte); border: 1px solid var(--m-ligne); border-radius: var(--m-rayon); overflow: hidden; }
.panneau__tete {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 18px; border-bottom: 1px solid var(--m-ligne);
  background: #F7F9FA;
}
.panneau__tete h2 { margin: 0; font-size: .98rem; letter-spacing: -.01em; }
.panneau__tete p { margin: 0; font-size: .8rem; color: var(--m-doux); }
.panneau__tete .lien-clair { margin-left: auto; font-size: .86rem; white-space: nowrap; }
.panneau__corps { padding: 18px; }
.panneau__corps--plein { padding: 0; }
.panneau__pied {
  padding: 12px 18px; border-top: 1px solid var(--m-ligne); background: #F7F9FA;
  font-size: .84rem; color: var(--m-doux);
}

/* ============================ INDICATEURS ============================ */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { background: var(--m-carte); border: 1px solid var(--m-ligne); border-radius: var(--m-rayon); padding: 16px; }
.kpi__haut { display: flex; align-items: center; gap: 8px; color: var(--m-doux); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.kpi__haut svg { flex: none; }
.kpi__valeur { font-family: var(--m-titre); font-weight: 800; font-size: 1.9rem; line-height: 1.1; margin: 10px 0 2px; letter-spacing: -.03em; }
.kpi__valeur small { font-family: var(--m-quote); font-size: .82rem; font-weight: 600; color: var(--m-doux); letter-spacing: 0; }
.kpi__delta { font-size: .8rem; color: var(--m-doux); }
.kpi__delta b { color: #1E6B45; }
.kpi__jauge { height: 6px; border-radius: 999px; background: var(--m-surface); margin-top: 12px; overflow: hidden; }
.kpi__jauge i { display: block; height: 100%; border-radius: 999px; background: var(--m-accent); }
.kpi__jauge--w88 i { width: 88%; }
.kpi__jauge--w29 i { width: 29%; }
.kpi__jauge--w43 i { width: 43%; }
.kpi__jauge--w81 i { width: 81%; }
.kpi__jauge--gris i { background: #8B95A1; }
.kpi__jauge--vert i { background: #3D8E63; }

/* ============================ LISTES ============================ */
.liste-todo { list-style: none; margin: 0; padding: 0; }
.todo {
  display: grid; grid-template-columns: 58px 1fr auto; gap: 12px; align-items: center;
  padding: 13px 18px; border-bottom: 1px solid var(--m-ligne);
}
.todo:last-child { border-bottom: 0; }
.todo__heure { font-family: var(--m-titre); font-weight: 700; font-size: .9rem; }
.todo__titre { font-weight: 600; font-size: .95rem; }
.todo__meta { font-size: .82rem; color: var(--m-doux); }
.todo__ref { font-family: var(--m-titre); font-size: .76rem; color: var(--m-doux); letter-spacing: .02em; }

.pastille {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .74rem; font-weight: 700; padding: 5px 11px; border-radius: 999px; white-space: nowrap;
}
.pastille::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.pastille--attente { background: #EDEFF2; color: #4A535D; }
.pastille--encours { background: #FCE3D3; color: #A93A0B; }
.pastille--terminee { background: #DCEADF; color: #1E6B45; }
.pastille--reportee { background: #E5E0F0; color: #4B3F73; }

.activite { list-style: none; margin: 0; padding: 0; }
.activite li { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--m-ligne); }
.activite li:last-child { border-bottom: 0; }
.activite__point { width: 9px; height: 9px; border-radius: 50%; background: var(--m-accent); margin-top: 8px; }
.activite__point--gris { background: #97A1AC; }
.activite__texte { font-size: .9rem; }
.activite__texte b { font-weight: 700; }
.activite__horodatage { font-family: var(--m-titre); font-size: .76rem; color: var(--m-doux); }

/* Tournée du jour */
.tournee { list-style: none; margin: 0; padding: 0; }
.tournee li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--m-ligne); }
.tournee li:last-child { border-bottom: 0; }
.tournee__etape { width: 24px; height: 24px; border-radius: 50%; background: var(--m-fonce); color: #fff; display: grid; place-items: center; font-family: var(--m-titre); font-size: .74rem; font-weight: 700; }
.tournee__etape--encours { background: var(--m-accent); }
.tournee__nom { font-size: .92rem; font-weight: 600; }
.tournee__meta { font-size: .8rem; color: var(--m-doux); }
.tournee__km { font-size: .78rem; color: var(--m-doux); white-space: nowrap; }

/* ============================ PLANNING ============================ */
.outils-planning { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.outils-planning .champ { display: grid; gap: 4px; }
.outils-planning label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--m-doux); font-weight: 700; }
.outils-planning select, .outils-planning input {
  font: inherit; font-size: .9rem; padding: 9px 11px; min-height: 44px;
  border: 1.5px solid var(--m-ligne); border-radius: 6px; background: #fff; color: inherit;
}
.outils-planning__droite { margin-left: auto; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.resume-planning { display: flex; gap: 16px; flex-wrap: wrap; }
.resume-planning div { font-size: .82rem; color: var(--m-doux); }
.resume-planning b { display: block; font-family: var(--m-titre); font-size: 1.05rem; color: var(--m-texte); }

.tableau-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-planning { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .84rem; min-width: 780px; }
.table-planning th, .table-planning td { border-bottom: 1px solid var(--m-ligne); padding: 9px 10px; text-align: left; vertical-align: top; }
.table-planning thead th {
  background: var(--m-fonce); color: #fff;
  font-family: var(--m-titre); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  border-bottom: 0;
}
.table-planning thead th span { display: block; font-family: var(--m-quote); font-size: .72rem; font-weight: 500; letter-spacing: 0; text-transform: none; color: #AEB7C1; }
.table-planning thead th.aujourdhui { background: var(--m-accent); }
.table-planning thead th.aujourdhui span { color: #FFE3D0; }
.table-planning tbody th[scope="row"] {
  position: sticky; left: 0; z-index: 1; background: var(--m-carte);
  font-family: var(--m-titre); font-size: .86rem; font-weight: 700; min-width: 150px;
  border-right: 1px solid var(--m-ligne);
}
.table-planning tbody th[scope="row"] span { display: block; font-family: var(--m-quote); font-size: .74rem; font-weight: 500; color: var(--m-doux); }
.table-planning tbody tr:nth-child(even) th[scope="row"] { background: #F7F9FA; }
.table-planning tbody tr:nth-child(even) td { background: #FBFCFD; }
.table-planning td.aujourdhui { background: #FFF8F3; }
.table-planning tbody tr:nth-child(even) td.aujourdhui { background: #FFF4EB; }
.table-planning tbody tr:last-child th[scope="row"], .table-planning tbody tr:last-child td { border-bottom: 0; }

.case { display: block; border-radius: 6px; padding: 7px 9px; border-left: 3px solid transparent; }
.case__heure { display: block; font-family: var(--m-titre); font-weight: 700; font-size: .78rem; }
.case__lib { display: block; font-size: .76rem; line-height: 1.35; color: #2B323A; }
.case--depannage { background: var(--t-depannage); border-left-color: var(--t-depannage-bord); }
.case--maintenance { background: var(--t-maintenance); border-left-color: var(--t-maintenance-bord); }
.case--installation { background: var(--t-installation); border-left-color: var(--t-installation-bord); }
.case--devis { background: var(--t-devis); border-left-color: var(--t-devis-bord); }
.case--conge { background: repeating-linear-gradient(135deg, #E9ECEF 0 6px, #E2E6EA 6px 12px); color: var(--m-doux); font-size: .78rem; padding: 9px; border-radius: 6px; }
.case--empile { margin-top: 6px; }

.legende { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.legende span { display: inline-flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--m-doux); }
.legende i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border-left: 3px solid transparent; flex: none; }
.legende i.case--depannage { background: var(--t-depannage); border-left-color: var(--t-depannage-bord); }
.legende i.case--maintenance { background: var(--t-maintenance); border-left-color: var(--t-maintenance-bord); }
.legende i.case--installation { background: var(--t-installation); border-left-color: var(--t-installation-bord); }
.legende i.case--devis { background: var(--t-devis); border-left-color: var(--t-devis-bord); }
.legende i.case--absence { background: repeating-linear-gradient(135deg, #E9ECEF 0 4px, #E2E6EA 4px 8px); }

/* ============================ SAISIE TERRAIN ============================ */
.saisie { display: grid; gap: 18px; }
.saisie__grille { display: grid; grid-template-columns: 1.4fr .9fr; gap: 18px; align-items: start; }
.bloc-champs { background: var(--m-carte); border: 1px solid var(--m-ligne); border-radius: var(--m-rayon); padding: 18px; }
.bloc-champs h2 { font-size: .95rem; margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--m-ligne); }
.champ-groupe { display: grid; gap: 16px; }
.champ-label { font-family: var(--m-titre); font-size: .84rem; font-weight: 700; }
.aide { font-size: .8rem; color: var(--m-doux); }
.marge-haut { margin-top: 14px; }
.champ input, .champ select, .champ textarea { font-size: 1rem; padding: 14px; border-radius: 6px; }
.champ textarea { min-height: 170px; line-height: 1.55; }
.champ small { font-size: .8rem; }
.range-duree { display: flex; flex-wrap: wrap; gap: 8px; }
.range-duree button {
  min-height: 48px; padding: 0 18px; border-radius: 999px;
  border: 1.5px solid var(--m-ligne); background: #fff;
  font-family: var(--m-titre); font-weight: 700; font-size: .9rem;
}
.range-duree button[aria-pressed="true"] { background: var(--m-accent); border-color: var(--m-accent); color: #fff; }
.zone-photos { display: grid; gap: 12px; justify-items: start; }
.bouton-fichier {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1.5px dashed #97A1AC; background: var(--m-surface);
  padding: 14px 18px; border-radius: var(--m-rayon);
  font-family: var(--m-titre); font-weight: 700; font-size: .95rem; cursor: pointer;
}
.fichiers { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; width: 100%; }
.fichiers li {
  display: flex; align-items: center; gap: 10px;
  background: var(--m-surface); border: 1px solid var(--m-ligne);
  border-radius: 6px; padding: 10px 12px; font-size: .88rem;
}
.fichiers li span { margin-left: auto; color: var(--m-doux); font-size: .78rem; }
.options { display: grid; gap: 10px; }
.option { display: flex; align-items: flex-start; gap: 10px; font-size: .92rem; }
.option input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--m-accent); flex: none; }
.actions-saisie { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn--grand { min-height: 54px; width: 100%; }
.actions-saisie .btn--fantome { width: auto; }
.recap-intervention { list-style: none; margin: 0; padding: 0; }
.recap-intervention li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--m-ligne); font-size: .9rem; }
.recap-intervention li:last-child { border-bottom: 0; }
.recap-intervention span:first-child { color: var(--m-doux); }
.recap-intervention span:last-child { font-weight: 600; text-align: right; }

/* ============================ CLIENTS ============================ */
.grille-clients { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; align-items: start; }
.tableau-clients { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tableau-clients th, .tableau-clients td { padding: 12px 14px; border-bottom: 1px solid var(--m-ligne); text-align: left; vertical-align: middle; }
.tableau-clients thead th {
  font-family: var(--m-titre); font-size: .74rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; color: var(--m-doux);
  background: #F7F9FA;
}
.tableau-clients tbody tr[aria-selected="true"] { background: #FFF3EA; }
.lien-client {
  font-family: var(--m-titre); font-weight: 700; font-size: .9rem; text-align: left;
  padding: 6px 0; color: var(--m-texte);
}
.lien-client:hover { color: var(--m-accent); }
.tableau-clients td small { display: block; color: var(--m-doux); font-size: .78rem; }
.badge-facture { display: inline-block; font-size: .74rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badge-facture--payee { background: #DCEADF; color: #1E6B45; }
.badge-facture--attente { background: #FCE3D3; color: #A93A0B; }
.badge-facture--devis { background: #E5E0F0; color: #4B3F73; }

.fiche__entete { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; padding: 18px; border-bottom: 1px solid var(--m-ligne); }
.fiche__entete h2 { margin: 0 0 2px; font-size: 1.12rem; }
.fiche__commune { font-size: .84rem; color: var(--m-doux); }
.fiche__actions { margin-left: auto; }
.fiche__bloc { padding: 16px 18px; border-bottom: 1px solid var(--m-ligne); }
.fiche__bloc:last-child { border-bottom: 0; }
.fiche__bloc h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--m-doux); margin: 0 0 10px; font-weight: 700; }
.fiche__paires { display: grid; gap: 8px; margin: 0; }
.fiche__paires div { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; }
.fiche__paires dt { color: var(--m-doux); margin: 0; }
.fiche__paires dd { margin: 0; font-weight: 600; text-align: right; }
.fiche__tags { display: flex; flex-wrap: wrap; gap: 8px; }
.fiche__tags span { font-size: .78rem; font-weight: 600; background: var(--m-surface); border: 1px solid var(--m-ligne); border-radius: 999px; padding: 4px 11px; }
.historique { list-style: none; margin: 0; padding: 0; }
.historique li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--m-ligne); font-size: .87rem; }
.historique li:last-child { border-bottom: 0; }
.historique__date { font-family: var(--m-titre); font-size: .8rem; color: var(--m-doux); }

/* ============================ PIED DE PAGE ============================ */
.pied { background: var(--m-pied); border-top: 1px solid var(--m-ligne); }
.pied__liens { list-style: none; margin: 0; padding: 0; }
.pied__liens li { margin-bottom: .35em; }
.pied__liens a { font-weight: 600; }
.pied__mention { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--m-ligne); font-size: .8rem; color: var(--m-doux); }

/* ============================ ADAPTATIONS ============================ */
@media (max-width: 980px) {
  .grille-outils--2, .saisie__grille, .grille-clients { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  /* La navigation doit rester atteignable sur mobile : elle passe sur une ligne défilante. */
  .site__barre { flex-wrap: wrap; row-gap: 8px; padding-block: 10px; }
  .nav {
    display: flex; order: 3; width: 100%; margin-left: 0;
    overflow-x: auto; gap: 16px; padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .nav a { font-size: .84rem; }
  .site__barre > .btn { margin-left: auto; padding: 9px 14px; font-size: .86rem; }
  .contexte__actions { margin-left: 0; width: 100%; }
  .contexte__actions .btn { flex: 1; }
  .todo { grid-template-columns: 52px 1fr; row-gap: 6px; }
  .todo .pastille { grid-column: 2; justify-self: start; }
  .actions-saisie .btn--fantome { width: 100%; }
  .fiche__actions { margin-left: 0; width: 100%; }
  .fiche__actions .btn { width: 100%; }
  .panneau__tete .lien-clair { margin-left: 0; }
}
@media (max-width: 420px) {
  .kpis { grid-template-columns: 1fr; }
  .champ-groupe .ligne-champs { grid-template-columns: 1fr; }
}
