:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --ink: #111c29;
  --muted: #66778b;
  --line: #e6ebf1;
  --brand: #0f6fb5;
  --brand-dark: #0a558c;
  --green: #17864f;
  --red: #c0392b;
  --orange: #c97a12;
  --pink: #db2777;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 32, 48, .05);
  --shadow: 0 1px 2px rgba(16, 32, 48, .04), 0 10px 30px rgba(16, 32, 48, .07);
}

* { box-sizing: border-box; }

/* Doit venir apres les regles ci-dessous : sans cela, un `display:` de classe
   neutralise l'attribut `hidden` et la modale reste visible en permanence. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.spacer { flex: 1; }
code { background: #eef2f7; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
a { color: var(--brand); }

/* ---------- Connexion ---------- */
/* ---------- Connexion : carte ELYON sur fond clair ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 20px;
  background:
    radial-gradient(520px 380px at 88% 8%, rgba(255, 61, 104, .10), transparent 70%),
    radial-gradient(520px 380px at 8% 95%, rgba(255, 138, 61, .10), transparent 70%),
    #f6f9fc;
}
.login-zone { width: 100%; display: grid; place-items: center; }
.login-card {
  width: 100%; max-width: 420px; background: #fff; border: 1px solid #e2e8f0; border-radius: 22px;
  padding: 34px 32px; box-shadow: 0 4px 12px rgba(7,19,34,.05), 0 24px 60px rgba(7,19,34,.10);
}
.login-logo-carte { display: block; height: 84px; width: auto; margin: 0 auto 20px; }
.login-card h1 { font-size: 26px; margin: 0 0 6px; color: #0b1b2b; }
.login-card .muted { margin: 0 0 24px; }
.login-card .form-group > span:first-child { font-weight: 600; color: #0b1b2b; }
.login-card input { height: 46px; font-size: 16px; border-radius: 12px; }
.login-card input:focus { border-color: #ff3d68; box-shadow: 0 0 0 4px rgba(255, 61, 104, .12); outline: none; }
.mdp-champ { position: relative; display: block; }
.mdp-champ input { padding-right: 86px; }
.mdp-voir {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: #ff3d68; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 8px;
}
.btn.btn-elyon {
  margin-top: 8px; height: 50px; border: 0; border-radius: 12px; color: #fff; font-weight: 700; font-size: 16px;
  background: linear-gradient(115deg, #ff8a3d, #ff3d68); box-shadow: 0 10px 26px rgba(255, 61, 104, .28);
  transition: transform .15s, box-shadow .15s;
}
.btn.btn-elyon:hover { transform: translateY(-1px); box-shadow: 0 14px 32px rgba(255, 61, 104, .36); }
.login-aide { margin: 18px 0 0; font-size: 12.5px; color: #6b8098; line-height: 1.5; }
@media (max-width: 480px) { .login-card { padding: 28px 22px; } }
.login-error { color: var(--red); font-size: 13px; margin: 10px 0 0; }

/* ---------- Menu latéral ---------- */
#app:not([hidden]) { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.sidebar {
  --side-bg: #0f2c40;
  --side-card: #173a52;
  --side-line: rgba(255, 255, 255, .09);
  --side-ink: #e7eef5;
  --side-muted: #8aa3b8;
  width: 260px; flex: none;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--side-bg); color: var(--side-ink);
  display: flex; flex-direction: column;
  z-index: 30;
}
.side-brand {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 20px 20px 18px; border-bottom: 1px solid var(--side-line);
}
.side-logo { height: 76px; width: auto; display: block; }
.side-hello { padding: 22px 18px 6px; }
.side-hello-title { font-size: 22px; font-weight: 700; color: #fff; }
.side-hello-sub { color: var(--side-ink); opacity: .85; font-size: 14px; margin-top: 2px; }

.side-nav { padding: 0 18px 18px; flex: 1; }
.side-label {
  font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--side-muted); margin: 20px 0 8px 14px;
}
.side-group {
  background: var(--side-card); border: 1px solid var(--side-line);
  border-radius: 16px; padding: 6px;
}
.tab, .side-logout {
  display: flex; align-items: center; gap: 14px; width: 100%;
  background: none; border: 0; cursor: pointer; text-align: left;
  font: inherit; font-size: 15px; font-weight: 600; color: var(--side-ink);
  padding: 12px 14px; border-radius: 11px;
  transition: background .15s, color .15s;
}
.tab svg, .side-logout svg {
  width: 22px; height: 22px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  opacity: .9;
}
.tab:hover, .side-logout:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.tab.active { background: var(--brand); color: #fff; box-shadow: 0 6px 14px rgba(0, 0, 0, .18); }
.tab.active svg { opacity: 1; }

.side-foot { border-top: 1px solid var(--side-line); }
.side-logout { padding: 20px 32px; border-radius: 0; }
.side-version {
  border-top: 1px solid var(--side-line);
  text-align: center; color: var(--side-muted); font-size: 14px; padding: 14px;
}
.side-overlay { display: none; }

/* ---------- Barre supérieure ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.page-title { margin: 0; font-size: 20px; }
.topbar .btn-primary { margin-left: auto; }
.btn-menu {
  display: none; font: inherit; font-size: 20px; line-height: 1;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
}
.logo {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 6px 14px rgba(15, 111, 181, .32);
}

/* Sur téléphone / petite tablette : le menu glisse depuis la gauche. */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: auto;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 10px 0 30px rgba(0, 0, 0, .25);
  }
  body.menu-ouvert .sidebar { transform: none; }
  body.menu-ouvert .side-overlay {
    display: block; position: fixed; inset: 0; z-index: 25; background: rgba(10, 25, 40, .45);
  }
  .btn-menu { display: inline-flex; align-items: center; justify-content: center; }
  .topbar { padding: 12px 16px; }
  .page-title { font-size: 18px; }
}

.content { padding: 22px 24px 70px; max-width: 1500px; }

