:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1b2733;
  --muted: #66778a;
  --line: #e2e7ec;
  --side: #0b2840;
  --side-ink: #c9d8e4;
  --accent: #1f75b8;   /* bleu du logo, foncé pour que le texte blanc se lise */
  --logo-blue: #68b2e3; /* bleu exact du logo (menu foncé) */
  --accent-ink: #ffffff;
  --accent-soft: #e6f2fb;
  --green: #2e9e5b;  --green-soft: #e4f5ea;
  --amber: #c98a12;  --amber-soft: #fbf1dc;
  --red: #c94343;    --red-soft: #fbe6e6;
  --blue: #3c6fd1;   --blue-soft: #e6eefb;
  --gray-soft: #eef1f4;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 1px 1px rgba(16, 32, 48, .04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1a23; --panel: #16232f; --ink: #e3ebf2; --muted: #8fa2b4; --line: #26384a;
    --side: #0a1620; --accent: #3a8fd4; --accent-soft: #12304a;
    --green-soft: #143222; --amber-soft: #3a2c10; --red-soft: #3a1717; --blue-soft: #172846; --gray-soft: #1f2e3c;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1a23; --panel: #16232f; --ink: #e3ebf2; --muted: #8fa2b4; --line: #26384a;
  --side: #0a1620; --accent: #3a8fd4; --accent-soft: #12304a;
  --green-soft: #143222; --amber-soft: #3a2c10; --red-soft: #3a1717; --blue-soft: #172846; --gray-soft: #1f2e3c;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 Inter, system-ui, sans-serif; background: var(--bg); color: var(--ink); display: flex; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 10px; }
small, .muted { color: var(--muted); }

