/* Charte reprise des fiches de tournée : bleu panneau, marquage jaune, Barlow. */
:root {
  --paper: #F3F6FA;
  --surface: #FFFFFF;
  --surface-2: #E9EEF5;
  --ink: #16233A;
  --muted: #5B6B82;
  --sign: #1F4FA3;
  --sign-ink: #FFFFFF;
  --mark: #F4C20D;
  --rule: #D9E1EC;
  --ok: #1F8A5B;
  --warn: #B86E00;
  --no: #B3261E;
  --ferie: #FBF1E3;
  --ferie-ink: #9A5B0C;
  --ombre: 0 1px 2px rgba(22, 35, 58, .06), 0 2px 8px rgba(22, 35, 58, .06);
  --rayon: 12px;
  --titre: "Barlow Condensed", "Arial Narrow", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0E1726;
    --surface: #16223A;
    --surface-2: #1D2B47;
    --ink: #E7EDF6;
    --muted: #9AAAC2;
    --sign: #5C8FE6;
    --sign-ink: #0E1726;
    --rule: #26344F;
    --ok: #4CC08A;
    --warn: #E3A33B;
    --no: #F07068;
    --ferie: #2C2417;
    --ferie-ink: #E2B46C;
    --ombre: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 16px/1.45 "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }

.route, .road {
  height: 6px; border-radius: 3px;
  background: repeating-linear-gradient(90deg, var(--mark) 0 28px, transparent 28px 44px);
}

/* ---------- Boutons ---------- */

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 14px; border-radius: 10px;
  border: 1.5px solid var(--sign); background: transparent; color: var(--sign);
  font-weight: 600; font-size: 16px; text-decoration: none; cursor: pointer; text-align: center;
}
.btn.primaire { background: var(--sign); color: var(--sign-ink); }
.btn:disabled { opacity: .6; }

.bouton, .bouton-icone {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--rule); background: var(--surface); border-radius: 8px;
  padding: 7px 12px; cursor: pointer; text-decoration: none; position: relative;
  white-space: nowrap; color: var(--ink); font-weight: 500;
}
.bouton:hover, .bouton-icone:hover { background: var(--surface-2); }
.bouton-icone { width: 38px; height: 38px; padding: 0; font-size: 20px; line-height: 1; }
.bouton-icone svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bouton-icone.petit { width: 30px; height: 30px; font-size: 15px; }
.bouton-icone:disabled { opacity: .35; cursor: default; }
.bouton.petit { padding: 4px 10px; font-size: 14px; }
.bouton.principal { background: var(--sign); border-color: var(--sign); color: var(--sign-ink); }
.bouton.danger { color: var(--no); }

/* ---------- En-tête ---------- */