/* ---------- Cartes / boîtes ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.card, .box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card .val { font-size: 28px; font-weight: 700; margin-top: 4px; }
.card .lbl { color: var(--muted); font-size: 13px; }
.card.alert .val { color: var(--red); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.box { margin-bottom: 18px; }
.no-pad { padding: 0; }

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ---------- Boutons ---------- */
.btn {
  font: inherit;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 15px;
  cursor: pointer;
  background: #eef2f7;
  color: var(--ink);
  white-space: nowrap;
  transition: filter .12s, background .12s, box-shadow .12s;
}
.btn:hover { filter: brightness(.96); }
.btn-primary { background: var(--brand); color: #fff; font-weight: 600; box-shadow: 0 6px 14px rgba(15, 111, 181, .22); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { background: #fff; border-color: var(--line); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #eef2f7; }
.btn-danger { background: #fff; border-color: #f0c8c3; color: var(--red); }
.btn-sm { padding: 4px 9px; font-size: 13px; }
.btn-block { width: 100%; }

/* Boutons d'action en icône (liste des clients) */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0;
  border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: #3a4b5e; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s, transform .08s;
}
.icon-btn svg { width: 19px; height: 19px; display: block; }
.icon-btn:hover { border-color: var(--brand); color: var(--brand); background: #f2f8ff; }
.icon-btn:active { transform: translateY(1px); }
.icon-btn.danger { color: var(--red); border-color: #f0c8c3; }
.icon-btn.danger:hover { background: #fdecea; border-color: var(--red); color: var(--red); }

/* ---------- Formulaires ---------- */
.form-group { display: block; margin-bottom: 12px; }
.form-group > span, .form-group > label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #bcdcf5; border-color: var(--brand); }
textarea { min-height: 78px; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.required { color: var(--red); }

fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 14px;
}
legend { font-size: 13px; color: var(--muted); font-weight: 600; padding: 0 6px; }

.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 6px; }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  background: #fbfcfe;
}
.check:hover { border-color: var(--brand); }
.check input { width: 17px; height: 17px; accent-color: var(--brand); flex: none; }
.check:has(input:checked) { background: #eef7ff; border-color: var(--brand); font-weight: 600; }

.hint { font-size: 12.5px; color: var(--muted); margin: 4px 0 10px; }

/* ---------- Tableaux ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input[type=search] { max-width: 340px; }
.toolbar select { max-width: 220px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:hover { background: #f8fbff; }
.table tbody tr.row-click { cursor: pointer; }
.item-click { cursor: pointer; }
.item-click:hover { background: #f8fbff; border-color: #cfe0f0; }
.table .strong { font-weight: 600; }
.row-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.empty { padding: 28px; text-align: center; color: var(--muted); margin: 0; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #eef2f7;
  color: #445;
  white-space: nowrap;
  margin: 0 4px 4px 0;
}
.badge.contrat { background: #e3f5ec; color: var(--green); }
.badge.prospect { background: #e8f1fb; color: var(--brand); }
.badge.suspendu { background: #fdf0dd; color: var(--orange); }
.badge.archive { background: #eceff3; color: var(--muted); }
.badge.produit { background: #eef7ff; color: var(--brand-dark); font-weight: 500; }
.badge.prevue { background: #e8f1fb; color: var(--brand); }
.badge.effectuee { background: #e3f5ec; color: var(--green); }
.badge.annulee { background: #eceff3; color: var(--muted); text-decoration: line-through; }
.badge.retard { background: #fbe4e1; color: var(--red); }
.badge.type { background: #f3ecfb; color: #6b3fa0; }
.badge.confirme { background: #fce7f3; color: #be185d; }

/* ---------- Listes ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
}
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.item .sub { color: var(--muted); font-size: 13px; }
.list-empty { color: var(--muted); font-size: 14px; padding: 6px 2px; }

/* ---------- Planning ---------- */
.cal-legend {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted);
  padding: 10px 16px; border-top: 1px solid var(--line); margin: 0;
}
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: -1px; }
.dot.prevue { background: var(--brand); }
.dot.effectuee { background: var(--green); }
.dot.annulee { background: #b8c2ce; }
.dot.retard { background: var(--red); }

.plan-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.plan-bar .nav { display: inline-flex; align-items: center; gap: 6px; }
.plan-bar .nav strong { min-width: 210px; text-align: center; font-size: 16px; }

.seg { display: inline-flex; background: #e8edf3; border-radius: 9px; padding: 3px; gap: 2px; }
.seg-btn {
  font: inherit; border: 0; background: none; cursor: pointer;
  padding: 6px 14px; border-radius: 7px; color: var(--muted); font-weight: 500;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.active { background: #fff; color: var(--brand); font-weight: 600; box-shadow: var(--shadow); }

/* Onglets technicien : un par technicien, avec le nombre d'interventions du jour */
.onglets-defil { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.onglets {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 0;
  flex: 1; min-width: 0; scroll-behavior: smooth; scrollbar-width: none;
}
.onglets::-webkit-scrollbar { display: none; }
.onglets-fleche {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-size: 20px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 0 2px;
}
.onglets-fleche:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.onglets-fleche:disabled { opacity: .3; cursor: default; }
.onglets-defil.sans-defil .onglets-fleche { display: none; }
/* Les onglets occupent toute une ligne ; le compteur et « Filtres » passent dessous, à droite. */
.plan-filters .onglets-defil { flex: 1 1 100%; }
.plan-filters .onglets-defil + .spacer { display: block; }
.onglet {
  font: inherit; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 500;
}
.onglet:hover { border-color: var(--brand); color: var(--brand); }
.onglet em {
  font-style: normal; font-weight: 700; font-size: 11px;
  background: var(--line); color: var(--ink-2);
  border-radius: 999px; padding: 1px 6px; margin-left: 3px;
}
.onglet.actif { background: var(--brand); border-color: var(--brand); color: #fff; }
.onglet.actif em { background: rgba(255, 255, 255, .28); color: #fff; }
.onglet.actif:hover { color: #fff; }

.plan-filters {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 12px;
}
.plan-filters.plan-adv { background: #fbfcfe; }
.plan-filters.plan-adv::before {
  content: 'Filtres avancés'; font-size: 12px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  width: 100%; margin-bottom: 2px;
}
.plan-filters select { width: auto; min-width: 150px; padding: 6px 9px; font-size: 14px; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.check-inline input { width: 16px; height: 16px; accent-color: var(--brand); }

.alert-banner {
  padding: 10px 14px; border-radius: 10px; margin-bottom: 12px;
  background: #fbe4e1; color: var(--red); border: 1px solid #f0c8c3; font-size: 14px; font-weight: 500;
}

/* --- Vue semaine --- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); }
.week-col {
  border-right: 1px solid var(--line);
  min-height: 230px;
  display: flex; flex-direction: column;
  background: #fff;
}
.week-col:last-child { border-right: 0; }
.week-col.weekend { background: #fafbfc; }
.week-col.today { background: #f2f8ff; box-shadow: inset 0 0 0 2px var(--brand); }
.week-head {
  padding: 8px 10px; border-bottom: 1px solid var(--line);
  display: flex; align-items: baseline; gap: 6px; cursor: pointer;
  position: sticky; top: 0; background: inherit; z-index: 2;
  border-top: 0; border-left: 0; border-right: 0; width: 100%;
  font: inherit; color: inherit; text-align: left;
}
.week-head:hover { background: #eef4fa; }
.week-head .dow { font-size: 11.5px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.week-head .day { font-size: 19px; font-weight: 700; }
.week-col.today .week-head .day { color: var(--brand); }
.week-head .nb {
  margin-left: auto; font-size: 11.5px; color: var(--muted);
  background: #eef2f7; border-radius: 999px; padding: 1px 7px;
}
.week-col.today .week-head .nb { background: var(--brand); color: #fff; }
.week-body { padding: 6px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.week-add {
  border: 1px dashed var(--line); background: none; border-radius: 7px;
  padding: 5px; font: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer;
  margin-top: auto; opacity: 0; transition: opacity .12s;
}
.week-col:hover .week-add { opacity: 1; }
.week-add:hover { border-color: var(--brand); color: var(--brand); }

.rchip {
  display: block; width: 100%; text-align: left; font: inherit; cursor: pointer;
  border: 0; border-left: 3px solid var(--brand);
  background: #eef5fc; border-radius: 6px; padding: 4px 7px; color: inherit;
}
.rchip:hover { background: #e2eefb; }
.rchip b { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rchip small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rchip.effectuee { background: #eaf6ef; border-left-color: var(--green); }
.rchip.effectuee b { text-decoration: line-through; color: var(--muted); }
.rchip.annulee { background: #f2f4f7; border-left-color: #b8c2ce; }
.rchip.annulee b { text-decoration: line-through; color: var(--muted); }
.rchip.retard { background: #fdecea; border-left-color: var(--red); }
.rchip.retard b { color: var(--red); }
.rchip.confirme { background: #fdf2f8; border-left-color: var(--pink); }
.rchip.confirme b { color: #9d174d; }
.rchip.jour { box-shadow: 0 0 0 2px var(--brand-dark); }

/* --- Vue mois --- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-dow {
  padding: 8px; text-align: center; font-size: 12px; text-transform: uppercase;
  color: var(--muted); background: #f8fafc; border-bottom: 1px solid var(--line); font-weight: 600;
}
.cal-day {
  min-height: 100px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 6px; cursor: pointer; background: #fff; text-align: left; font: inherit; color: inherit;
  display: flex; flex-direction: column; gap: 3px;
}
.cal-day:hover { background: #f2f8ff; }
.cal-day.out { background: #fafbfc; color: #b8c2ce; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-day.sel { background: #eaf4fd; box-shadow: inset 0 0 0 2px var(--brand-dark); }
.cal-day .daynum { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; gap: 4px; }
.cal-day.today .daynum { color: var(--brand); }
.cal-day .daynum .nb { margin-left: auto; background: #eef2f7; border-radius: 999px; padding: 0 6px; font-size: 11px; }
.cal-day.weekend { background: #fcfdfe; }
.cal-day.weekend.out { background: #f7f8fa; }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 3px; }

/* --- Vue liste --- */
.jour-section { border-bottom: 1px solid var(--line); }
.jour-section:last-child { border-bottom: 0; }
.jour-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: #f8fafc; position: sticky; top: 0; z-index: 1; cursor: pointer;
  border: 0; border-left: 0; border-right: 0; border-top: 0; width: 100%; font: inherit; color: inherit; text-align: left;
}
.jour-head:hover { background: #eef4fa; }
.jour-head .jh-dow { font-size: 11.5px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.jour-head .jh-date { font-size: 15px; font-weight: 700; }
.jour-head .jh-nb { margin-left: auto; font-size: 12px; color: var(--muted); }
.jour-section.aujourdhui .jour-head { background: #eaf4fd; }
.jour-section.aujourdhui .jh-date { color: var(--brand); }
.jour-section.retard .jour-head { background: #fdecea; }
.jour-section.retard .jh-date { color: var(--red); }
.jour-body { padding: 10px 16px; display: flex; flex-direction: column; gap: 8px; }

/* --- Carte intervention --- */
.rdv-card {
  display: flex; gap: 14px; align-items: flex-start;
  border: 1px solid var(--line); border-left: 4px solid var(--brand);
  border-radius: 10px; padding: 10px 14px; background: #fff;
}
.rdv-card.effectuee { border-left-color: var(--green); background: #fafdfb; }
.rdv-card.annulee { border-left-color: #b8c2ce; background: #fafbfc; }
.rdv-card.retard { border-left-color: var(--red); background: #fffaf9; }
.rdv-card.confirme { border-left-color: var(--pink); background: #fdf2f8; }
.tl-ev.confirme { background: #fdf2f8; border-color: #f9a8d4; border-left-color: var(--pink); color: #9d174d; }
.tl-ev.confirme .tl-ev-etat { background: #fff; color: #be185d; border-color: #f9a8d4; }
.tc-ev.confirme b { color: #9d174d; }
.rc-heure { text-align: center; min-width: 62px; }
.rc-heure .h { font-size: 17px; font-weight: 700; }
.rc-heure .d { font-size: 11.5px; color: var(--muted); }
.rc-main { flex: 1; min-width: 0; }
.rc-title { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rc-contact { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.rc-contact a { color: var(--brand-dark); }
.rc-tags { margin-top: 5px; }
.rc-cr {
  margin-top: 6px; font-size: 13px; background: #fffbe6;
  border-left: 3px solid #e0c341; border-radius: 0 6px 6px 0; padding: 5px 9px;
}
.rc-actions { display: flex; flex-direction: column; gap: 5px; flex: none; }
.rc-actions .btn { justify-content: center; }

/* --- Vue créneaux (grille horaire) --- */
.tl-head { display: flex; border-bottom: 1px solid var(--line); background: #f8fafc; }
.tl-head .gout { width: 64px; flex: none; border-right: 1px solid var(--line); }
.tl-head .jh {
  flex: 1; min-width: 0; padding: 8px 6px; text-align: center;
  border-right: 1px solid var(--line); cursor: pointer; font: inherit; color: inherit;
}
.tl-head .jh:hover { background: #eef4fa; }
.tl-head .jh .dow { display: block; font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.tl-head .jh .dt { display: block; font-size: 16px; font-weight: 700; }
.tl-head .jh.auj { background: #eaf4fd; }
.tl-head .jh.auj .dt, .tl-head .jh.auj .dow { color: var(--brand); }
.tl-head .jh.sel { box-shadow: inset 0 0 0 2px var(--brand-dark); }
.tl-head .jh .nb { font-size: 11px; color: var(--muted); }

.tl-body { display: flex; }
.tl-gout { width: 64px; flex: none; border-right: 1px solid var(--line); background: #f8fafc; }
.tl-h {
  height: var(--slot-h); font-size: 11.5px; color: var(--muted);
  text-align: right; padding: 2px 7px 0 0; border-bottom: 1px solid #eef2f7; box-sizing: border-box;
}
.tl-h.pleine { color: var(--ink); font-weight: 600; }
.tl-cols { flex: 1; display: flex; }
.tl-col {
  flex: 1; min-width: 0; position: relative; cursor: pointer;
  background-image: repeating-linear-gradient(to bottom, #eef2f7 0 1px, transparent 1px var(--slot-h));
  background-size: 100% calc(var(--slot-h) * 1);
}
.tl-col:nth-child(even) { background-color: #fcfdfe; }
.tl-col.auj { background-color: #f7fbff; }
.tl-col:hover { background-color: #f2f8ff; }
.tl-col.sel { box-shadow: inset 0 0 0 2px var(--brand-dark); }
.tl-col .demi { position: absolute; left: 0; right: 0; border-top: 1px dotted #e3e9f0; }

.tl-ev {
  position: absolute; overflow: hidden; border-radius: 6px; padding: 3px 6px;
  font-size: 11.5px; line-height: 1.25; cursor: pointer;
  background: #e8f2fc; border: 1px solid #bcd8f0; border-left: 3px solid var(--brand);
  color: #10344f;
}
.tl-ev:hover { filter: brightness(.97); z-index: 3; }
.tl-ev b { display: block; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-ev i { font-style: normal; display: block; color: #3a5b78; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-ev.effectuee { background: #e6f5ec; border-color: #a9d8bd; border-left-color: var(--green); color: #14502f; }
.tl-ev.effectuee b { text-decoration: line-through; }
.tl-ev.annulee { background: #f0f2f5; border-color: #ccd3db; border-left-color: #98a3b0; color: #6b7684; }
.tl-ev.annulee b { text-decoration: line-through; }
.tl-ev.retard { background: #fdecea; border-color: #f0b5ad; border-left-color: var(--red); color: #8a2318; }
.tl-ev.sel { box-shadow: 0 0 0 2px var(--brand-dark); z-index: 4; }
.tl-ev .marque { font-weight: 700; }
.tl-ev-etat {
  float: right; font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .3px; padding: 1px 5px; border-radius: 20px; margin-left: 5px;
  background: #ffffffcc; color: #3a5b78; border: 1px solid #bcd8f0;
  text-decoration: none;
}
.tl-ev.retard .tl-ev-etat { background: #fff; color: var(--red); border-color: #f0b5ad; }
.tl-ev.effectuee .tl-ev-etat { background: #fff; color: var(--green); border-color: #a9d8bd; }
.tl-ev.annulee .tl-ev-etat { background: #fff; color: #6b7684; border-color: #ccd3db; }

/* Confirmation empilée, la modale du dessous reste ouverte */
.confirm-box {
  position: fixed; inset: 0; z-index: 400; display: flex;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(15, 23, 42, .5);
}
.cb-card {
  background: #fff; border-radius: 12px; padding: 22px; max-width: 400px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .28);
}
.cb-msg { font-size: 16px; font-weight: 700; margin: 0 0 6px; }
.cb-detail { font-size: 13.5px; color: var(--muted); margin: 0 0 16px; }
.cb-actions { display: flex; gap: 9px; justify-content: flex-end; }
.tl-ev[draggable] { cursor: grab; }
.tl-ev[draggable]:active { cursor: grabbing; }
.tl-ev.glisse { opacity: .4; }
.tl-col.survol { background-color: #e8f3fd; }
.tl-indice {
  position: absolute; left: 0; right: 0; border-top: 2px dashed var(--brand);
  z-index: 6; pointer-events: none;
}
.tl-indice span {
  position: absolute; right: 2px; top: -17px; background: var(--brand); color: #fff;
  font-size: 10.5px; font-weight: 700; padding: 1px 5px; border-radius: 4px; white-space: nowrap;
}

.depl-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #fff3e0; border: 1px solid #f3c98a; color: #7a4a05;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 13.5px;
}
.depl-banner b { font-weight: 700; }
.depl-banner .spacer { flex: 1; }

.tl-hors {
  padding: 8px 16px; background: #fffbe6; color: #7a5c00;
  font-size: 13px; border-top: 1px solid #f0e2b0;
}

/* ---------- Département à côté du nom ---------- */

.dept {
  display: inline-block; margin-left: 5px; padding: 0 5px;
  background: #eef2f7; color: #4a5b70; border: 1px solid #d3dce7;
  border-radius: 4px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .3px; vertical-align: middle; white-space: nowrap;
}
.tl-ev .dept, .rchip .dept { background: #ffffffb3; }

/* ---------- Vue Techniciens : lignes = techniciens, colonnes = créneaux ---------- */

/* ---------- Vue Équipes (une ligne par technicien, une colonne par jour) ---------- */
.eq { background: #fff; border-radius: 8px; overflow-x: auto; }
/* Chaque jour garde au moins 220 px : sur un petit écran le planning défile de côté
   plutôt que d'écraser les noms des clients. */
.eq-entete, .eq-ligne, .eq-legende { min-width: calc(200px + var(--nb, 5) * 220px); }
.eq-entete {
  display: flex; background: #fff; border-bottom: 1px solid var(--line);
}
.eq-coin {
  width: 200px; flex: none; display: flex; align-items: center; padding: 0 18px;
  font-size: 17px; color: #4a6a8a; font-weight: 500;
}
.eq-jours { flex: 1; display: grid; grid-template-columns: repeat(var(--nb), 1fr); }
.eq-jour {
  text-align: center; padding: 14px 4px;
  border-left: 1px solid #f0f3f7; line-height: 1.5;
}
.eq-jour span { display: block; color: var(--muted); font-size: 14px; }
.eq-jour b { font-size: 16px; color: var(--ink); }
.eq-jour.auj b { color: var(--brand); }
.eq-jour.auj { box-shadow: inset 0 -3px 0 var(--brand); }

.eq-ligne { display: flex; border-bottom: 1px solid #eef1f5; }
.eq-nom {
  width: 200px; flex: none; display: flex; align-items: center; gap: 6px;
  padding: 0 18px; font-size: 16px; font-weight: 500; color: var(--ink); white-space: nowrap;
}
.eq-nom svg { width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.eq-piste {
  flex: 1; position: relative; cursor: copy;
  background-image: linear-gradient(to right, #f0f3f7 1px, transparent 1px);
  background-size: calc(100% / var(--nb)) 100%;
}
.eq-piste.survol { background-color: #eef6ff; }
.eq-ev {
  position: absolute; height: 38px; box-sizing: border-box;
  display: flex; align-items: center; padding: 0 6px 0 10px;
  background: var(--c); color: #fff; border-radius: 7px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .1px; line-height: 1.2;
  overflow: hidden;
  box-shadow: inset 4px 0 0 rgba(0, 0, 0, .18), 0 1px 2px rgba(0, 0, 0, .08);
  cursor: pointer; transition: filter .12s, transform .12s;
}
.eq-coin, .eq-nom { position: sticky; left: 0; z-index: 3; background: #fff; }
.eq-txt {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; word-break: break-word;
}
.eq-ev:hover { filter: brightness(1.06); transform: translateY(-1px); z-index: 2; }
.eq-ev.retard { box-shadow: inset 4px 0 0 #b3261e, 0 0 0 2px #e5534b; }
.eq-ev.st-annule { opacity: .5; text-decoration: line-through; }

/* Bandeau « Planning » de la fiche : statut du chantier */
.statut-bandeau {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 14px; padding: 12px 14px; background: #f8fafc;
  border: 1px solid var(--line); border-radius: 12px;
}
.statut-bandeau h3 { margin: 0; font-size: 16px; }
.statut-mail { font-size: 12.5px; color: var(--brand); }
.statut-select {
  margin-left: auto; width: auto; min-width: 170px;
  font: inherit; font-weight: 700; font-size: 14px;
  color: var(--c); background: color-mix(in srgb, var(--c) 10%, #fff);
  border: 1.5px solid var(--c); border-radius: 10px; padding: 7px 12px; cursor: pointer;
}
.statut-select option { color: var(--ink); background: #fff; font-weight: 500; }
.eq-ev.glisse { opacity: .4; }
.eq-ev.depl { outline: 2px dashed var(--ink); outline-offset: 2px; }
.eq-legende {
  display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 12px 18px;
  font-size: 12.5px; color: var(--ink-2, #445);
}
.eq-legende span { display: inline-flex; align-items: center; gap: 6px; }
.eq-legende i { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
@media (max-width: 900px) {
  .eq-coin, .eq-nom { width: 120px; padding: 0 10px; font-size: 14px; }
}

.tc { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.tc-entete { display: flex; background: #f8fafc; border-bottom: 1px solid var(--line); }
.tc-gout {
  width: 190px; flex: none; border-right: 1px solid var(--line);
  font-size: 11px; font-weight: 700; color: var(--muted);
  padding: 8px 10px; text-transform: uppercase; letter-spacing: .4px;
}
.tc-cols { flex: 1; display: flex; }
.th-cell {
  flex: 1; min-width: 0; font-size: 11px; color: var(--muted);
  padding: 8px 2px; text-align: center; border-left: 1px solid #eef2f6;
  white-space: nowrap; overflow: hidden;
}
.th-cell.h { color: var(--ink); font-weight: 700; border-left-color: #dde4ec; }

.tc-row { display: flex; border-bottom: 1px solid var(--line); }
.tc-row:last-of-type { border-bottom: 0; }
.tc-nom {
  width: 190px; flex: none; border-right: 1px solid var(--line);
  padding: 9px 10px; display: flex; flex-direction: column; gap: 2px;
  border-left: 4px solid transparent;
}
.tc-nom b { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-hors {
  font-style: normal; font-size: 10px; font-weight: 700; margin-left: 5px;
  background: #fff3e0; color: #8a4b12; border: 1px solid #f0cba4;
  border-radius: 3px; padding: 0 3px; vertical-align: middle;
}
.tc-nom span { font-size: 11.5px; opacity: .8; }
.tc-grille {
  flex: 1; position: relative; min-width: 0;
  background-image: repeating-linear-gradient(
    to bottom, transparent 0, transparent calc(var(--slot-h) - 1px), #eef2f6 calc(var(--slot-h) - 1px), #eef2f6 var(--slot-h));
}
.tc-grille:hover { background-color: #f2f8ff; }
.tc-grille.survol { background-color: #e8f3fd; }
.tc-ev {
  position: absolute; z-index: 2; overflow: hidden; cursor: pointer;
  border: 1px solid; border-left: 3px solid; border-radius: 5px;
  padding: 2px 5px; line-height: 1.25;
}
.tc-ev:hover { filter: brightness(.97); z-index: 3; }
.tc-ev b { display: block; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-ev i { font-style: normal; display: block; font-size: 11px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-ev .tc-dept { font-size: 10px; font-weight: 700; background: #ffffffb3; border: 1px solid; border-radius: 3px; padding: 0 3px; margin-left: 3px; }
.tc-ev.effectuee b, .tc-ev.annulee b { text-decoration: line-through; }
.tc-ev.annulee { opacity: .6; }
.tc-ev.sel { box-shadow: 0 0 0 2px var(--brand-dark); z-index: 4; }
.tc-ev[draggable]:active { cursor: grabbing; }
.tc-ev.glisse { opacity: .4; }
.tc-pied {
  padding: 9px 14px; background: #f8fafc; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted);
}

/* ---------- Liste des techniciens dans les paramètres ---------- */

.chips-tech { display: flex; flex-wrap: wrap; gap: 7px; min-height: 30px; }
.chip-tech {
  display: inline-flex; align-items: center; gap: 6px;
  background: #eef4fa; border: 1px solid #c3d9ee; color: #14507f;
  border-radius: 999px; padding: 4px 6px 4px 11px; font-size: 13px; font-weight: 600;
}
.chip-tech button {
  border: 0; background: #ffffffb3; color: #14507f; cursor: pointer;
  width: 19px; height: 19px; border-radius: 50%; line-height: 1; font-size: 11px; padding: 0;
}
.chip-tech button:hover { background: #f0b5ad; color: #fff; }

/* Avancement remonté par l'appli technicien */
.tech-resume {
  margin-top: 5px; font-size: 12.5px; font-weight: 600; color: #0f6d3f;
  background: #eafaf1; border: 1px solid #bfe8d2; border-radius: 7px; padding: 3px 9px; display: inline-block;
}
.tech-com { margin-top: 6px; }
.tech-com ul { margin: 4px 0 0; padding-left: 18px; }
.tech-com li { font-size: 12.5px; margin-bottom: 2px; }

/* Comptes de l'application technicien (Paramètres) */
.liste-acces { display: flex; flex-direction: column; gap: 8px; }
.acces-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--line, #e5e9f0); border-radius: 9px; padding: 9px 12px; background: #fbfcfe;
}
.acces-row .acces-nom { font-weight: 700; min-width: 140px; }
.acces-row .acces-login { font-family: monospace; color: #14507f; }
.acces-row .acces-mdp { color: #2e7d32; font-size: 12.5px; }
.acces-row .acces-mdp.manquant { color: #c0392b; }
.acces-row .acces-actions { margin-left: auto; display: flex; gap: 6px; }
.acces-row.inactif { opacity: .65; }

@media (max-width: 1100px) {
  .tc-gout, .tc-nom { width: 130px; }
}

@media (max-width: 1000px) {
  .tl-head .jh .dt { font-size: 13px; }
  .tl-gout, .tl-head .gout { width: 46px; }
  .tl-h { font-size: 10.5px; }
}

.fiche-ev {
  display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 16px;
  background: #f6f9fc; border: 1px solid var(--line); border-radius: 10px;
}
.fiche-ev .grow { flex: 1; min-width: 160px; }
.fiche-ev-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fiche-ev-actions .mini { font-size: 11px; color: var(--muted); width: 100%; margin-bottom: -2px; }
.cr-box {
  white-space: pre-wrap; background: #f6f9fc; border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; font-size: 13.5px; margin-bottom: 8px;
}
.alert-inline {
  background: #fdecea; color: #8a2318; border: 1px solid #f0b5ad;
  padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px;
}

.plan-empty { padding: 34px 20px; text-align: center; color: var(--muted); }

@media (max-width: 1000px) {
  .week { grid-template-columns: 1fr; }
  .week-col { min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .week-add { opacity: 1; }
  .plan-bar .nav strong { min-width: 0; }
  .rc-actions { flex-direction: row; flex-wrap: wrap; }
}

/* ---------- Modale ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 32, 48, .5);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}
.modal {
  background: var(--card);
  border-radius: 14px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.modal-head {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; flex: 1; font-size: 17px; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Toasts ---------- */
.toast-wrap {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 11px 16px;
  border-radius: 9px;
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: slide .18s ease-out;
  max-width: 340px;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } }

@media print {
  .sidebar, .topbar, .toolbar, .cal-head, .btn { display: none !important; }
}

/* ---------- Alerte mot de passe par défaut ---------- */

.alerte-mdp {
  background: #fdecea; border: 1px solid #f0b5ad; color: #8a2318;
  padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13.5px; line-height: 1.5;
}

/* ---------- Photos de l'installation (fiche client) ---------- */

.photos { display: flex; flex-wrap: wrap; gap: 10px; }
.photos .photo {
  display: block; width: 108px; height: 108px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line, #e5e9f0); background: #f5f7fa; transition: transform .15s;
}
.photos .photo:hover { transform: scale(1.04); }
.photos .photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Collaborateur connecté : les réglages et la gestion des accès sont réservés à l'administrateur */
body.role-collaborateur .admin-only { display: none !important; }
.side-hello-title span:not(:empty)::before { content: ", "; }

/* Demandes reçues du formulaire du site (tableau de bord) */
.demandes-tete { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.demandes-tete h2 { margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.badge-nonlu, .side-badge {
  font-style: normal; font-size: 12px; font-weight: 700; line-height: 1;
  background: #ff3d68; color: #fff; border-radius: 999px; padding: 4px 8px;
}
.side-badge { margin-left: auto; }
.demande.non-lue { background: #fff4f6; border-left: 3px solid #ff3d68; }
.badge.nouveau-client { background: #e6f6ec; color: #17864f; }
.badge.client-existant { background: #fff2e5; color: #a85a00; }

/* Avis de passage dans la fiche d'intervention */
.avis-etat { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.avis-etat.signe { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.avis-etat .avis-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.badge.avis-signe { background: #e6f6ec; color: #17864f; text-decoration: none; }
.badge.avis-signe:hover { background: #d3efdd; }

/* Collaborateur : il ne voit que la semaine en cours */
.collab-only { display: none; }
body.role-collaborateur .collab-only { display: block; }
.bandeau-semaine {
  margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; font-size: 13.5px;
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
}

/* ================= Téléphones et tablettes ================= */
/* Rien ne doit élargir la page : sinon le téléphone la « dézoome » entièrement. */
.main { overflow-x: clip; }
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg-btn { flex: none; white-space: nowrap; }

@media (max-width: 900px) {
  .content { padding: 14px 12px 60px; }
  .topbar { padding: calc(10px + env(safe-area-inset-top)) 12px 10px; gap: 10px; }
  .page-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .btn-primary { padding: 9px 12px; font-size: 14px; white-space: nowrap; }
  .sidebar { padding-top: env(safe-area-inset-top); }
  /* Champs en 16 px : l'iPhone ne zoome plus à chaque saisie */
  input, select, textarea { font-size: 16px; }

  .plan-bar #planViews { flex: 1 1 100%; }
  .plan-bar .spacer { display: none; }
  .plan-bar #btnNouveauRdv { flex: 1 1 100%; }
  .plan-filters select { min-width: 0; flex: 1 1 140px; }

  /* Fenêtres : elles montent du bas de l'écran et occupent toute la largeur */
  .modal-backdrop { padding: 0; place-items: end stretch; }
  .modal { max-width: none; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .modal-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1 1 auto; }

  .toast-wrap { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
}

/* Liste des clients : sur téléphone et tablette, chaque client devient une carte */
@media (max-width: 700px) {
  .toolbar input[type=search], .toolbar select { max-width: none; flex: 1 1 100%; }
  .toolbar .spacer { display: none; }
  .toolbar .btn { flex: 1 1 auto; }
}
@media (max-width: 1100px) {
  #clientsBody { display: block; }
  [data-panel=clients] .table thead { display: none; }
  [data-panel=clients] .table, [data-panel=clients] .table tbody { display: block; }
  #clientsBody tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  #clientsBody td { display: flex; gap: 10px; padding: 3px 0; border: 0; min-width: 0; }
  #clientsBody td[data-l]::before {
    content: attr(data-l); flex: none; width: 92px; color: var(--muted); font-size: 12.5px; padding-top: 1px;
  }
  #clientsBody td > * { min-width: 0; overflow-wrap: anywhere; }
  #clientsBody td.td-titre { display: block; font-size: 16px; padding-bottom: 6px; }
  #clientsBody td.td-actions { padding-top: 8px; }
}

/* Le menu fermé ne projette plus son ombre sur le bord de l'écran */
@media (max-width: 900px) {
  .sidebar { box-shadow: none; }
  body.menu-ouvert .sidebar { box-shadow: 10px 0 30px rgba(0, 0, 0, .25); }
}

/* Fenêtres (fiche client, formulaires) : jamais plus larges que l'écran */
.modal-backdrop { grid-template-columns: minmax(0, 1fr); }
.modal { min-width: 0; }
.modal-body { overflow-x: hidden; }
@media (max-width: 600px) {
  .form-row, .form-row-2 { grid-template-columns: minmax(0, 1fr); }
  .item { flex-wrap: wrap; }
  .modal-head h2 { font-size: 16px; }
  .modal-body { padding: 14px; }
}

/* Vue mois : 7 colonnes égales, rendez-vous compacts sur téléphone */
.cal-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
@media (max-width: 700px) {
  .cal-dow { padding: 6px 0; font-size: 10.5px; }
  .cal-day { min-height: 62px; padding: 3px; gap: 2px; }
  .cal-day .daynum .nb { display: none; }
  .cal-day .rchip { font-size: 10px; padding: 1px 3px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .cal-day .rchip * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tc-gout, .tc-nom { width: 64px; }
}

/* Tablette : les cartes clients sur deux colonnes */
@media (min-width: 701px) and (max-width: 1100px) {
  #clientsBody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #clientsBody tr { border-right: 1px solid var(--line); }
  #clientsBody tr:nth-child(2n) { border-right: 0; }
}

/* ================= Devis ================= */
.badge.devis-brouillon { background: #eef2f7; color: #475569; }
.badge.devis-envoye { background: #e8f1fd; color: #0f5fa8; }
.badge.devis-accepte { background: #e6f6ec; color: #17864f; }
.badge.devis-refuse { background: #fdecea; color: #b3261e; }
.devis-montant { font-weight: 700; white-space: nowrap; text-align: right; min-width: 96px; }
.devis-montant span { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }

.ligne-devis {
  display: grid; gap: 6px; align-items: center; margin-bottom: 6px;
  grid-template-columns: 130px minmax(0, 1fr) 90px 64px 96px 100px 92px 34px;
}
.ligne-devis input, .ligne-devis select { padding: 7px 8px; font-size: 14px; min-width: 0; }
.ligne-devis .ld-total { text-align: right; font-weight: 600; white-space: nowrap; }
.ligne-devis .icon-btn { width: 32px; height: 32px; }
.ligne-devis-tete { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.ligne-devis-tete span:nth-child(7) { text-align: right; }
.ligne-devis { border-left: 3px solid transparent; padding-left: 6px; }
.ligne-devis[data-cat=piece] { border-left-color: #0f6fb5; }
.ligne-devis[data-cat=main_oeuvre] { border-left-color: #ea7a12; }
.ligne-devis[data-cat=deplacement] { border-left-color: #16a34a; }
.ligne-devis[data-cat=autre] { border-left-color: #94a3b8; }
.ligne-devis-tete { border-left-color: transparent; }
.dv-ajouts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.dv-bas { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; margin-top: 6px; }
.dv-totaux { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; position: sticky; top: 0; }
.dv-totaux div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 14px; }
.dv-totaux span { color: var(--muted); }
.dv-totaux .dv-sep { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 9px; }
.dv-totaux .dv-ttc { background: var(--ink); color: #fff; border-radius: 8px; padding: 10px 12px; margin-top: 8px; font-size: 17px; }
.dv-totaux .dv-ttc span { color: #fff; }

/* Tablette et téléphone : chaque ligne du devis devient une petite carte */
@media (max-width: 900px) {
  .ligne-devis-tete { display: none; }
  .ligne-devis {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    background: #fbfcfe; border: 1px solid var(--line); border-left-width: 4px; border-radius: 10px; padding: 8px; margin-bottom: 8px;
  }
  .ligne-devis .ld-cat { grid-row: 1; grid-column: 1 / 4; }
  .ligne-devis .ld-ref { grid-row: 1; grid-column: 4 / 6; }
  .ligne-devis .ld-suppr { grid-row: 1; grid-column: 6; justify-self: end; }
  .ligne-devis .ld-des { grid-row: 2; grid-column: 1 / -1; }
  .ligne-devis .ld-qte { grid-row: 3; grid-column: 1 / 2; }
  .ligne-devis .ld-unite { grid-row: 3; grid-column: 2 / 4; }
  .ligne-devis .ld-prix { grid-row: 3; grid-column: 4 / 6; }
  .ligne-devis .ld-total { grid-row: 3; grid-column: 6; font-size: 13px; }
  .ligne-devis input, .ligne-devis select { font-size: 16px; }
  .dv-bas { grid-template-columns: minmax(0, 1fr); }
  .dv-totaux { position: static; }
}
@media (max-width: 600px) {
  .devis-item { flex-wrap: wrap; }
  .devis-item .grow { flex: 1 1 100%; }
  .devis-montant { margin-left: auto; }
}

/* Aperçu du devis avant envoi */
.apercu-devis { position: fixed; inset: 0; z-index: 80; background: rgba(16, 32, 48, .7); display: flex; flex-direction: column; }
.apercu-barre {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}
.apercu-barre .spacer { flex: 1; }
.apercu-devis iframe { flex: 1; width: 100%; max-width: 900px; margin: 16px auto; border: 0; border-radius: 10px; background: #fff; }
@media (max-width: 700px) {
  .apercu-barre b { flex: 1 1 100%; font-size: 14px; }
  .apercu-barre .spacer { display: none; }
  .apercu-barre .btn { flex: 1 1 auto; }
  .apercu-devis iframe { margin: 0; border-radius: 0; }
}
.dv-type-objet { grid-template-columns: minmax(160px, 220px) minmax(0, 1fr); }
@media (max-width: 600px) { .dv-type-objet { grid-template-columns: minmax(0, 1fr); } }

/* Paiement en ligne du devis */
.badge.devis-paye { background: #16a34a; color: #fff; }
.dv-paiement { border: 1px solid var(--line); background: #f8fafc; border-radius: 12px; padding: 12px 14px; margin: 4px 0 14px; display: grid; gap: 6px; }
.dv-paiement.paye { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.dv-lien { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.dv-lien input { flex: 1 1 260px; min-width: 0; font-size: 13px; padding: 7px 9px; background: #fff; }
.dv-alerte { color: #9a3412; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; padding: 6px 10px; }

/* Signature électronique du devis */
.badge.devis-signe { background: #fdf2f8; color: #9d174d; }
.dv-paiement.signe { border-color: #bbf7d0; }
.dv-etat { font-size: 13.5px; color: var(--muted); }
.dv-etat.ok { color: #166534; }
.dv-etat a { color: inherit; }
.dv-verrou { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.modal-body input:disabled, .modal-body select:disabled, .modal-body textarea:disabled { background: #f1f5f9; color: #475569; cursor: not-allowed; opacity: 1; }

/* Barre des onglets techniciens retirée du planning (le filtre reste dans « Filtres ») */
#planTabsWrap { display: none !important; }
#planTabsRow { justify-content: flex-end; }

/* Vue Équipes : toute la semaine (lundi → vendredi) visible d'un coup, sans faire défiler */
.eq-entete, .eq-ligne, .eq-legende { min-width: calc(150px + var(--nb, 5) * 108px); }
.eq-coin, .eq-nom { width: 150px; padding: 0 12px; font-size: 15px; }
.eq-jour { padding: 12px 2px; }
.eq-jour span { font-size: 13px; }
.eq-jour b { font-size: 15px; }
@media (min-width: 1500px) {
  .eq-coin, .eq-nom { width: 190px; padding: 0 18px; font-size: 16px; }
}
@media (max-width: 700px) {
  .eq-coin, .eq-nom { width: 100px; padding: 0 8px; font-size: 13.5px; }
  .eq-entete, .eq-ligne, .eq-legende { min-width: calc(100px + var(--nb, 5) * 104px); }
}
.eq-ev { padding: 0 4px 0 8px; font-size: 10.5px; letter-spacing: 0; }
.eq-txt { word-break: normal; overflow-wrap: anywhere; }

/* Ordinateur et tablette : la semaine tient TOUJOURS dans la largeur, sans barre de défilement */
@media (min-width: 701px) {
  .eq { overflow-x: hidden; }
  .eq-entete, .eq-ligne, .eq-legende { min-width: 0; }
  .eq-jours, .eq-piste { min-width: 0; }
}
@media (min-width: 701px) and (max-width: 1100px) {
  .eq-coin, .eq-nom { width: 120px; padding: 0 10px; font-size: 14px; }
  .eq-jour span { font-size: 12px; }
  .eq-jour b { font-size: 13.5px; }
}

/* Bouton « À décaler » de la fiche rendez-vous */
.btn-decaler { background: #fff7ed; color: #c2410c; border-color: #fdba74; }
.btn-decaler:hover { background: #ffedd5; }

/* Vue « À décaler » du planning */
.seg-decaler em { font-style: normal; font-size: 11px; font-weight: 700; background: #dc2626; color: #fff; border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.decaler-liste { display: flex; flex-direction: column; gap: 14px; padding: 14px; }
.decaler-item { border: 1px solid #fdba74; border-left: 5px solid #f97316; border-radius: 12px; background: #fff; padding: 12px; display: grid; gap: 10px; }
.decaler-item .rdv-card { border-left-color: #f97316; }
.decaler-avant { font-size: 13.5px; color: #9a3412; }
.decaler-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; background: #fff7ed; border-radius: 10px; padding: 10px 12px; }
.decaler-titre { font-weight: 700; color: #9a3412; align-self: center; }
.decaler-form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.decaler-form input, .decaler-form select { padding: 7px 9px; min-width: 0; }
@media (max-width: 700px) {
  .decaler-form label { flex: 1 1 45%; }
  .decaler-form .btn { flex: 1 1 100%; }
}

/* Carte d'intervention (vues Liste et À décaler) sur téléphone */
.rc-main { flex: 1; min-width: 0; }
@media (max-width: 700px) {
  .rdv-card { flex-wrap: wrap; gap: 10px; padding: 10px 12px; }
  .rdv-card .rc-heure { min-width: 0; text-align: left; display: flex; gap: 8px; align-items: baseline; flex: 1 1 100%; }
  .rdv-card .rc-main { flex: 1 1 100%; }
  .rdv-card .rc-contact { overflow-wrap: anywhere; }
  .rdv-card .rc-actions { flex: 1 1 100%; display: flex; flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .rdv-card .rc-actions .btn { flex: 1 1 auto; }
  .decaler-liste { padding: 8px; }
  .decaler-item { padding: 10px; }
}
.decaler-ailleurs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); background: #fff7ed; }
.decaler-ailleurs b { color: #9a3412; flex: 1 1 100%; }
.decaler-lien { font: inherit; font-size: 13px; border: 1px solid #fdba74; background: #fff; color: #9a3412; border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.decaler-lien:hover { background: #ffedd5; }

/* Raison du décalage */
.raison-card { max-width: 480px; width: 100%; }
.raison-choix { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.raison-puce { font: inherit; font-size: 13px; border: 1px solid #fdba74; background: #fff7ed; color: #9a3412; border-radius: 999px; padding: 5px 11px; cursor: pointer; }
.raison-puce:hover { background: #ffedd5; }
.raison-texte { width: 100%; box-sizing: border-box; resize: vertical; }
.raison-err { color: var(--red); font-size: 13px; font-weight: 600; min-height: 1em; margin: 6px 0 10px; }
.btn-decaler-plein { background: #f97316; color: #fff; border-color: #f97316; }
.btn-decaler-plein:hover { background: #ea580c; }
.motif-decalage { background: #fff7ed; border: 1px solid #fdba74; border-left: 5px solid #f97316; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.motif-decalage .md-titre { font-weight: 800; color: #c2410c; font-size: 15px; }
.motif-decalage .md-raison { margin-top: 4px; font-size: 15px; color: var(--ink); }
.motif-decalage .md-raison span { color: #9a3412; font-weight: 600; }
.motif-decalage .md-quand { margin-top: 3px; font-size: 12.5px; color: var(--muted); }

/* Fenêtre « Replacer » */
.replacer-card { max-width: 520px; width: 100%; }
.creneaux-proposes { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.creneau-puce { font: inherit; font-size: 13.5px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 11px; cursor: pointer; }
.creneau-puce:hover { border-color: var(--brand); }
.creneau-puce.actif { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.replacer-champs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.replacer-champs label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.replacer-champs input, .replacer-champs select { min-width: 0; }
@media (max-width: 600px) { .replacer-champs { grid-template-columns: minmax(0, 1fr); } }