/* Barre latérale */
.side { width: 230px; flex: none; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; color: #fff; text-decoration: none !important; }
.brand small { display: block; color: var(--side-ink); font-size: 12px; }
.side .brand { flex-direction: column; align-items: stretch; gap: 6px; padding: 14px 12px 12px; }
.brand-logo { display: block; background: #fff; border-radius: 10px; padding: 8px 10px; }
.brand-logo img { display: block; width: 100%; height: auto; }
.side .brand small { text-align: center; font-size: 11px; letter-spacing: .02em; }
.logo { width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.side nav { display: flex; flex-direction: column; padding: 4px 8px; gap: 1px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent; }
.side nav a { color: var(--side-ink); padding: 6px 10px; border-radius: 8px; display: flex; gap: 10px; align-items: center; text-decoration: none; }
.side nav a i { font-style: normal; width: 18px; height: 18px; flex: none; display: grid; place-items: center; opacity: .85; }
.side nav a i svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side nav a.on i { opacity: 1; }
.side nav a:hover { background: rgba(255, 255, 255, .06); }
.side nav a.on { background: rgba(104, 178, 227, .18); color: #fff; box-shadow: inset 3px 0 0 var(--logo-blue); }
.side nav a.on i { color: var(--logo-blue); }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .55; padding: 10px 10px 3px; }
.me { margin-top: auto; padding: 14px 16px; font-size: 12px; border-top: 1px solid rgba(255, 255, 255, .08); }
.me .logout { display: block; width: 100%; margin-top: 10px; padding: 7px 10px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .18);
  background: transparent; color: #cbd5e1; font: inherit; text-align: left; cursor: pointer; }
.me .logout:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow-y: auto; }
.top { display: flex; gap: 12px; align-items: center; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.burger { display: none; border: 0; background: none; font-size: 20px; color: var(--ink); cursor: pointer; }
.search { flex: 1; max-width: 560px; }
.search input, .field { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; }
.view { padding: 24px; width: 100%; }   /* remplit l'écran, peu importe sa largeur */
body[data-page="schedule"] .view, body[data-page="dispatch"] .view, body[data-page="routes"] .view { max-width: none; }

/* Blocs */
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.head .sub { color: var(--muted); margin-top: 4px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g31 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.kpi .n { font-size: 26px; font-weight: 700; margin-top: 4px; }
.kpi .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpi a { color: inherit; }
.stack > * + * { margin-top: 16px; }

.flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; padding: 0; overflow: hidden; }
.flow a { padding: 16px; border-left: 4px solid; color: inherit; text-decoration: none; }
.flow a + a { border-top: 0; }
.flow a:hover { background: var(--bg); }
.flow .n { font-size: 24px; font-weight: 700; }
.flow .t { font-weight: 600; }
.flow .s { color: var(--muted); font-size: 12px; }
.c-req { border-color: #8a63d2 !important; } .c-quo { border-color: #d0499a !important; }
.c-job { border-color: #4d9e3f !important; } .c-inv { border-color: #3c6fd1 !important; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.link { cursor: pointer; }
tr.link:hover td { background: var(--bg); }
td.num, th.num { text-align: right; white-space: nowrap; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 5px 10px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip b { font-weight: 600; opacity: .7; margin-left: 4px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--gray-soft); color: var(--muted); }
.b-green { background: var(--green-soft); color: var(--green); }
.b-amber { background: var(--amber-soft); color: var(--amber); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-blue { background: var(--blue-soft); color: var(--blue); }
.b-accent { background: var(--accent-soft); color: var(--accent); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .field { max-width: 320px; }
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 8px 12px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 500; }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding-top: 12px; color: var(--muted); }

dl.kv { display: grid; grid-template-columns: fit-content(55%) minmax(0, 1fr); gap: 6px 14px; margin: 0; }
dl.kv dt, dl.kv dd { min-width: 0; overflow-wrap: anywhere; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.totals { margin-left: auto; width: min(320px, 100%); }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { font-weight: 700; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; font-size: 16px; }
.line-desc { color: var(--muted); font-size: 12px; white-space: pre-line; }
.line-img { display: block; max-width: 220px; max-height: 160px; border-radius: 6px; margin-top: 6px; border: 1px solid var(--line); }
tr.li.opt-off td { opacity: .6; }
.badge.opt-b { background: #fff3d6; color: #8a5a00; }
.li-photo { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.li-photo img { display: block; width: 72px; height: 54px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.pre { white-space: pre-line; }

/* Accueil : visites du jour */
.visit { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.visit:last-child { border-bottom: 0; }
.visit .time { width: 64px; flex: none; font-weight: 600; }

/* Calendrier */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-height: 280px; display: flex; flex-direction: column; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.day-h { padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 600; display: flex; justify-content: space-between; }
.day-h small { font-weight: 400; }
.day-b { padding: 6px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; max-height: 70vh; }
.ev { border-left: 4px solid var(--accent); background: var(--bg); border-radius: 6px; padding: 6px 8px; font-size: 12px; color: inherit; text-decoration: none !important; display: block; }
.ev:hover { filter: brightness(.97); }
.ev .t { font-weight: 600; }
.ev.done > :not(.ev-ok) { opacity: .55; }   /* visite terminée : grisée, sauf le crochet vert */
.ev-ok { position: absolute; top: 6px; right: 34px; width: 18px; height: 18px; border-radius: 50%; background: var(--green); color: #fff; font-size: 12px; font-weight: 700; line-height: 18px; text-align: center; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

.loading { color: var(--muted); padding: 40px 0; text-align: center; }
.error { background: var(--red-soft); color: var(--red); padding: 12px 14px; border-radius: 8px; }

@media (max-width: 1000px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g31, .g2 { grid-template-columns: minmax(0, 1fr); }
  .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; }
}
@media (max-width: 760px) {
  /* Cellulaire : hauteur visible réelle (barre d'outils de Safari) et menu entier défilable,
     pour que « Se déconnecter » reste accessible. */
  .side { position: fixed; left: -240px; z-index: 20; transition: left .2s; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; }
  .side nav { overflow: visible; flex: none; }
  .me { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  body.menu .side { left: 0; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  .burger { display: block; }
  .top { padding: 10px 16px; }
  .view { padding: 16px; }
  .hide-sm { display: none; }
}

/* Formulaires */
.form h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; }
.fl { display: block; margin-bottom: 10px; }
.fl > span, .lbl { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.fl.inline { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 8px; }
.fl.inline .field { width: 140px; }
textarea.field { resize: vertical; }
select.field { appearance: auto; }
.check { display: inline-flex; gap: 6px; align-items: center; margin: 4px 14px 4px 0; font-size: 13px; cursor: pointer; }
.row2, .row3 { display: grid; gap: 10px; }
.row2 { grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: 1fr 1fr 1fr; }
.multi { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.multi .field { flex: 1; min-width: 140px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.actions.spread { justify-content: space-between; }
.actions.spread > div { display: flex; gap: 8px; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.danger { color: var(--red); border-color: var(--red); }
/* Bouton principal qui devient une confirmation : rouge plein, texte blanc. */
.btn.primary.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary.danger:hover { filter: brightness(.92); }
.btn:disabled { opacity: .6; cursor: default; }
a.btn, a.chip { text-decoration: none !important; display: inline-block; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-h h2 { margin: 0; }
.techs { display: flex; flex-wrap: wrap; margin-bottom: 10px; }
.picked { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.picklist { display: flex; flex-direction: column; gap: 4px; }
.pick { text-align: left; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 8px 10px; cursor: pointer; font: inherit; }
.pick:hover { border-color: var(--accent); }
table.lines td { padding: 6px 4px; }
table.lines .field { padding: 7px 8px; }
table.lines td:first-child { min-width: 220px; }
table.lines .field.num { width: 90px; text-align: right; }
table.lines .desc { margin-top: 4px; font-size: 12px; }
.tx { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
.note { border-top: 1px solid var(--line); padding: 8px 0; }
.notes-f { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
details summary { cursor: pointer; color: var(--muted); margin: 6px 0; }

/* Fenêtre modale et messages */
.modal-bg { position: fixed; inset: 0; background: rgba(8, 20, 30, .45); display: grid; place-items: start center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--panel); border-radius: 12px; width: min(520px, 100%); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { width: min(720px, 100%); }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-h h2 { margin: 0; }
.modal-b { padding: 16px 18px; }
.jsb { position: sticky; top: 0; z-index: 5; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; }
.jsb-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.jsb-s { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; padding: 2px; background: none; border: 0; color: var(--muted); font: inherit; font-size: 15px; cursor: pointer; }
.jsb-n { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 17px; background: var(--line); color: var(--ink); }
.jsb-s.done { color: var(--ink); }
.jsb-s.done .jsb-n { background: var(--green); color: #fff; }
.jsb-s.now { color: var(--ink); font-weight: 700; }
.jsb-s.now .jsb-n { background: var(--accent); color: #fff; animation: js-pulse 1.2s ease-in-out infinite; }
.jsb-hint { margin-top: 8px; text-align: center; font-size: 16px; font-weight: 600; }
.js-flash { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 10px; animation: js-ring 1.2s ease-in-out infinite; }
@keyframes js-pulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 transparent; } 50% { transform: scale(1.18); box-shadow: 0 0 0 7px var(--accent-soft); } }
@keyframes js-ring { 0%, 100% { outline-color: var(--accent); } 50% { outline-color: transparent; } }
@media (prefers-reduced-motion: reduce) { .jsb-s.now .jsb-n, .js-flash { animation: none; } }
@media (max-width: 560px) { .jsb-s { flex-direction: column; gap: 3px; font-size: 12px; } .jsb-hint { font-size: 15px; } }
.x { border: 0; background: none; font-size: 24px; color: var(--muted); cursor: pointer; line-height: 1; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: 10px 16px; border-radius: 8px; z-index: 60; box-shadow: var(--shadow); max-width: 90vw; }
.toast.bad { background: var(--red); color: #fff; }

/* Document imprimable */
.paper { background: #fff; color: #1b2733; max-width: 820px; margin: 0 auto; padding: 40px; border: 1px solid var(--line); border-radius: 8px; }
.p-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 3px solid var(--accent); padding-bottom: 16px; }
.p-co { font-size: 20px; font-weight: 700; }
.p-logo { display: block; width: 280px; max-width: 100%; height: auto; margin-bottom: 10px; }
.p-doc { text-align: right; }
.p-title { font-size: 24px; font-weight: 700; color: var(--accent); }
.p-parties { display: flex; gap: 40px; margin: 20px 0; }
.p-parties .lbl { color: #66778a; }
.p-subject { margin-left: auto; text-align: right; max-width: 40%; }   /* objet de la facture : à droite, sur la ligne du client */
.p-lines { margin: 12px 0; }
.p-lines th { border-bottom: 2px solid #1b2733; color: #1b2733; }
.p-lines td { border-bottom: 1px solid #e2e7ec; }
.p-msg { margin-top: 20px; }
.p-foot { margin-top: 30px; color: #66778a; text-align: center; font-size: 12px; }
@media print {
  .side, .top, .noprint, .sync-alert { display: none !important; }   /* la bannière d’alerte des synchros ne va jamais sur papier ni en PDF */
  body, .main { display: block; height: auto; overflow: visible; background: #fff; }
  .view { padding: 0; max-width: none; }
  .paper { border: 0; padding: 0; max-width: none; }
  .p-parties { margin: 12px 0; }
}
@media screen and (max-width: 760px) {   /* écran étroit seulement : à l’impression (page étroite elle aussi), facture en 2 colonnes */
  .row3 { grid-template-columns: 1fr; }
  .paper { padding: 18px; }
  .p-head, .p-parties { flex-direction: column; gap: 12px; }
  .p-doc { text-align: left; }
  .p-subject { margin-left: 0; text-align: left; max-width: none; }
}

/* Pièces jointes d'une soumission : une ligne par fichier (nom, taille, retirer). */
.att-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.att-row a { flex: 1; word-break: break-word; }
/* Téléphone : rien ne doit dépasser l'écran ; les lignes de produits deviennent des blocs. */
.main, .view, .card, .stack, .grid > * { min-width: 0; }
@media (max-width: 760px) {
  .field, .search input { font-size: 16px; }          /* évite le zoom automatique d'iOS */
  .head { align-items: stretch; }
  .head .toolbar { width: 100%; }
  .head .toolbar .btn { flex: 1 1 auto; text-align: center; }
  .row2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  table.lines thead { display: none; }
  table.lines, table.lines tbody { display: block; }
  table.lines tr.li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto; gap: 6px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.lines tr.li td { display: block; padding: 0; border: 0; min-width: 0; }
  table.lines tr.li td:first-child { grid-column: 1 / -1; min-width: 0; }
  /* Soumissions : total + tx/option/choisie sur leur propre rangée, pour laisser toute la largeur à Qté et Prix. */
  #lines[data-photos="1"] tr.li td:nth-child(4) { grid-column: 1 / 4; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 4px 14px; }
  table.lines .field.num { width: 100%; }
  table.lines td.num { text-align: right; font-weight: 600; }
  .totals { width: 100%; }
  .multi .field { min-width: 0; flex-basis: 100%; }
  .modal-bg { padding: 0; display: block; }   /* bloc : la fenêtre grandit avec son contenu et le fond défile */
  .modal, .modal.wide { width: 100%; min-height: 100%; height: auto; border-radius: 0; }
  .actions .btn { flex: 1 1 auto; text-align: center; }
  .week { gap: 6px; }
  .day-b { max-height: none; }
  .p-lines th:nth-child(3), .p-lines td:nth-child(3) { display: none; }
}

/* Tournées */
.routes-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.map-col { position: sticky; top: 76px; }
.map { height: calc(100vh - 210px); min-height: 420px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--gray-soft); }
.routes-col { display: flex; flex-direction: column; gap: 10px; }
.route { padding: 12px; }
.route.on { box-shadow: 0 0 0 2px var(--rc); }
.route-h { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; margin: 0 0 6px; cursor: pointer; }
.route-h .muted { margin-left: auto; font-weight: 400; }
.small { font-size: 12px; }
.proposal { background: var(--amber-soft); color: var(--amber); border-radius: 6px; padding: 6px 8px; font-size: 12px; margin-bottom: 6px; }
.assign { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.assign .field { flex: 1 1 140px; padding: 6px 8px; }
.stops { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.stops li { display: grid; grid-template-columns: 22px 1fr; gap: 6px; }
.stops .num { width: 20px; height: 20px; border-radius: 50%; color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.late { color: var(--red); font-weight: 600; }
.warn-card { border-left: 4px solid var(--amber); }
@media (max-width: 1000px) {
  .routes-layout { grid-template-columns: minmax(0, 1fr); }
  .map-col { position: static; }
  .map { height: 55vh; min-height: 300px; }
}

/* Kim / Fermetures */
.status-banner { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; border-left: 4px solid currentColor; }
.status-banner span { color: var(--ink); }
.late-card { border-left: 4px solid var(--red); }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.bars li { display: grid; grid-template-columns: 90px minmax(60px, 1fr) 28px; gap: 8px; align-items: center; }
.bars .tags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; margin-top: -4px; }
.bar { height: 10px; background: var(--gray-soft); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
ul.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }

.wx { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.wx-day { border: 1px solid var(--line, #ddd); border-radius: 8px; padding: 6px; text-align: center; font-size: 13px; }
.wx-day.ok { background: rgba(34, 160, 80, .08); }
.wx-day.bad { background: rgba(220, 60, 60, .10); }
.wx-day.we { opacity: .6; }
.wx-day.freeze { border: 2px solid #3b82f6; }
.wx-i { font-size: 22px; line-height: 1.4; }

/* Calendrier : changer les dates */
.ev { position: relative; }
.ev-move { position: absolute; top: 4px; right: 4px; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 2px 5px; font-size: 14px; cursor: pointer; line-height: 1.2; }
.ev .t { padding-right: 30px; }
.ev.done .t { padding-right: 54px; }   /* place pour ✓ et 📅 */
/* Visite choisie dans la recherche du Calendrier : encadrée et qui clignote un peu. */
.ev.hl { outline: 3px solid #f5a623; outline-offset: 1px; background: #fff6e0; animation: ev-hl 1s ease-in-out 3; }
.ev.hl.done > :not(.ev-ok) { opacity: 1; }
@keyframes ev-hl { 50% { outline-color: transparent; } }
/* Roue d'attente (ex. recherche du coût à la réception) */
.spin { display: inline-block; width: 12px; height: 12px; margin-right: 5px; vertical-align: -2px; border: 2px solid rgba(127,127,127,.3); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
tr.found-hl td { background: #fff6e0; }
@media (prefers-color-scheme: dark) { .ev.hl { background: #4a3a10; } tr.found-hl td { background: #4a3a10; } }
.day.drop, .mday.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.seg { display: inline-flex; }
.seg .btn { border-radius: 0; }
.seg .btn:first-child { border-radius: 8px 0 0 8px; }
.seg .btn:last-child { border-radius: 0 8px 8px 0; margin-left: -1px; }
.seg .btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.cal-tip { margin: 0 0 10px; }
.unsched { margin-bottom: 12px; }
.unsched summary { cursor: pointer; }
.unsched-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; margin-top: 10px; max-height: 50vh; overflow-y: auto; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month .mh { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.mday { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-height: 84px; padding: 6px; display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none !important; min-width: 0; }
.mday.out { opacity: .45; }
.mday.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.mday .n { font-size: 12px; color: var(--muted); }
.mday .c { font-size: 18px; }
.mday .dots { display: flex; flex-wrap: wrap; gap: 2px; margin-top: auto; }
.picker { border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.pk-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; text-transform: capitalize; }
.pk-g { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.pk-w { text-align: center; font-size: 11px; color: var(--muted); }
.pk-d { border: 1px solid var(--line); background: var(--panel); color: inherit; border-radius: 8px; padding: 6px 0 3px; font-size: 15px; display: flex; flex-direction: column; align-items: center; min-height: 46px; cursor: pointer; font: inherit; }
.pk-d small { font-size: 10px; color: var(--muted); min-height: 12px; }
.pk-d.out { opacity: .4; }
.pk-d.we { background: var(--bg); }
.pk-d.today { border-color: var(--accent); }
.pk-d.cur { box-shadow: inset 0 0 0 2px var(--muted); }
.pk-d.sel { background: var(--accent); color: #fff; border-color: var(--accent); }
.pk-d.sel small { color: #fff; }
.quick { display: flex; gap: 6px; align-items: end; flex-wrap: wrap; }
@media (max-width: 760px) {
  .mday { min-height: 58px; padding: 4px; }
  .mday .c { font-size: 15px; }
  .mday .small { display: none; }
}

/* Messages texte (copie du message center) */
.sms { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 12px; align-items: start; }
.sms-col { max-height: calc(100vh - 170px); overflow-y: auto; }
.sms-list { list-style: none; margin: 0; padding: 0; }
.sms-list a { display: block; padding: 8px; border-radius: 8px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.sms-list a:hover { background: var(--bg); }
.sms-list a.on { background: var(--bg); box-shadow: inset 3px 0 0 var(--accent); }
.sms-top { display: flex; justify-content: space-between; gap: 8px; }
.sms-prev { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sms-main { display: flex; flex-direction: column; max-height: calc(100vh - 170px); }
.sms-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.sms-head > div { flex: 1; min-width: 0; }
.sms-back { display: none; }
.sms-pin { background: #12303a; color: #b7f36b; padding: 8px 10px; border-radius: 8px; margin-top: 8px; font-size: 14px; }
.sms-thread { flex: 1; overflow-y: auto; padding: 10px 2px; display: flex; flex-direction: column; gap: 8px; min-height: 200px; }
.bub { max-width: 78%; padding: 8px 12px; border-radius: 14px; font-size: 14px; background: var(--panel); border: 1px solid var(--line); align-self: flex-start; }
.bub.out { align-self: flex-end; background: #7ee84f; border-color: #7ee84f; color: #10210a; }
.bub img { display: block; max-width: 240px; max-height: 240px; border-radius: 10px; margin: 4px 0; object-fit: cover; }
.bub .meta { font-size: 11px; opacity: .65; margin-top: 3px; }
.bub .pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.sms-foot { border-top: 1px solid var(--line); padding-top: 8px; }
@media (max-width: 760px) {
  .sms { grid-template-columns: minmax(0, 1fr); }
  .sms.has-thread .sms-col { display: none; }
  .sms:not(.has-thread) .sms-main { display: none; }
  .sms-back { display: inline-flex; }
  .sms-col, .sms-main { max-height: none; }
  .bub { max-width: 90%; }
  .bub img { max-width: 100%; }
}

.kim-msg { white-space: pre-wrap; font-size: 13px; max-width: 640px; }

/* Ligne texto : composeur */
.composer { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.composer textarea { resize: vertical; min-height: 54px; }
.comp-row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }
.tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tool { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 17px; cursor: pointer; }
.tool.green { background: #e3f9d6; border-color: #9fe07a; }
.tool:disabled { opacity: .5; }
.sends { display: flex; gap: 6px; }
.att-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.att-chip { position: relative; }
.att-chip img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.att-chip button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: #333; color: #fff; font-size: 12px; cursor: pointer; }
.sugg { margin: 6px 0; display: flex; flex-direction: column; gap: 6px; }
.sugg .spread { display: flex; justify-content: space-between; }
.sugg-i { text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 10px; font: inherit; color: inherit; cursor: pointer; }
.sugg-i:hover { border-color: var(--accent); }
.bub { position: relative; }
.bub-menu { position: absolute; top: 2px; right: 4px; border: 0; background: transparent; font-size: 16px; cursor: pointer; opacity: .45; }
.bub-menu:hover { opacity: 1; }
.bub .pre { padding-right: 18px; }
.bub video { max-width: 260px; border-radius: 10px; display: block; margin: 4px 0; }
.bub .bad { color: #b42318; font-weight: 600; }
.ok-box { background: #e3f9d6; border: 1px solid #9fe07a; padding: 10px; border-radius: 10px; }
@media (max-width: 760px) {
  .sends { width: 100%; }
  .sends .btn { flex: 1; }
  .bub video { max-width: 100%; }
}

.sms-note { align-self: center; font-size: 12px; color: var(--muted); background: var(--bg); border: 1px dashed var(--line); border-radius: 999px; padding: 3px 10px; max-width: 90%; text-align: center; }
.kim-draft { border-color: #b9a6f5; background: #f5f1ff; }

/* Menu du clic droit (ligne texto) */
.ctx-menu { position: fixed; z-index: 1000; min-width: 230px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18); padding: 6px; display: flex; flex-direction: column; }
.ctx-menu button { text-align: left; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.ctx-menu button:hover { background: var(--bg); }
.ctx-menu button.ok { color: #157f3b; font-weight: 600; }
.ctx-menu button.blue { color: #2563eb; font-weight: 600; }
.ctx-menu button.danger { color: #c0262d; }
.ctx-menu button.strong { font-weight: 600; }
.ctx-menu button[data-sure="1"] { background: #fde8e8; }
.ctx-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.st-dot { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; margin-left: 6px; vertical-align: middle; color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.st-dot.red { background: #c9302c; }
.st-dot.green { background: #157f3b; }
.st-done { color: #157f3b; font-weight: 700; margin-left: 6px; }
.sms-list a, .bub { -webkit-touch-callout: none; }

/* Choix des produits : liste déroulante et catalogue */
.line-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.pp { position: fixed; z-index: 1100; max-height: 320px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .16); padding: 4px; }
.pp-i { padding: 7px 9px; border-radius: 7px; cursor: pointer; }
.pp-i.on, .pp-i:hover { background: var(--bg); }
.pp-n { font-weight: 600; font-size: 14px; }
.pp-m { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-empty { padding: 8px; font-size: 13px; color: var(--muted); }
.cat-list { max-height: 55vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.cat-i { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 72px; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.cat-i.on { border-color: var(--accent); background: var(--bg); }
.cat-n { display: flex; flex-direction: column; min-width: 0; }
.cat-n .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-p { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cat-q { padding: 6px; }
@media (max-width: 760px) {
  .cat-i { grid-template-columns: auto minmax(0, 1fr) 64px; }
  .cat-p { grid-column: 2; font-size: 13px; }
  .cat-q { grid-column: 3; grid-row: 1 / span 2; }
}

/* Barre de la liste (comme le message center) */
.mc-search { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 0 10px; margin-bottom: 8px; }
.mc-search input { flex: 1; border: 0; background: transparent; font: inherit; padding: 10px 0; color: var(--ink); outline: none; min-width: 0; }
.mc-ico { opacity: .6; }
.mc-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.mc-btn { position: relative; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); display: inline-flex;
  align-items: center; justify-content: center; font-size: 16px; cursor: pointer; text-decoration: none !important; color: inherit; }
.mc-btn.on { background: #12303a; border-color: #12303a; }
.mc-badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: #e5484d; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.mc-badge.violet { background: #7c3aed; }
.mc-sel { width: auto; flex: 1; min-width: 90px; max-width: 160px; padding: 7px 8px; }
.mc-new { width: 38px; height: 38px; border-radius: 50%; border: 0; background: #6bdc3a; color: #12303a; font-size: 22px; font-weight: 700; cursor: pointer; line-height: 1; }
.mc-count { padding: 4px 2px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.an-t { padding: 8px 0; border-bottom: 1px solid var(--line); }
.an-bar { height: 6px; background: var(--bg); border-radius: 999px; margin: 4px 0; overflow: hidden; }
.an-bar span { display: block; height: 100%; background: var(--accent); }
.an-ex { font-size: 13px; color: var(--muted); font-style: italic; margin-top: 2px; }

.warn-box { background: #fff7e0; border: 1px solid #f3d27a; color: #6b4a00; padding: 8px 10px; border-radius: 8px; }

/* 📊 Analyse IA (mise en page du message center, couleurs de l'application) */
.an-meta { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.an-sum { margin: 0 0 14px; line-height: 1.55; }
.an-h { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }
.an-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: var(--panel); }
.an-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.an-top strong { font-size: 15px; }
.an-n { color: var(--muted); font-size: 13px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.an-pct { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 700; border-radius: 6px; padding: 2px 7px; }
.an-card .an-bar { height: 8px; margin: 8px 0; }
.an-desc { font-size: 14px; margin-bottom: 4px; }
.an-exs { margin: 4px 0 0; padding-left: 18px; list-style: circle; }
.an-exs li { font-size: 13px; color: var(--muted); font-style: italic; margin: 2px 0; }
.an-rep { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.5; }
.an-x { display: inline-block; background: #12303a; color: #fff; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 1px 7px; margin-right: 4px; }
.an-rep .an-ex { display: inline; }

/* ✨ Assistant (page Clients) */
.assist { margin-bottom: 16px; border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.as-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin-bottom: 8px; }
.as-row { display: flex; gap: 8px; align-items: flex-start; }
.as-row textarea { flex: 1; resize: vertical; min-height: 42px; }
.as-ex { margin: 8px 0 0; }
.as-ex .chip { font-size: 12px; }
.as-plan { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.as-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; }
.as-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; margin-top: 12px; align-items: start; }
.as-list { max-height: 520px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.as-list table { margin: 0; }
.as-off td { opacity: .5; }
.as-act { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.as-prev { background: var(--bg); border-radius: 10px; padding: 10px; margin: 8px 0; font-size: 14px; }
.as-run { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.as-run .an-bar { height: 8px; }
@media (max-width: 900px) { .as-grid { grid-template-columns: minmax(0, 1fr); } .as-row { flex-direction: column; } .as-row .btn { width: 100%; } }

/* Répartition des techs */
.nav-n { margin-left: auto; background: var(--amber); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.dp-if, .dp-then, .dp-and { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .04em; border-radius: 4px; padding: 1px 6px; }
.dp-if { background: var(--blue-soft); color: var(--blue); }
.dp-then { background: var(--green-soft); color: var(--green); }
.dp-and { background: var(--gray-soft); color: var(--muted); }
.dp-rule { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.dp-rule:first-of-type { border-top: 0; }
.dp-rule.off { opacity: .5; }
.dp-name { font-weight: 600; margin-bottom: 2px; }
.dp-prop { display: grid; grid-template-columns: 1fr 300px; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.dp-prop:first-of-type { border-top: 0; }
.dp-prop .proposal { margin: 6px 0 0; }
.dp-ctl { display: grid; gap: 6px; align-content: start; }
.dp-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.dp-recent { padding: 4px 0; font-size: 13px; }
.dp-block { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.dp-lbl { font-weight: 600; margin-bottom: 8px; }
.dp-form .chips { margin-bottom: 0; }
.dp-preview { background: var(--gray-soft); border-radius: 8px; padding: 10px 12px; margin-top: 10px; font-size: 14px; }
@media (max-width: 760px) { .dp-prop { grid-template-columns: 1fr; } }
.dp-when { display: grid; grid-template-columns: 1fr 120px; gap: 6px; }
a.punch { text-decoration: none; }
a.punch .badge { margin-top: 3px; }
/* Paie */
.pay-wrap { overflow-x: auto; }
table.pay { width: 100%; border-collapse: collapse; font-size: 14px; }
table.pay th, table.pay td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.pay th { font-size: 12px; color: var(--muted); font-weight: 600; text-align: left; }
table.pay .num, table.pay-sub .num { text-align: right; white-space: nowrap; }
table.pay tfoot td { font-weight: 700; border-bottom: 0; }
.pay-flags { margin: 4px 0; display: flex; flex-wrap: wrap; gap: 4px; }
.pay-detail > td { background: var(--gray-soft); }
table.pay-sub { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
table.pay-sub th, table.pay-sub td { padding: 6px; border-bottom: 1px solid var(--line); text-align: left; }
.bank-bal { font-size: 18px; margin: 6px 0 10px; }
.qb-steps { padding-left: 18px; font-size: 14px; }
.qb-steps li { margin-bottom: 6px; }
.qb-uri { display: inline-block; background: var(--gray-soft); padding: 3px 6px; border-radius: 6px; font-size: 12px; word-break: break-all; }
.corr { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* Checklists : réponses du technicien (fenêtre de la visite) */
.cl-answers { margin: 10px 0; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.cl-answers summary { cursor: pointer; }
.kv-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.kv-table td { padding: 4px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.kv-table td:first-child { color: var(--muted); width: 55%; }
.kv-table .cl-sec { text-align: left; padding: 10px 6px 4px; font-size: 13px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.cl-missing td { background: rgba(220, 53, 69, .08); }
.req { color: #c0392b; font-weight: 700; }
td.center { text-align: center; }
.card.ok { border-left: 4px solid #157f3b; }
.card.bad { border-left: 4px solid #b42318; color: #b42318; }
.ms-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 16px; margin-top: 8px; }
.ms-folders label { display: flex; gap: 6px; align-items: center; }

/* Produits suggérés (nouveau travail) */
.mat-sug { margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; display: flex; flex-direction: column; gap: 6px; }
.mat-sug h3 { margin: 0; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-add { display: inline-flex; gap: 6px; align-items: center; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel, #fff); color: inherit; font: inherit; font-size: 13px; cursor: pointer; }
.chip-add small { color: var(--muted); }
.chip-add:disabled { opacity: .55; cursor: default; }

.tpl-save { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl-save .field { flex: 1; min-width: 180px; }

/* iPhone : les champs date et heure gardent la largeur du formulaire (Safari les élargit sinon). */
input.field[type=date], input.field[type=time] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; box-sizing: border-box; min-height: 44px; text-align: left; }
input.field[type=date]::-webkit-date-and-time-value, input.field[type=time]::-webkit-date-and-time-value { text-align: left; }

/* Équipement du client en onglets repliés (même affichage que l'appli des techs) */
.eq { border-top: 1px solid var(--line); }
.eq:first-of-type { border-top: 0; }
.eq summary { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 10px 0; cursor: pointer; list-style: none; }
.eq summary::-webkit-details-marker { display: none; }
.eq summary::before { content: '›'; display: inline-block; width: 14px; color: var(--muted); font-weight: 700; transition: transform .15s; }
.eq[open] summary::before { transform: rotate(90deg); }
.eq summary .muted { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.eq dl.kv { padding: 0 0 10px 22px; }

/* Onglets (Entreprise et taxes) : une rangée qui défile de côté sur un cellulaire. */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: -4px 0 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: 10px 14px; color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.nowrap { white-space: nowrap; }
tr[data-href] { cursor: pointer; }
/* Bannière « une synchro plante » (administrateurs) et pastille sur le menu Services. */
.sync-alert { background: var(--red-soft); color: var(--red); border-bottom: 1px solid var(--red); padding: 10px 16px; font-size: 14px; }
.sync-alert a { color: var(--red); font-weight: 600; margin-left: 8px; text-decoration: underline; }
.nav-alert { margin-left: auto; background: var(--red); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) { .g3 { grid-template-columns: minmax(0, 1fr); } }
button.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }

/* ---------- Accueil (maquette) : la journée de l'équipe ---------- */
.dl { --dl-font: 'Barlow Semi Condensed', Inter, system-ui, sans-serif; }
.dl h1, .dl h2, .dl h3, .dl-ruler em, .dl-who, .dl-row b, .dl-now b, .dl-li b { font-family: var(--dl-font); }
.dl-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.dl-head h1 { font-size: 38px; font-weight: 600; letter-spacing: -.01em; line-height: 1; }
.dl-head p { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.dl h2 { font-size: 20px; font-weight: 600; margin: 0 0 8px; }

.dl-day { background: var(--side); color: #d7e6f0; border-radius: 14px; padding: 16px 18px 12px; margin-bottom: 22px; }
.dl-strip { position: relative; --who: 112px; }
.dl-ruler { display: flex; height: 22px; }
.dl-ruler > span { width: var(--who); flex: none; }
.dl-ruler > div { position: relative; flex: 1; }
.dl-ruler em { position: absolute; transform: translateX(-50%); font-style: normal; font-size: 13px; color: #8fb3c9; white-space: nowrap; }
.dl-ruler em:last-child { transform: translateX(-100%); }
.dl-lane { display: flex; align-items: stretch; min-height: 46px; border-top: 1px solid rgba(255, 255, 255, .07); }
.dl-who { width: var(--who); flex: none; display: flex; align-items: center; gap: 6px; font-size: 17px; font-weight: 600; color: #fff; }
.dl-who small { font-size: 12px; color: #8fb3c9; font-weight: 500; }
.dl-col { flex: 1; min-width: 0; padding: 4px 0; }
.dl-adays { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.dl-ad { padding: 2px 8px; border-radius: 999px; background: rgba(79, 209, 232, .14); color: #cfeaf3; font-size: 12px; white-space: nowrap; }
.dl-ad:hover { text-decoration: none; background: rgba(79, 209, 232, .26); }
.dl-ad.is-done { background: rgba(83, 201, 139, .18); color: #cfe9dc; }
.dl-track { position: relative; height: calc(var(--depth, 1) * 38px); }
.dl-track > i { position: absolute; top: 0; bottom: 0; border-left: 1px dashed rgba(255, 255, 255, .06); }
.dl-v { position: absolute; top: calc(var(--k, 0) * 38px + 2px); height: 34px; min-width: 6px; border-radius: 6px; padding: 3px 7px; overflow: hidden; white-space: nowrap;
  background: #155a78; border-left: 3px solid #4fd1e8; color: #fff; font-size: 12px; line-height: 1.25; display: flex; flex-direction: column; justify-content: center; }
.dl-v:hover { text-decoration: none; background: #1a6c90; }
.dl-v:focus-visible, .dl-li:focus-visible, .dl-row:focus-visible, .dl-hl:focus-visible { outline: 2px solid #4fd1e8; outline-offset: 2px; }
.dl-v b, .dl-v span { overflow: hidden; text-overflow: ellipsis; }
.dl-v span { color: #b9d9e8; }
.dl-v.is-done { background: #1d4d3a; border-left-color: #53c98b; color: #cfe9dc; }
.dl-v.is-late { background: #5a2430; border-left-color: #ff7b7b; }
.dl-allday { position: absolute; left: 0; right: 0; top: 5px; padding: 3px 8px; border-radius: 6px; background: rgba(79, 209, 232, .12); color: #cfeaf3; font-size: 12px; }
.dl-now { position: absolute; top: 22px; bottom: -18px; left: calc(var(--who) + (100% - var(--who)) * var(--x)); border-left: 2px solid #ffcf5a; pointer-events: none; }
.dl-now b { position: absolute; bottom: 0; left: 5px; font-size: 12px; font-weight: 600; color: #ffcf5a; white-space: nowrap; }
.dl-legend { margin: 22px 0 0 112px; font-size: 12px; color: #8fb3c9; display: flex; gap: 6px; align-items: center; }
.dl-legend i { width: 10px; height: 10px; border-radius: 3px; background: #4fd1e8; margin-left: 8px; }
.dl-legend i.is-done { background: #53c98b; margin-left: 0; }
.dl-legend i.is-late { background: #ff7b7b; }
.dl-list { display: none; }

.dl-bottom { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.dl-row { display: flex; align-items: baseline; gap: 14px; padding: 12px 2px; border-bottom: 1px solid var(--line); color: var(--ink); }
.dl-row:hover { text-decoration: none; background: var(--accent-soft); }
.dl-row b { font-size: 34px; font-weight: 700; min-width: 64px; text-align: right; color: var(--side); line-height: 1; }
.dl-row span { font-size: 16px; font-weight: 500; }
.dl-row small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.dl-row.is-zero b { color: var(--line); }
.dl-row.is-zero span { color: var(--muted); }
.dl-health { border-left: 3px solid var(--line); padding-left: 18px; }
.dl-hl { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; color: var(--ink); font-size: 14px; }
.dl-hl i { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--green); transform: translateY(-1px); }
.dl-hl i.bad { background: var(--red); } .dl-hl i.warn { background: var(--amber); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dl-row b { color: #9fd3e3; } }
:root[data-theme="dark"] .dl-row b { color: #9fd3e3; }

@media (max-width: 760px) {
  .dl-head h1 { font-size: 30px; }
  .dl-strip, .dl-legend { display: none; }
  .dl-list { display: block; }
  .dl-list h3 { font-size: 16px; font-weight: 600; color: #fff; margin: 10px 0 4px; }
  .dl-li { display: flex; gap: 12px; padding: 7px 8px; margin: 3px 0; border-radius: 6px; background: #155a78; border-left: 3px solid #4fd1e8; color: #fff; }
  .dl-li.is-done { background: #1d4d3a; border-left-color: #53c98b; }
  .dl-li.is-late { background: #5a2430; border-left-color: #ff7b7b; }
  .dl-li b { font-size: 15px; min-width: 52px; }
  .dl-li small { display: block; color: #b9d9e8; font-size: 12px; }
  .dl-bottom { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .dl-health { border-left: 0; padding-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .dl * { transition: none !important; } }

/* ================= Identité JC Pools (2026-10-27) =================
   Même famille que le nouvel Accueil : titres et chiffres en Barlow Semi Condensed (étiquettes d'équipement),
   texte courant inchangé ; plus de libellés en majuscules ; menu avec un repère « eau » plutôt qu'un aplat. */
:root { --display: 'Barlow Semi Condensed', Inter, system-ui, sans-serif; --pool-light: #4fd1e8; }
h1, h2, .head h1, .card-h h2, .day-h, .kpi .n, .flow .n, .totals .grand, .brand strong, .tabs a { font-family: var(--display); }
h1 { font-size: 30px; font-weight: 600; letter-spacing: -.01em; line-height: 1.05; }
h2 { font-size: 19px; font-weight: 600; }
.head .sub { font-size: 14px; }
.kpi .l, .nav-sep, .form h3 { text-transform: none; letter-spacing: 0; }
.form h3 { font-family: var(--display); font-size: 16px; font-weight: 600; color: var(--ink); }
th { font-family: var(--display); font-size: 13px; font-weight: 600; letter-spacing: .01em; }
.totals .grand { font-size: 20px; }
.kpi .n, .flow .n { font-weight: 700; }

/* Menu : sections en petites capitales douces, élément actif marqué par un trait d'eau à gauche */
.nav-sep { font-family: var(--display); font-size: 13px; font-weight: 600; opacity: .5; padding: 14px 10px 4px; }
.side nav a { border-left: 3px solid transparent; border-radius: 0 8px 8px 0; }
.side nav a.on { background: rgba(79, 209, 232, .12); border-left-color: var(--pool-light); color: #fff; }
.brand strong { font-size: 18px; font-weight: 700; letter-spacing: .01em; }

/* Boutons et focus clavier visibles partout */
.btn.primary:hover { filter: brightness(.94); }
:where(a, button, input, select, textarea, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Calendrier : en-têtes de jour lisibles d'un coup d'œil */
.day-h { font-size: 16px; font-weight: 600; }

/* Piscines à prospecter : une carte par maison, la photo aérienne d'abord. Vert = confirmée, estompée = rejetée. */
.pr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.pr-card { display: flex; flex-direction: column; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pr-card img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; background: #dde5ea; }
.pr-body { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; flex: 1; font-size: 14px; }
.pr-act { display: flex; gap: 6px; padding: 0 10px 10px; }
.pr-act .btn { flex: 1; justify-content: center; }
.pr-card.is-oui { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.pr-card.is-non { opacity: .45; }
.pr-road { font-size: 13px; }
.pr-road b { font-family: var(--display); font-size: 15px; }
.pr-tag { align-self: flex-start; margin: 2px 0; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; text-decoration: none; background: #e7f0f5; color: var(--muted); }
.pr-tag.is-prospect { background: #fff4d6; color: #8a6100; }
.pr-tag.is-ancien { background: #efe7f7; color: #5f3d86; }
.pr-tag.is-client { background: #dff3e8; color: #1d6b43; }
.pr-tag.is-doute { background: #fde8e4; color: #a33b26; }

/* Gestes réservés aux administrateurs : cachés pour les autres employés (le serveur les refuse aussi). */
body.no-ops-delete #idel, body.no-ops-delete #jdel, body.no-ops-qbo #toQbo, body.no-ops-kim #kimCall,
body.not-admin .side nav a[data-nav="permissions"] { display: none !important; }
/* Page Permissions */
.pm-table th.pm-g { text-align: center; border-bottom: 1px solid var(--line, #dfe4ea); }
.pm-table th.pm-h { vertical-align: bottom; font-weight: 500; font-size: 12px; max-width: 92px; white-space: normal; line-height: 1.25; }
.pm-table td.pm-c { text-align: center; }
.pm-table td.pm-c input { width: 18px; height: 18px; }
.pm-table td.pm-who { min-width: 180px; }
.pm-table tr.pm-default td { background: rgba(11, 152, 181, .06); }
.pm-table tr.pm-admin td { opacity: .75; }

/* Suggestions d'adresses Google : au-dessus des fenêtres */
.pac-container { z-index: 60; border-radius: 8px; font-family: inherit; }

/* Assistant de répartition et qualités des techniciens */
.as-sum { margin: 12px 0 8px; }
.as-opt { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }
.as-opt.best { border-color: var(--accent); background: var(--accent-soft); }
.as-why { margin: 4px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.sk-table { border-collapse: collapse; font-size: 13px; }
.sk-table th, .sk-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.sk-h { height: 120px; vertical-align: bottom !important; white-space: nowrap; }
.sk-h span { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 600; font-size: 12px; }
.sk-c { text-align: center !important; min-width: 34px; font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--accent) calc(var(--a) * 70%), transparent); color: var(--ink); }
.as-btns { display: flex; flex-direction: column; gap: 4px; flex: none; }
.pc-later { margin: 8px 0 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pm-bar { position: sticky; bottom: 12px; margin-top: 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between;
  background: var(--panel); border: 2px solid var(--accent); border-radius: 10px; padding: 10px 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, .15); font-weight: 600; }
.th-sort { color: inherit; text-decoration: none !important; cursor: pointer; white-space: nowrap; }
.th-sort:hover { color: var(--accent); }
/* Barre de progression (Prix à pousser › Tout envoyer) */
.pp-prog { margin: 8px 0; }
.pp-prog-h { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 4px; }
.pp-bar { height: 10px; border-radius: 6px; background: var(--gray-soft); overflow: hidden; }
.pp-bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 6px; transition: width .4s ease; }
.pp-prog.done .pp-bar span { background: var(--green); }
.pp-prog.warn .pp-bar span { background: var(--amber); }
.dl-next { margin: 0 0 10px; font-size: 15px; font-weight: 600; color: #fff; }

/* Ce que rapporte OPS (Réglages) : administrateurs seulement. */
body.not-admin .tabs a[href="#/gains"], body.not-admin .tabs a[href="#/satisfaction"] { display: none; }
.sat-verdict p { margin: 0 0 14px; line-height: 1.55; }
.sat-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.sat-facts b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.sat-facts span { color: var(--muted); font-size: 13px; line-height: 1.3; }
.sat-legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.sat-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; background: var(--gray-soft); border: 1px solid var(--line); }
.sat-legend i.g { background: var(--green); border-color: var(--green); } .sat-legend i.b { background: var(--red); border-color: var(--red); }
.sat-months { display: grid; gap: 14px; }
.sat-month { display: grid; gap: 5px; }
.sat-mhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sat-mhead span { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.sat-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--gray-soft); border: 1px solid var(--line); }
.sat-bar .g { background: var(--green); } .sat-bar .b { background: var(--red); margin-left: auto; }
.sat-nums { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; }
.sat-nums .g { color: var(--green); } .sat-nums .b { color: var(--red); }
.sat-topics { display: grid; gap: 12px; margin-top: 12px; }
.sat-topic { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline; }
.sat-topic span { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.sat-track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--gray-soft); overflow: hidden; }
.sat-track div { height: 100%; background: var(--red); }
.sat-causes { margin: 0; padding-left: 20px; display: grid; gap: 10px; line-height: 1.5; }
.sat-causes q { color: var(--muted); font-style: italic; }
@media (max-width: 520px) { .sat-facts b { font-size: 21px; } }
.gain-seg { display: flex; gap: 6px; flex-wrap: wrap; }
.gain-vol b { font-size: 20px; }
.gain-ratios { margin: 14px 0 0; padding-left: 18px; line-height: 1.8; }
.gain-min { width: 80px; text-align: right; padding: 5px 8px; }
.gain-total td { font-weight: 700; border-top: 2px solid var(--line); }
@media (max-width: 700px) { .gain-vol { grid-template-columns: 1fr 1fr; } }

/* Étiquettes de codes-barres (#/labels) : feuilles Avery, papier Lettre, positions en pouces. */
.lbl-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .lbl-grid { grid-template-columns: 1fr; } }
.lbl-results { display: grid; gap: 4px; margin: 8px 0 12px; }
.lbl-hit { display: flex; justify-content: space-between; gap: 10px; text-align: left; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; }
.lbl-hit:hover, .lbl-hit:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.lbl-lines { display: grid; gap: 10px; justify-items: start; }
.lbl-line { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.lbl-line-name { display: flex; flex-direction: column; min-width: 0; }
.lbl-del { align-self: start; min-width: 40px; min-height: 36px; }
.lbl-line-code, .lbl-line-qty { display: flex; flex-direction: column; gap: 3px; }
.lbl-line-code .lbl-code { width: 100%; } .lbl-qty { width: 90px; text-align: right; }
.lbl-check { display: flex; align-items: center; gap: 8px; }
.lbl-tip { margin-top: 12px; line-height: 1.5; }
.lbl-preview { overflow-x: hidden; }
.lbl-preview .lbl-page { zoom: .62; margin: 0 auto 16px; box-shadow: 0 0 0 1px var(--line), 0 4px 14px rgba(0, 0, 0, .12); }
.lbl-page { position: relative; width: 8.5in; height: 11in; background: #fff; color: #000; overflow: hidden; page: labels; break-after: page; }
.lbl-page:last-child { break-after: auto; }
:where(.lbl-page) .lbl { position: absolute; box-sizing: border-box; padding: .06in .1in .04in; display: flex; flex-direction: column; overflow: hidden;
  font-family: Arial, Helvetica, sans-serif; color: #000; }
.lbl-preview .lbl { outline: 1px dashed #c8d0d8; }
.lbl-top { display: flex; justify-content: space-between; gap: .06in; font-size: 8pt; line-height: 1.1; }
.lbl-name { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lbl-top b { white-space: nowrap; font-size: 9pt; }
.lbl-bars { flex: 1; width: 100%; min-height: 0; margin-top: .03in; fill: #000; align-self: center; max-width: none; }
.lbl-code-txt { text-align: center; font-size: 7pt; letter-spacing: .5px; line-height: 1.15; }
.lbl-sm { padding: .03in .06in .02in; }
.lbl-sm .lbl-top { font-size: 5.5pt; } .lbl-sm .lbl-top b { font-size: 6pt; }
.lbl-sm .lbl-name { -webkit-line-clamp: 1; } .lbl-sm .lbl-code-txt { font-size: 5pt; }
.lbl-sq { padding: .05in; align-items: center; justify-content: center; text-align: center; gap: .02in; }
.lbl-sq .lbl-top { flex-direction: column; align-items: center; gap: 0; font-size: 6pt; width: 100%; }
.lbl-sq .lbl-top b { order: 2; font-size: 7pt; }
.lbl-sq .lbl-name { -webkit-line-clamp: 2; }
.lbl-sq .lbl-bars { flex: 0 0 auto; height: 50%; margin-top: 0; }
.lbl-sq .lbl-code-txt { font-size: 6pt; }
.lbl-round { border-radius: 50%; padding: .14in .1in .1in; }
.lbl-round .lbl-name { -webkit-line-clamp: 1; font-size: 5pt; }
.lbl-round .lbl-bars { height: 38%; }
.lbl-dims { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
#ladj summary { cursor: pointer; color: var(--accent); margin-top: 8px; }
.lbl-print { display: none; }
.lbl-slot { position: absolute; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border-radius: 6px;
  font: 600 13pt Arial, sans-serif; color: #8a97a3; border: 1px dashed #c8d0d8; }
.lbl-slot.used { background: repeating-linear-gradient(45deg, #e6eaee 0 6px, #f3f5f7 6px 12px); font-size: 9pt; color: #66778a; }
.lbl-preview [data-pos] { cursor: pointer; }
.lbl-preview [data-pos]:hover { outline: 2px solid #1f75b8; outline-offset: -2px; }
.lbl-pick-help { margin: 0 0 10px; }
.lbl-outline .lbl { outline: .5pt solid #000; }
@page labels { size: letter; margin: 0; }
@media print {
  body.printing-labels .side, body.printing-labels .top, body.printing-labels .view > :not(.lbl-print) { display: none !important; }
  body.printing-labels .lbl-print { display: block; }
  body.printing-labels .view { padding: 0 !important; margin: 0 !important; }
}

/* Inventaire (#/inventory) : grosse case de scan, compte en direct, écarts avec Clover. */
.inv-scan { display: grid; gap: 10px; }
.inv-input { font-size: 18px; padding: 12px 14px; }
.inv-step { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.inv-step input { width: 80px; text-align: right; }
.inv-flash { padding: 10px 12px; border-radius: 8px; background: var(--green-soft); color: var(--ink); }
.inv-flash.bad { background: var(--red-soft); }
.inv-kpis { margin: 14px 2px 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.inv-kpis b { color: var(--ink); }
.inv-lastcard { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.inv-total { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.inv-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.inv-tools h2 { margin: 0; }
.inv-lines { display: grid; }
.inv-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto; gap: 8px 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.inv-name { display: flex; flex-direction: column; min-width: 0; }
.inv-qty { display: flex; align-items: center; gap: 4px; }
.inv-qty .btn { min-width: 36px; min-height: 36px; font-size: 18px; line-height: 1; }
.inv-count { width: 74px; text-align: center; font-size: 16px; font-weight: 600; }
.inv-clover { white-space: nowrap; }
.inv-del { min-width: 36px; min-height: 36px; }
.badge.inv-ok { background: var(--green-soft); color: var(--green); }
.badge.inv-plus { background: var(--blue-soft); color: var(--blue); }
.badge.inv-minus { background: var(--red-soft); color: var(--red); }
.inv-confirm { margin-top: 12px; padding: 12px; border: 1px solid var(--amber); background: var(--amber-soft); border-radius: 8px; }
@media (max-width: 700px) {
  /* Cellulaire : nom + ✕, puis − quantité +, puis Clover et son bouton, chacun sur sa ligne (rien ne se chevauche). */
  .inv-line { grid-template-columns: minmax(0, 1fr) auto; }
  .inv-del { grid-column: 2; grid-row: 1; }
  .inv-qty { grid-column: 1 / -1; grid-row: 2; }
  .inv-qty .btn { min-width: 52px; min-height: 48px; font-size: 22px; }
  .inv-count { width: 96px; min-height: 48px; font-size: 20px; }
  .inv-clover { grid-column: 1 / -1; grid-row: 3; white-space: normal; }
  .inv-push { width: 100%; min-height: 44px; }
}
/* Pas de zoom quand on touche vite deux fois un bouton (iPhone) : chaque toucher compte. */
button, .btn, input, select, label { touch-action: manipulation; }

/* Caméra du cellulaire comme douchette (camscan.js). */
.cam-btn { margin-top: 8px; justify-self: start; }
.cam-wrap { position: fixed; inset: 0; z-index: 9000; background: rgba(8, 18, 28, .82); display: flex; align-items: center; justify-content: center;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
.cam-box { width: min(560px, 100%); max-height: 100%; overflow: auto; background: var(--panel); color: var(--ink); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.cam-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cam-view { width: 100%; min-height: 240px; background: #000; border-radius: 8px; overflow: hidden; }
.cam-view video { width: 100% !important; height: auto !important; display: block; }
.cam-msg { padding: 10px 12px; border-radius: 8px; background: var(--green-soft); }
.cam-msg.bad { background: var(--red-soft); }
.inv-cams { flex-wrap: wrap; gap: 8px; }
.shelf-box { width: min(760px, 100%); }
.shelf-take { justify-self: start; cursor: pointer; }
.shelf-stage canvas { width: 100%; height: auto; display: block; border-radius: 8px; touch-action: none; background: #000; }
.shelf-actions { justify-content: flex-start; flex-wrap: wrap; }
.shelf-group { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.shelf-group.done { opacity: .75; }
.shelf-cands { display: grid; gap: 4px; }
.shelf-cand { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.shelf-cand input { margin-top: 3px; }
.shelf-hits { display: grid; gap: 4px; }
.shelf-add { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.shelf-add label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
.shelf-n, .shelf-f, .shelf-d { width: 80px; text-align: right; }
.shelf-x { padding-bottom: 10px; color: var(--muted); font-weight: 600; }
.stock-neg { color: var(--red); font-weight: 600; }
.inv-progress { height: 10px; border-radius: 5px; background: var(--gray-soft); overflow: hidden; margin: 8px 0; }
.inv-progress div { height: 100%; background: var(--accent); }
.inv-zero { align-items: flex-start; margin: 8px 0; }
.inv-line.inv-hot { background: var(--green-soft); border-radius: 8px; padding-left: 8px; padding-right: 8px; transition: background .6s; }
.inv-push { margin-top: 6px; display: block; }
.inv-pushed { color: var(--green); font-weight: 600; margin-top: 4px; }
.inv-donebox { margin-top: 12px; }
.inv-donebox summary, #isync summary { cursor: pointer; color: var(--muted); padding: 6px 0; }
#isync details[open] summary { margin-bottom: 8px; }
.inv-addbox { display: flex; gap: 4px; align-items: center; }
.inv-add { width: 70px; text-align: center; }
@media (max-width: 700px) {
  .inv-addbox { grid-column: 1 / -1; grid-row: 3; }
  .inv-clover { grid-row: 4; }
  .inv-add { width: 96px; min-height: 44px; font-size: 18px; }
  .inv-addbox .btn { min-height: 44px; }
}
.inv-zeroing { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: var(--amber-soft); color: var(--ink); font-size: 14px; }
.inv-price { font-size: 14px; color: var(--ink); margin: 2px 0; }
.inv-price b { color: var(--accent); }
#ilistbox summary { cursor: pointer; }
.inv-table td, .inv-table th { padding: 6px 8px; }
.inv-name .inv-lbl { align-self: flex-start; margin-top: 4px; }
.inv-scanmsg { grid-column: 1 / -1; background: var(--green-soft); color: var(--text); border-radius: 6px; padding: 6px 8px; margin-bottom: 6px; font-size: 14px; }
.prod-count { margin: 4px 0 2px; }
.inv-recent { margin-top: 16px; border: 2px solid var(--green, #2e9d5b); }
.inv-recent h2 { margin-bottom: 4px; }
.code-row { display: flex; gap: 8px; align-items: flex-end; }
.code-row .fl { flex: 1; }
.inv-pricebtn { margin-left: 6px; padding: 2px 8px; }
.inv-pricebox { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.inv-pricebox input { width: 100px; }
.inv-pricebox .muted { flex-basis: 100%; }
.inv-newprice { display: block; color: #8a5a00; background: #fff4d6; border-radius: 4px; padding: 2px 6px; margin-top: 2px; }
.inv-ident { margin-top: 4px; align-self: flex-start; }
.pphoto { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.inv-sortbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.inv-sortbar label { display: flex; align-items: center; gap: 6px; }
.inv-sortbar #ifind { flex: 1; min-width: 180px; }
.inv-scanadds { margin-top: 8px; }
.inv-del.danger { color: #fff; background: var(--red); border-color: var(--red); white-space: nowrap; }

.inv-pricegap { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }

/* Photos des notes copiées de Jobber */
.note-img { display: inline-block; margin: 6px 6px 2px 0; }
.note-img img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* Documents du client */
.cdoc { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.cdoc-thumb { flex: 0 0 72px; height: 72px; display: flex; align-items: center; justify-content: center; font-size: 30px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg, #f5f7f9); }
.cdoc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cdoc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.cdoc-fields { display: grid; gap: 2px; }
.cdoc-jb { display: grid; gap: 8px; margin-top: 8px; }
.cdoc-jbi { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 10px; align-items: center; }

/* Import d'équipement (Excel) */
.eqi-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.eqi-col { display: flex; flex-direction: column; gap: 4px; }
.eqi-ex { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Page Kim : chandelles répondus / sans réponse (couleurs validées pour le daltonisme, clair et sombre). */
.kc-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; margin: 8px 0 12px; }
.kc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.kc-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.kc-yes { background: #0e9f9a; }
.kc-no { background: #d4493a; }
.kc-chart { position: relative; padding-left: 30px; }
.kc-plot { position: relative; height: 200px; }
.kc-grid { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.kc-grid span { position: absolute; left: -30px; width: 24px; top: -8px; text-align: right; font-size: 11px; color: var(--muted); }
.kc-bars { position: absolute; inset: 0; display: flex; align-items: stretch; }
.kc-slot { flex: 1 1 0; min-width: 0; display: flex; align-items: flex-end; justify-content: center; padding: 0 1px; cursor: default; outline-offset: -2px; }
.kc-slot:hover { background: var(--accent-soft); }
.kc-bar { width: 100%; max-width: 24px; display: flex; flex-direction: column; gap: 2px; }
.kc-seg { min-height: 2px; }
.kc-seg:first-child { border-radius: 4px 4px 0 0; }
.kc-days { display: flex; margin-top: 6px; }
.kc-days span { flex: 1 1 0; min-width: 0; font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; overflow: visible; display: flex; justify-content: center; }
.kc-tip { position: absolute; top: 0; z-index: 3; pointer-events: none; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 8px 10px; font-size: 12px; line-height: 1.5; white-space: nowrap; }
@media (max-width: 700px) { .kc-days .kc-opt { visibility: hidden; } }

/* Réglages › Règles des messages */
.mr-test { margin-bottom: 16px; border-left: 4px solid var(--accent); }
.mr-channels { display: flex; gap: 4px 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.mr-channels .muted { margin-right: 8px; }
.mr-testrow { display: grid; grid-template-columns: 190px 90px minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.mr-testrow label, .mr-grid label, .mr-fb { display: block; font-size: 12px; color: var(--muted); }
.mr-testrow .field, .mr-grid .field, .mr-fb .field { margin-top: 4px; color: var(--ink); font-size: 14px; }
.mr-result { margin-top: 10px; font-size: 15px; }
.mr-list { display: grid; gap: 10px; }
.mr-off { opacity: .55; }
.mr-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.mr-num { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.mr-label { flex: 1 1 180px; width: auto; font-weight: 600; }
.mr-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.mr-fb { max-width: 420px; }
@media (max-width: 900px) { .mr-grid, .mr-testrow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .mr-grid, .mr-testrow { grid-template-columns: minmax(0, 1fr); } }
.mr-tabs { display: flex; gap: 8px; margin: 14px 0 18px; flex-wrap: wrap; }
.mr-tab { border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; }
.mr-tab.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.mr-base { padding: 6px 16px; }
.mr-baserow { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.mr-baserow:last-child { border-bottom: 0; }
.mr-wide { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.mr-wide .field { margin-top: 4px; color: var(--ink); font-size: 14px; }
.mr-grid.mr-grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mr-inline { margin: 0; align-self: end; padding-bottom: 8px; }
.mr-lead { font-size: 16px; margin: 0 0 6px; }
@media (max-width: 560px) { .mr-grid.mr-grid2, .mr-baserow { grid-template-columns: minmax(0, 1fr); } .mr-baserow { gap: 2px; } }
.mr-base + h2, section > .mr-list + .btn + h2 { margin-top: 24px; }
.mr-sechead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.mr-sechead h2 { margin: 0; }
.mr-why { display: block; margin-top: 2px; }
.mr-orig { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: -4px 0 10px; }
.mr-savebar { display: flex; justify-content: flex-end; margin-top: 12px; }
.mr-save:disabled { opacity: 1; color: var(--muted); cursor: default; }
.mr-warn { margin: -2px 0 10px; font-size: 12px; color: var(--muted); }
.mr-subs { margin: -2px 0 12px; padding-left: 12px; border-left: 2px solid var(--line); }
.mr-sublabel { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.mr-sub { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.mr-sub .field { flex: 1; font-size: 14px; }
.mr-also { display: block; font-size: 12px; color: var(--muted); min-width: 240px; }
.mr-also .field { margin-top: 4px; color: var(--ink); font-size: 14px; }
/* Météo dans le calendrier */
.day-wx:empty { display: none; }
.day-wx { padding: 5px 10px; border-bottom: 1px solid var(--line); font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.day-wx-warn { font-size: 12px; color: var(--muted); }
.mday-top { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.mday-wx { font-size: 12px; color: var(--muted); white-space: nowrap; }
@media (max-width: 760px) { .mday-wx .wx-temp { display: none; } }
.sms-ask { display: flex; gap: 8px; margin: 6px 0; }
.sms-ask .field { flex: 1; min-width: 0; }
.sms-ask-a { white-space: pre-wrap; line-height: 1.45; }
.not-admin [data-nav="risk"] { display: none; }
.not-admin [data-nav="cleanup"] { display: none; }
.pc-list { padding: 0; }
.pc-auto { display: block; margin-bottom: 10px; }
.pc-card { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.pc-card:last-child { border-bottom: 0; }
.pc-main { min-width: 0; flex: 1; }
.pc-why { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; display: grid; gap: 2px; }
.pc-why li::before { margin-right: 6px; }
.pc-good::before { content: '✓'; color: var(--green); font-weight: 700; }
.pc-doubt::before { content: '⚠'; color: var(--amber, #b7791f); }
.pc-info { color: var(--muted); }
.pc-info::before { content: '•'; }
.pc-jobs { margin-top: 8px; display: grid; gap: 6px; }
.pc-job { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pc-msgs { margin-top: 6px; }
.pc-msgs > div { margin-top: 4px; }
.pc-btns { display: flex; flex-direction: column; gap: 6px; flex: none; width: 170px; }
.pc-btns .btn { width: 100%; justify-content: center; text-align: center; }
.pc-transfer { width: 100%; font-size: 13px; padding: 5px 8px; }
.pc-urgent { border-color: var(--red); color: var(--red); font-weight: 600; }
@media (max-width: 640px) { .pc-card { flex-direction: column; } .pc-btns { width: 100%; flex-direction: row; flex-wrap: wrap; } .pc-btns .btn { width: auto; flex: 1 1 auto; } .pc-transfer { width: auto; flex: 1 1 100%; } }
/* Job de plus */
body.no-ops-extra [data-nav="extra"] { display: none; }
.xj-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.xj-grid label, .xj-wide { display: block; font-size: 12px; color: var(--muted); }
.xj-grid .field, .xj-wide .field { margin-top: 4px; color: var(--ink); font-size: 14px; }
@media (max-width: 560px) { .xj-grid { grid-template-columns: minmax(0, 1fr); } }

/* Chat d'entreprise */
.not-admin:not(.can-chat) [data-nav="chat"] { display: none; }
.chat-box { display: flex; flex-direction: column; gap: 10px; max-width: 1000px; }
.chat-log { display: flex; flex-direction: column; gap: 10px; min-height: 240px; max-height: calc(100vh - 330px); overflow-y: auto; padding: 4px; }
.chat-msg { padding: 10px 14px; border-radius: 12px; max-width: 92%; overflow-wrap: anywhere; }
.chat-msg p { margin: 0 0 6px; } .chat-msg p:last-child { margin-bottom: 0; } .chat-msg ul, .chat-msg ol { margin: 4px 0 6px; padding-left: 20px; }
.chat-msg.me { align-self: flex-end; background: var(--accent-soft); }
.chat-msg.ai { align-self: flex-start; background: var(--gray-soft); }
.chat-tools { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; opacity: 0; transition: opacity .15s; }
.chat-msg.me:hover .chat-tools, .chat-msg.me:focus-within .chat-tools { opacity: 1; }
@media (hover: none) { .chat-tools { opacity: .75; } }
.chat-tools button { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; color: var(--muted, #667); cursor: pointer; }
.chat-tools button:hover { color: var(--accent); text-decoration: underline; }
.chat-msg.chat-edit { width: min(640px, 100%); }
.chat-msg.chat-edit textarea { width: 100%; }
.chat-files { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#chatPicked:not(:empty) { margin-bottom: 8px; }
.chat-msg .chat-files { margin-bottom: 6px; justify-content: flex-end; }
.chat-file-wrap { position: relative; display: inline-flex; }
.chat-file { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 8px; background: var(--gray-soft); border: 1px solid var(--line, #dde3ea); font-size: 12px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; text-decoration: none; }
.chat-file.img { padding: 0; background: none; }
.chat-file.img img { display: block; max-width: 160px; max-height: 120px; border-radius: 8px; object-fit: cover; }
.chat-file-x { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--ink, #223); color: var(--panel, #fff); font-size: 13px; line-height: 20px; padding: 0; cursor: pointer; }
.chat-box.chat-drop { outline: 2px dashed var(--accent); outline-offset: -6px; }
#chatAttach { align-self: stretch; font-size: 18px; padding: 0 12px; }
.chat-tbl { overflow-x: auto; margin: 6px 0; } .chat-tbl table { font-size: 13px; }
.chat-action { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: 10px; background: var(--panel); }
.chat-action .ok { color: var(--green); } .chat-action .bad { color: var(--red); }
.chat-form { display: flex; gap: 8px; align-items: flex-end; } .chat-form textarea { flex: 1; resize: vertical; }
@media (max-width: 640px) { .chat-msg { max-width: 100%; } .chat-form { flex-direction: column; align-items: stretch; } }

/* Changements OPS (#/dev) : code changé, lignes ajoutées en vert, enlevées en rouge. */
.dev-file { margin: 8px 0; }
.dev-file summary { cursor: pointer; }
.dev-diff { font-size: 12px; line-height: 1.45; background: var(--gray-soft); border-radius: 8px; padding: 8px; overflow: auto; max-height: 520px; white-space: pre; }
.dev-diff .dl-add { background: rgba(46, 160, 67, .18); display: inline-block; min-width: 100%; }
.dev-diff .dl-del { background: rgba(218, 54, 51, .18); display: inline-block; min-width: 100%; }
.dev-diff .dl-hunk { color: var(--muted); }

/* Cellulaire : un tableau trop large défile de côté dans sa carte au lieu d'élargir toute la page. */
@media (max-width: 760px) {
  table.table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .head { flex-wrap: wrap; }
}

/* Calendrier, vue Mois (17 nov. 2026, comme Jobber) : les visites écrites dans chaque journée. */
.mday { min-height: 120px; }
.mday-top { color: inherit; text-decoration: none !important; }
.mev { display: block; font-size: 11px; line-height: 1.35; padding: 1px 4px; border-left: 3px solid var(--muted); border-radius: 3px; background: var(--bg); color: inherit; text-decoration: none !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mev:hover { filter: brightness(.95); }
.mev.done { opacity: .6; }
.mev.hl { outline: 2px solid #f5a623; opacity: 1; }
.mev-more { font-size: 11px; color: var(--accent); text-decoration: none !important; }
.mday-count { display: none; }
@media (max-width: 760px) { .mev, .mev-more { display: none; } .mday-count { display: block; font-size: 15px; font-weight: 600; color: inherit; text-decoration: none !important; } .mday { min-height: 58px; } }

/* Fenêtre de confirmation OPS (uiConfirm / uiAlert / uiPrompt) — 19 nov. 2026 */
.cf-bg { position: fixed; inset: 0; background: rgba(8, 20, 30, .5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 200; }
.cf { background: var(--panel, #fff); border-radius: 12px; width: min(440px, 100%); padding: 20px 20px 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.cf h2 { margin: 0 0 8px; font-size: 18px; }
.cf p { margin: 0; white-space: pre-line; line-height: 1.45; }
.cf textarea { width: 100%; margin-top: 12px; }
.cf .actions .btn { min-height: 40px; }
.cf .cf-danger { font-weight: 700; }