.entete {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface); border-bottom: 1px solid var(--rule);
  padding: 10px 16px 8px; padding-top: max(10px, env(safe-area-inset-top, 0px));
}
.entete-ligne { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.entete-ligne + .entete-ligne { margin-top: 8px; }
.marque { font: 700 24px/1 var(--titre); margin: 0 auto 0 0; color: var(--sign); }
.periode { font: 700 22px/1.1 var(--titre); margin: 0; }
.resume { margin: 0 0 0 auto; color: var(--muted); font-size: 14px; }
.nav-boutons { display: flex; gap: 4px; }

.vues { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; }
.vues button {
  border: 0; background: none; padding: 6px 12px; border-radius: 7px; cursor: pointer;
  color: var(--muted); font-weight: 600;
}
.vues button.actif { background: var(--surface); color: var(--ink); box-shadow: var(--ombre); }

/* ---------- Palette ---------- */

.palette { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 16px 0; max-width: 1400px; margin: 0 auto; }
.palette:empty { display: none; }
.palette-aide { color: var(--muted); font-size: 13px; margin-right: 4px; }
.palette .puce { cursor: pointer; }
.puce.a-placer { border-left-style: dashed; background: transparent; outline: 1px dashed color-mix(in srgb, var(--c) 60%, transparent); }

.puce {
  display: flex; align-items: center; gap: 6px;
  background: color-mix(in srgb, var(--c) 16%, var(--surface));
  border-left: 4px solid var(--c);
  border-radius: 6px; padding: 3px 7px; font-size: 13px; font-weight: 600;
  cursor: grab; min-width: 0; user-select: none;
}
.puce-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.puce-n { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.puce.finie .puce-nom::before { content: "✓ "; color: var(--ok); }

/* ---------- Contenu ---------- */

.contenu { padding: 12px 16px 48px; max-width: 1400px; margin: 0 auto; }
.meta { color: var(--muted); font-size: 13px; display: block; }
.vide { color: var(--muted); font-size: 14px; margin: 0; list-style: none; }
.barre { display: block; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.barre > span { display: block; height: 100%; background: var(--ok); }

/* Vue mois */
.mois { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--rayon); overflow: hidden; }
.mois-tete, .mois-ligne { display: grid; grid-template-columns: 34px repeat(5, minmax(0, 1fr)); }
.mois-tete { background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mois-tete > span { padding: 8px; }
.mois-tete .court { display: none; }
.mois-ligne { border-top: 1px solid var(--rule); }
.num-sem { font-size: 11px; color: var(--muted); padding: 8px 4px; text-align: center; }
.cellule {
  min-height: 112px; padding: 6px; border-left: 1px solid var(--rule); cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.cellule:hover { background: var(--surface-2); }
.cellule.hors-mois { background: var(--paper); }
.cellule.hors-mois .num { color: var(--muted); }
.cellule.ferie { background: var(--ferie); }
.cellule-tete { display: flex; align-items: center; gap: 6px; }
.num { font-weight: 600; font-size: 13px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.aujourdhui .num { background: var(--sign); color: var(--sign-ink); }
.ferie-nom { font-size: 11px; color: var(--ferie-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.puces { display: flex; flex-direction: column; gap: 3px; }
.survol { outline: 2px dashed var(--sign); outline-offset: -3px; background: color-mix(in srgb, var(--sign) 8%, var(--surface)) !important; }

/* Vue semaine */
.semaine { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; align-items: start; }
.colonne {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--rayon);
  min-height: 260px; display: flex; flex-direction: column; cursor: pointer; overflow: hidden;
}
.colonne:hover { border-color: color-mix(in srgb, var(--sign) 50%, var(--rule)); }
.colonne.ferie { background: var(--ferie); }
.colonne-tete { padding: 10px 12px; border-bottom: 1px solid var(--rule); display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.colonne.aujourdhui .colonne-tete { background: var(--sign); color: var(--sign-ink); border-bottom-color: var(--sign); }
.colonne.aujourdhui .jour-num { color: inherit; opacity: .85; }
.jour-nom { font: 700 20px/1.1 var(--titre); }
.jour-num { color: var(--muted); font-size: 14px; }
.badge-auj { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--mark); color: #16233A; border-radius: 4px; padding: 1px 6px; margin-left: auto; }
.colonne-corps { padding: 10px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.carte-sem {
  border-left: 4px solid var(--c); border-radius: 8px; padding: 8px 10px;
  background: color-mix(in srgb, var(--c) 10%, var(--surface));
  display: flex; flex-direction: column; gap: 4px; cursor: grab;
}
.carte-sem > strong { font: 700 18px/1.1 var(--titre); }
.mini-arrets { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.mini {
  display: flex; gap: 6px; width: 100%; border: 0; background: none; padding: 3px 4px; border-radius: 5px;
  text-align: left; cursor: pointer; font-size: 13px; line-height: 1.25; align-items: baseline;
}
.mini:hover { background: color-mix(in srgb, var(--c) 18%, var(--surface)); }
.mini-h { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 38px; flex: none; }
.mini-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--rule); flex: none; align-self: center; }
.mini.r-visite::before { background: var(--ok); }
.mini.r-absent::before { background: var(--warn); }
.mini.r-non::before { background: var(--no); }

/* ---------- Vue jour : fiches de tournée ---------- */

.jour { display: flex; flex-direction: column; gap: 22px; max-width: 760px; margin: 0 auto; }
.alerte { margin: 0; padding: 10px 14px; background: var(--ferie); color: var(--ferie-ink); border-radius: var(--rayon); font-weight: 600; }
.vide-jour { text-align: center; color: var(--muted); padding: 30px 0 0; }

.tournee { background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; overflow: hidden; box-shadow: var(--ombre); }
.hero { background: var(--c); color: #fff; padding: 18px 16px 16px; }
.hero-haut { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.hero h3 { font: 700 clamp(28px, 7vw, 40px)/1 var(--titre); margin: 0 0 8px; letter-spacing: .01em; }
.hero p { margin: 0 0 14px; opacity: .92; max-width: 60ch; }
.hero-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.hero-btn {
  position: relative; border: 1px solid rgba(255, 255, 255, .55); background: rgba(255, 255, 255, .12);
  color: #fff; border-radius: 8px; padding: 5px 10px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.hero-btn input[type="date"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.fiche { padding: 0 16px 20px; }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; margin: 16px 0; }
.facts div { background: var(--surface); padding: 10px 12px; min-width: 0; }
.facts b { display: block; font: 700 24px/1.1 var(--titre); }
.facts span { color: var(--muted); font-size: 14px; }

.launch { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; }
.launch small { color: var(--muted); font-size: 14px; }

.parcours { margin: 0 0 12px; }
.parcours summary { font: 700 22px var(--titre); cursor: pointer; padding: 4px 0; }
.mapbox { background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 8px; margin-top: 6px; }
.mapbox svg { display: block; width: 100%; height: auto; }
.trace-fond { fill: none; stroke: var(--rule); stroke-width: 7; stroke-linejoin: round; stroke-linecap: round; }
.trace { fill: none; stroke: var(--mark); stroke-width: 2.5; stroke-dasharray: 8 6; stroke-linejoin: round; }
.zone { font: 11px "Barlow", sans-serif; fill: var(--muted); text-anchor: middle; }
.pt { cursor: pointer; }
.pt circle { fill: var(--sign); stroke: var(--surface); stroke-width: 2.5; }
.pt text { font: 700 13px var(--titre); fill: var(--sign-ink); text-anchor: middle; pointer-events: none; }
.pt.r-visite circle { fill: var(--ok); }
.pt.r-absent circle { fill: var(--warn); }
.pt.r-non circle { fill: var(--no); }
.maplegend { color: var(--muted); font-size: 14px; margin: 6px 4px 0; }

.progress { display: flex; align-items: center; gap: 10px; margin: 8px 0 14px; color: var(--muted); font-size: 15px; }
.bar { flex: 1; height: 8px; background: var(--rule); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); transition: width .3s; }

ol.stops { list-style: none; margin: 0; padding: 0; }
.stop { position: relative; padding: 0 0 18px 52px; scroll-margin-top: 130px; }
.stop::before { content: ""; position: absolute; left: 19px; top: 40px; bottom: 0; border-left: 3px dashed var(--rule); }
.stop:last-child::before { display: none; }
.stop .num {
  position: absolute; left: 0; top: 0; width: 41px; height: 41px; border-radius: 50%;
  background: var(--sign); color: var(--sign-ink); display: grid; place-items: center; font: 700 20px var(--titre);
}
.stop[data-status="visite"] .num { background: var(--ok); }
.stop[data-status="absent"] .num { background: var(--warn); }
.stop[data-status="non"] .num { background: var(--no); }
.stop.surligne .card { animation: surligne 1.6s ease-out; }
@keyframes surligne { 0%, 30% { box-shadow: 0 0 0 3px var(--mark); } 100% { box-shadow: 0 0 0 3px transparent; } }

.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 12px 14px; }
.time { color: var(--muted); font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.modifier { border: 0; background: none; color: var(--sign); font-size: 13px; font-weight: 600; cursor: pointer; padding: 0; }
.card h3 { margin: 2px 0; font-size: 19px; line-height: 1.2; }
.addr { margin: 0; color: var(--muted); font-size: 15px; }
.mail { margin: 4px 0 0; font-size: 15px; }
.mail a { color: var(--sign); font-weight: 600; word-break: break-all; }
.mail.none { color: var(--muted); font-style: italic; }
.siret { margin: 4px 0 0; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.siret b { color: var(--ink); font-weight: 600; letter-spacing: .02em; }
.what { margin: 6px 0 0; font-size: 15px; }
.notes-perm { border-left: 3px solid var(--mark); padding-left: 8px; }
.etiquettes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.fit, .suivi { display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--rule); color: var(--muted); }
.fit.top { border-color: var(--ok); color: var(--ok); }
.suivi-interesse { border-color: var(--sign); color: var(--sign); }
.suivi-client { background: var(--ok); border-color: var(--ok); color: #fff; }
.suivi-a_relancer { border-color: var(--warn); color: var(--warn); }
.suivi-pas_interesse { border-color: var(--no); color: var(--no); }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.actions a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; border-radius: 8px; background: var(--paper); border: 1px solid var(--rule);
  text-decoration: none; font-size: 13px; font-weight: 600; color: var(--ink); text-align: center; padding: 2px;
}
.actions a.inactif { opacity: .45; pointer-events: none; }
.actions svg { width: 20px; height: 20px; stroke: var(--sign); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.status { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { min-height: 36px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--rule); background: transparent; color: var(--ink); font-weight: 500; font-size: 14px; cursor: pointer; }
.chip[aria-pressed="true"][data-v="visite"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.chip[aria-pressed="true"][data-v="absent"] { background: var(--warn); border-color: var(--warn); color: #fff; }
.chip[aria-pressed="true"][data-v="non"] { background: var(--no); border-color: var(--no); color: #fff; }
.note-visite {
  width: 100%; margin-top: 8px; min-height: 44px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink); font-size: 15px; resize: vertical;
}
.lunch { padding: 0 0 18px 52px; position: relative; color: var(--muted); font-size: 15px; font-weight: 600; list-style: none; }
.lunch::before { content: ""; position: absolute; left: 19px; top: 0; bottom: 0; border-left: 3px dashed var(--rule); }

.tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tools .btn { flex: 1 1 200px; }
.note { color: var(--muted); font-size: 14px; margin: 18px 0 0; max-width: 60ch; }

.ajout-jour { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; padding: 6px 0; }
.ajout-jour select { padding: 7px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); }

/* ---------- Fenêtres ---------- */

.dialogue {
  border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 40px); background: var(--surface); color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.dialogue::backdrop { background: rgba(14, 23, 38, .5); }
.dialogue form { display: contents; }
.dialogue-tete { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.dialogue-tete h3 { margin: 0; font: 700 24px var(--titre); }
.dialogue-tete .bouton-icone { border: 0; }
.dialogue-corps { padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.dialogue-corps h4 { margin: 6px 0 4px; }
.dialogue-pied { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--rule); position: sticky; bottom: 0; background: var(--surface); }
.espace { flex: 1; }
.champ { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.champ input, .champ select, .champ textarea {
  border: 1px solid var(--rule); border-radius: 8px; padding: 9px 10px; background: var(--surface);
  color: var(--ink); font-weight: 400; font-size: 16px; width: 100%;
}
.champ input[type="color"] { padding: 2px; height: 42px; }
.case { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.case input { width: 20px; height: 20px; accent-color: var(--ok); }
.champs-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.liste-tournees, .liste-simple { list-style: none; margin: 0; padding: 0; }
.liste-tournees li, .liste-simple li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.liste-tournees li > div, .liste-simple li > div { flex: 1; min-width: 0; }
.rang { width: 24px; height: 24px; border-radius: 50%; background: var(--sign); color: var(--sign-ink); display: grid; place-items: center; font: 700 14px var(--titre); flex: none; }
.pastille { width: 14px; height: 14px; border-radius: 50%; background: var(--c); flex: none; }
.sauvegarde summary { cursor: pointer; color: var(--muted); font-size: 15px; font-weight: 600; }
.sauvegarde .aide { margin: 8px 0; }
.ligne-boutons { display: flex; gap: 8px; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; font-weight: 600;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100vw - 32px); z-index: 20;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Mobile ---------- */

@media (max-width: 760px) {
  .marque { display: none; }
  .vues { margin-right: auto; }
  .vues button { padding: 6px 9px; }
  .resume { width: 100%; margin: 0; }
  .periode { font-size: 20px; }
  .palette { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .palette-aide { display: none; }
  .palette .puce { flex: none; }
  .mois-tete .long { display: none; }
  .mois-tete .court { display: inline; }
  .mois-tete > span { padding: 6px 4px; text-align: center; }
  .mois-tete, .mois-ligne { grid-template-columns: 22px repeat(5, minmax(0, 1fr)); }
  .num-sem { padding: 6px 0; font-size: 10px; }
  .cellule { min-height: 76px; padding: 4px 3px; }
  .cellule .num { width: 22px; height: 22px; font-size: 12px; }
  .cellule .ferie-nom { display: none; }
  .cellule .puce { padding: 2px 4px; font-size: 11px; border-left-width: 3px; }
  .cellule .puce-n { display: none; }
  .semaine { grid-template-columns: 1fr; }
  .colonne { min-height: 0; }
  .fiche { padding: 0 12px 16px; }
  .stop { padding-left: 46px; scroll-margin-top: 190px; }
  .stop .num { width: 36px; height: 36px; font-size: 18px; }
  .stop::before, .lunch::before { left: 16px; }
  .lunch { padding-left: 46px; }
  .card { padding: 10px 12px; }
  .champs-2 { grid-template-columns: 1fr; }
}

/* =================================================================
   Rotation mensuelle, annonces, relances, compte rendu vocal, import
   ================================================================= */

.bouton-tournees svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; display: none; }
body[data-affichage="rotation"] .nav-boutons { visibility: hidden; }

/* Annonces (nouvelle tournée, rotation à organiser) */
.annonces { max-width: 1400px; margin: 0 auto; padding: 10px 16px 0; display: flex; flex-direction: column; gap: 8px; }
.annonces:empty { display: none; }
.annonce {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--mark) 22%, var(--surface)); border: 1px solid color-mix(in srgb, var(--mark) 60%, var(--rule));
  border-radius: 10px; padding: 8px 12px; font-size: 15px;
}
.annonce-rotation { background: color-mix(in srgb, var(--sign) 10%, var(--surface)); border-color: color-mix(in srgb, var(--sign) 35%, var(--rule)); }
.annonce-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Calendrier : jours tampon, tournées sur un jour férié, relances */
.cellule.tampon { background: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--rule) 55%, transparent) 8px 10px); }
.tampon-nom { font-size: 11px; color: var(--muted); }
.puce.sur-ferie, .carte-sem.sur-ferie { outline: 2px dashed var(--no); outline-offset: -2px; }
.relance-jour { margin: 0; font-size: 13px; font-weight: 600; color: var(--warn); }
.alerte-btn { border-color: var(--no); color: var(--no); margin-top: 14px; width: 100%; }
.hero .rythme-texte { font-weight: 600; opacity: .95; margin: -2px 0 8px; font-size: 15px; }

/* Vue rotation */
.rotation { display: flex; flex-direction: column; gap: 14px; max-width: 1100px; margin: 0 auto; }
.rotation .intro { margin: 0; color: var(--muted); font-size: 15px; max-width: 80ch; }
.tout-place { margin: 0; color: var(--ok); font-weight: 600; }
.a-placer { background: var(--surface); border: 1px dashed var(--sign); border-radius: var(--rayon); padding: 10px 12px; }
.a-placer-tete { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.a-placer h3 { margin: 0; font: 700 20px var(--titre); }
.a-placer h3 span { color: var(--muted); font-weight: 600; }
.puces-ligne { display: flex; flex-wrap: wrap; gap: 6px; }
.puces-ligne .puce, .gr-cellule .puce { cursor: pointer; }
.puce.selectionnee { outline: 3px solid var(--mark); outline-offset: 1px; }
.selection-rotation {
  position: sticky; top: calc(var(--haut-entete, 104px) + 6px); z-index: 4;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px;
  background: var(--surface); border: 2px solid var(--c); border-radius: var(--rayon); box-shadow: var(--ombre);
}
.selection-texte { flex: 1; min-width: 180px; }
.selection-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.grille-rotation { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--rayon); overflow: hidden; }
.gr-tete, .gr-ligne { display: grid; grid-template-columns: 110px repeat(5, minmax(0, 1fr)); }
.gr-tete { background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.gr-tete > span { padding: 8px; }
.gr-ligne { border-top: 1px solid var(--rule); }
.gr-semaine { padding: 8px; display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); }
.gr-semaine strong { font: 700 17px/1.1 var(--titre); }
.gr-semaine > span { font-size: 12px; color: var(--muted); }
.gr-semaine .court { display: none; }
body[data-affichage="jour"] .toast { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
.gr-cellule {
  min-height: 92px; padding: 6px; border-left: 1px solid var(--rule); display: flex; flex-direction: column; gap: 4px;
  min-width: 0; cursor: pointer;
}
.gr-cellule:hover { background: var(--surface-2); }
.gr-cellule.cible { background: color-mix(in srgb, var(--sign) 5%, var(--surface)); }
.gr-cellule.cible:hover { background: color-mix(in srgb, var(--sign) 14%, var(--surface)); outline: 2px dashed var(--sign); outline-offset: -3px; }
.gr-date { font-size: 11px; color: var(--muted); }
.gr-date.ferie-texte { color: var(--no); font-weight: 600; }

/* Relances du jour */
.relances { background: var(--surface); border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--rule)); border-left: 5px solid var(--warn); border-radius: var(--rayon); padding: 12px 14px; }
.relances h3 { margin: 0 0 6px; font: 700 22px var(--titre); }
.relances ul { list-style: none; margin: 0; padding: 0; }
.relances li { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--rule); }
.relances li:first-child { border-top: 0; }
.relance-infos { min-width: 0; flex: 1; }
.relance-actions { display: flex; gap: 6px; }
.suivi-relance { border-color: var(--warn); color: var(--warn); }

/* Journal des dictées */
.journal { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--rayon); padding: 10px 14px; }
.journal summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.journal blockquote { margin: 10px 0 0; padding: 8px 10px; background: var(--paper); border-left: 3px solid var(--mark); border-radius: 6px; white-space: pre-wrap; }
.journal blockquote .meta { display: block; margin-bottom: 2px; }

/* Barre vocale (vue jour) */
body[data-affichage="jour"] .contenu { padding-bottom: 120px; }
.barre-vocale {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 6;
  width: min(560px, calc(100vw - 24px)); display: flex; align-items: center; gap: 12px;
  background: var(--sign); color: var(--sign-ink); border-radius: 999px; padding: 8px 18px 8px 8px;
  box-shadow: 0 10px 30px rgba(14, 23, 38, .3);
}
.barre-vocale-texte { flex: 1; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; padding: 0; display: flex; flex-direction: column; }
.barre-vocale-texte strong { font: 700 20px/1.1 var(--titre); }
.barre-vocale-texte span { font-size: 13px; opacity: .9; }
.micro {
  flex: none; width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--mark); color: #16233A; display: grid; place-items: center;
}
.micro svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.micro.grand { width: 76px; height: 76px; }
.micro.grand svg { width: 36px; height: 36px; }
.micro.ecoute { background: var(--no); color: #fff; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--no) 55%, transparent); } 50% { box-shadow: 0 0 0 14px transparent; } }

/* Fenêtre de compte rendu */
.dialogue-plein { width: min(720px, calc(100vw - 16px)); }
.dictee-commandes { display: flex; align-items: center; gap: 14px; }
.dictee-etat { margin: 0; color: var(--muted); font-weight: 600; }
.zone-texte {
  width: 100%; border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; background: var(--paper);
  color: var(--ink); font-size: 16px; line-height: 1.45; resize: vertical;
}
.provisoire { margin: -6px 0 0; color: var(--muted); font-style: italic; min-height: 1em; }
.provisoire:empty { display: none; }
.erreur-texte { color: var(--no); font-weight: 600; margin: 0; }
.erreur-texte:empty { display: none; }
.revue-resume { margin: 0; font-size: 17px; }
.moteur { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); color: var(--muted); border-radius: 4px; padding: 2px 6px; margin-left: 4px; }
.avertissement { margin: 0; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--warn); font-weight: 600; }
.revue-groupe { margin: 8px 0 0; padding-left: 10px; border-left: 4px solid var(--c, var(--muted)); font: 700 20px var(--titre); }
.revue-carte { border: 1px solid var(--rule); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.revue-titre { flex-wrap: wrap; }
.revue-titre .meta { width: 100%; padding-left: 28px; }
.revue-carte .status { margin-top: 0; }
.revue-carte textarea, .revue-carte select, .revue-carte input[type="date"] { font-size: 15px; }
.extrait { margin: 0; color: var(--muted); font-style: italic; font-size: 14px; }

/* Fiche tournée : rythme */
.rythme { border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.champ-titre { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.ajout-creneau { display: flex; gap: 6px; flex-wrap: wrap; }
.ajout-creneau select { border: 1px solid var(--rule); border-radius: 8px; padding: 6px 8px; background: var(--surface); }
.case-champ { align-self: end; padding-bottom: 8px; }

/* Import */
.astuce summary { cursor: pointer; color: var(--sign); font-weight: 600; }
.consigne { white-space: pre-wrap; font-size: 12px; background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; padding: 8px 10px; max-height: 220px; overflow: auto; }
.apercu-tournee { border: 1px solid var(--rule); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.apercu-tournee p { margin: 0; }
.choix-import { display: flex; flex-direction: column; gap: 4px; }
code { font-size: .92em; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }

@media (max-width: 760px) {
  .bouton-tournees span { display: none; }
  .bouton-tournees svg { display: block; }
  .bouton-tournees { width: 38px; height: 38px; padding: 0; }
  .vues button { padding: 6px 7px; font-size: 15px; }
  .entete-ligne { gap: 8px; }
  .annonce { font-size: 14px; }
  .gr-tete, .gr-ligne { grid-template-columns: 54px repeat(5, minmax(0, 1fr)); }
  .gr-semaine { padding: 6px 4px; }
  .gr-semaine strong { font-size: 18px; }
  .gr-semaine .long { display: none; }
  .gr-semaine .court { display: inline; }
  .gr-semaine > span { font-size: 10px; }
  .gr-tete > span { padding: 6px 2px; text-align: center; font-size: 11px; }
  .gr-cellule { min-height: 78px; padding: 4px 2px; }
  .gr-date { font-size: 9px; }
  .gr-cellule .puce { padding: 2px 3px; font-size: 10px; border-left-width: 3px; }
  .barre-vocale-texte strong { font-size: 18px; }
  .relances li { align-items: flex-start; }
}

/* Réserve de tournées (mois, semaine) */
.palette { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 8px; }
.reserve-tete { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.reserve-tete strong { font: 700 18px var(--titre); }
.reserve-puces { display: flex; flex-wrap: wrap; gap: 6px; }
.palette .puce { cursor: pointer; }
.reserve-choix { position: static; }
body.pose-en-cours .cellule, body.pose-en-cours .colonne { outline: 2px dashed color-mix(in srgb, var(--sign) 45%, transparent); outline-offset: -3px; }
body.pose-en-cours .cellule:hover, body.pose-en-cours .colonne:hover { background: color-mix(in srgb, var(--sign) 10%, var(--surface)); }
@media (max-width: 760px) {
  .palette { display: flex; overflow-x: visible; }
  .palette-aide { display: inline; }
  .reserve-puces { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .reserve-puces .puce { flex: none; }
}
