
@font-face {
  font-family: "Manrope";
  src: url("fonts/manrope-var.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

.lw-standalone { margin: 0; background: #f4f6f4; }
.lw-standalone .overlay-article { display: block; }

.lw {
  --paper: #f4f6f4;
  --white: #ffffff;
  --ink: #16201d;
  --slate: #5e6b67;
  --mute: #6a726f;        
  --line: #d9e0dc;
  --line-soft: #e9eeeb;
  --accent: #0e7c62;
  --accent-ink: #0a5a47;
  --accent-soft: #e0f0ea;
  --late: #c81e3a;
  --late-soft: #fbe7ea;
  --A: #4756d2;
  --B: #a16818;           
  --C: #b53f7e;
  --land: #e7ebe8;
  --coast: #c3ccc7;
  --road: #d2d9d5;
  --radius: 6px;
  --side: 400px;

  box-sizing: border-box;
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  font-feature-settings: "tnum" 1;
  color: var(--ink);
  background: var(--paper);
  height: 100vh;
  height: 100dvh;
  height: calc(100dvh - var(--kf-demo-h, 0px));
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-align: left;
}
.lw *, .lw *::before, .lw *::after { box-sizing: inherit; }
.lw p, .lw h1, .lw h2, .lw h3, .lw ul, .lw ol { margin: 0; }
.lw ul, .lw ol { padding: 0; list-style: none; }
.lw button { font: inherit; color: inherit; }
.lw a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.lw :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.lw-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "brand day actions" "status status status";
  align-items: center;
  gap: 6px 24px;
  padding: 14px 20px 12px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.lw-brand {
  grid-area: brand;
  display: inline-flex; align-items: baseline; gap: 8px;
  color: var(--ink); text-decoration: none;
}
.lw-logo { width: 22px; height: 22px; align-self: center; color: var(--accent); }
.lw-brand-name { font-weight: 800; font-size: 19px; letter-spacing: -0.02em; }
.lw-brand-client { color: var(--slate); font-weight: 500; }
.lw-brand-client::before { content: "pour "; color: var(--mute); font-weight: 400; }
.lw-day { grid-area: day; color: var(--slate); }
.lw-day strong { color: var(--ink); font-weight: 700; }
.lw-actions { grid-area: actions; display: flex; gap: 8px; flex-wrap: wrap; }
.lw-status { grid-area: status; min-height: 1.3em; color: var(--accent-ink); font-weight: 500; }
.lw-status:empty { display: none; }
.lw-status.is-warn { color: var(--late); }

.lw-btn {
  border: 1px solid var(--line); background: var(--white);
  border-radius: var(--radius); padding: 8px 14px;
  font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.lw-btn:hover { border-color: var(--slate); }
.lw-btn:disabled { opacity: .45; cursor: default; border-color: var(--line); }
.lw-btn--primary:disabled {
  opacity: 1; background: var(--accent-soft);
  border-color: var(--line); color: var(--slate);
}
.lw-btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.lw-btn--primary:hover:not(:disabled) { background: var(--accent-ink); border-color: var(--accent-ink); }
.lw-btn--quiet { border-color: transparent; background: transparent; color: var(--slate); }
.lw-btn--quiet:hover { background: var(--line-soft); border-color: transparent; }

.lw-body { flex: 1; display: grid; grid-template-columns: var(--side) 1fr; min-height: 0; }
.lw-top, .lw-foot { flex: none; }
.lw-loading, .lw-error { padding: 40px 20px; color: var(--slate); grid-column: 1 / -1; }
.lw-error { color: var(--late); }

.lw-side { border-right: 1px solid var(--line); background: var(--white); display: flex; flex-direction: column; overflow-y: auto; min-height: 0; }
.lw-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.lw-kpis { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.lw-kpi { padding: 12px 8px 12px 20px; border-right: 1px solid var(--line-soft); }
.lw-kpi:last-child { border-right: 0; }
.lw-kpi b { display: block; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.lw-kpi b small { font-size: 12px; font-weight: 600; color: var(--mute); margin-left: 2px; }
.lw-kpi span { color: var(--slate); font-size: 12px; }
.lw-kpi.is-late b { color: var(--late); }
.lw-kpi.is-good b { color: var(--accent-ink); }

.lw-h {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 14px 20px 6px;
}
.lw-h h2 { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.lw-h .lw-h-note { color: var(--slate); font-size: 12px; }

.lw-tour { border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.lw-tour-head {
  display: grid; grid-template-columns: 28px 1fr auto; column-gap: 10px; align-items: center;
  padding: 12px 20px 6px;
}
.lw-tour-dot {
  width: 28px; height: 28px; border-radius: 50%; color: #fff;
  display: grid; place-items: center; font-size: 0.75rem; font-weight: 800; letter-spacing: .02em;
  background: var(--tc);
}
.lw-tour-name { font-weight: 700; grid-column: 2; grid-row: 1; }
.lw-tour-sub { color: var(--slate); font-size: 12px; grid-column: 2; grid-row: 2; }
.lw-tour-dot { grid-column: 1; grid-row: 1 / span 2; align-self: start; }
.lw-tour-ret { text-align: right; font-weight: 700; grid-column: 3; grid-row: 1 / span 2; align-self: start; }
.lw-tour-ret small { display: block; font-weight: 500; color: var(--slate); font-size: 12px; }
.lw-tour-ret.is-late { color: var(--late); }
.lw-tour-empty { padding: 4px 20px 10px 58px; color: var(--mute); font-size: 13px; }

.lw-stop {
  display: grid; grid-template-columns: 22px 1fr auto 26px; column-gap: 10px; align-items: center;
  padding: 7px 14px 7px 23px; border-left: 3px solid var(--tc);
  margin-left: 0;
}
.lw-stop + .lw-stop { border-top: 1px solid var(--line-soft); }
.lw-stop-n {
  width: 22px; height: 22px; border-radius: 50%; background: var(--tc); color: #fff;
  display: grid; place-items: center; font-size: 0.75rem; font-weight: 800;
}
.lw-stop-n { grid-column: 1; grid-row: 1 / span 2; }
.lw-stop-who { font-weight: 600; line-height: 1.25; grid-column: 2; grid-row: 1; }
.lw-stop-meta { color: var(--slate); font-size: 12px; grid-column: 2; grid-row: 2; }
.lw-stop-time { text-align: right; font-weight: 600; grid-column: 3; grid-row: 1 / span 2; white-space: nowrap; }
.lw-stop-time small { display: block; font-weight: 500; color: var(--slate); font-size: 0.75rem; }
.lw-stop-time.is-late { color: var(--late); }
.lw-x {
  grid-column: 4; grid-row: 1 / span 2; width: 26px; height: 26px; border: 0; background: transparent;
  border-radius: 50%; color: var(--mute); cursor: pointer; font-size: 16px; line-height: 1;
}
.lw-x:hover { background: var(--late-soft); color: var(--late); }

.lw-backlog { flex: 1; }
.lw-fiche { border-bottom: 1px solid var(--line-soft); }
.lw-fiche-btn {
  width: 100%; display: grid; grid-template-columns: auto 1fr auto; column-gap: 10px; align-items: center;
  padding: 9px 20px; border: 0; background: transparent; text-align: left; cursor: pointer;
}
.lw-fiche-btn:hover { background: var(--paper); }
.lw-fiche.is-open .lw-fiche-btn { background: var(--accent-soft); }
.lw-fiche.is-deferred .lw-fiche-btn { background: var(--late-soft); }
.lw-type {
  grid-column: 1; grid-row: 1; justify-self: start;
  font-size: 0.75rem; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--slate); background: var(--white); white-space: nowrap;
}
.lw-type--install { border-color: var(--ink); color: var(--ink); }
.lw-fiche-who { font-weight: 600; line-height: 1.25; grid-column: 2; grid-row: 1; }
.lw-fiche-meta { color: var(--slate); font-size: 12px; grid-column: 2; grid-row: 2; }
.lw-fiche-dur { grid-column: 3; grid-row: 1 / span 2; text-align: right; font-weight: 700; white-space: nowrap; }
.lw-fiche-dur small { display: block; font-weight: 500; font-size: 0.75rem; color: var(--late); }
.lw-prio { color: var(--late); font-weight: 700; }
.lw-choose { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 20px 12px; background: var(--accent-soft); }
.lw-choose-note { width: 100%; font-size: 12px; color: var(--slate); padding-bottom: 2px; }
.lw-pick {
  flex: 1 1 100px; border: 1px solid var(--tc); border-radius: var(--radius); background: var(--white);
  padding: 6px 8px; cursor: pointer; text-align: left; line-height: 1.2;
}
.lw-pick b { display: block; font-size: 13px; color: var(--tc); }
.lw-pick span { font-size: 0.75rem; color: var(--slate); }
.lw-pick span.is-late { color: var(--late); font-weight: 600; }
.lw-pick:hover:not(:disabled) { background: var(--tc); }
.lw-pick:hover:not(:disabled) b, .lw-pick:hover:not(:disabled) span { color: #fff; }
.lw-pick:disabled { cursor: default; border-color: var(--line); background: transparent; }
.lw-pick:disabled b { color: var(--mute); }
.lw-empty { padding: 10px 20px 20px; color: var(--mute); }

.lw-map { position: relative; flex: 1; min-height: 0; background: var(--paper); }
.lw-filter {
  position: absolute; top: 10px; left: 14px; z-index: 2;
  display: flex; gap: 6px; flex-wrap: wrap;
}
.lw-chip {
  border: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(2px);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--tc, var(--slate));
}
.lw-chip:hover { border-color: var(--tc, var(--slate)); }
.lw-chip.is-on { background: var(--tc, var(--ink)); border-color: var(--tc, var(--ink)); color: #fff; }
.lw-chip--all { --tc: var(--ink); }
.lw-map svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.lw-map .land { fill: var(--land); stroke: var(--coast); stroke-width: .8; stroke-linejoin: round; }
.lw-map .road { fill: none; stroke: var(--road); stroke-linecap: round; stroke-linejoin: round; }
.lw-map .road--trunk { stroke-width: 1.8; }
.lw-map .road--primary { stroke-width: 1.1; }
.lw-map .road--secondary { stroke-width: .6; }
.lw-map .town { fill: var(--mute); }
.lw-map .town-label { font-size: 13px; font-weight: 500; fill: var(--slate); paint-order: stroke; stroke: var(--paper); stroke-width: 3px; stroke-linejoin: round; }
.lw-map .leg { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.lw-map .leg--B { stroke-dasharray: 14 5; }
.lw-map .leg--C { stroke-dasharray: 3 4.5; }
.lw-map .leg--back { stroke-width: 1.6; opacity: .6; stroke-dasharray: 2 6; }
.lw-map .leg.is-new { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: lw-draw .7s ease-out forwards; }
.lw-map .depot { fill: var(--ink); stroke: var(--paper); stroke-width: 2; }
.lw-map .depot-label { font-size: 13px; font-weight: 800; fill: var(--ink); paint-order: stroke; stroke: var(--paper); stroke-width: 3px; }
.lw-map .stop { stroke: #fff; stroke-width: 2; }
.lw-map .pend { cursor: pointer; }
.lw-map .pend-dot { fill: var(--white); stroke: var(--slate); stroke-width: 2; stroke-dasharray: 4 3; }
.lw-map .pend-mark { font-size: 0.75rem; font-weight: 800; fill: var(--slate); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.lw-map .pend:hover .pend-dot, .lw-map .pend:focus-visible .pend-dot { stroke: var(--accent); stroke-width: 2.4; }
.lw-map .pend:hover .pend-mark { fill: var(--accent); }
.lw-map .pend.is-on .pend-dot { fill: var(--accent); stroke: var(--accent); stroke-dasharray: none; }
.lw-map .pend.is-on .pend-mark { fill: #fff; }
.lw-map .pend.is-deferred .pend-dot { stroke: var(--late); }
.lw-map .pend.is-deferred .pend-mark { fill: var(--late); }
.lw-map .stop-n { font-size: 0.75rem; font-weight: 800; fill: #fff; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.lw-map-hint { position: absolute; left: 14px; right: 14px; bottom: 12px; font-size: 12px; color: var(--mute); }
@keyframes lw-draw { to { stroke-dashoffset: 0; } }

.lw-gantt { flex: none; border-top: 1px solid var(--line); background: var(--white); padding: 12px 20px 14px; overflow-x: auto; }
.lw-gantt svg { display: block; width: 100%; min-width: 620px; height: auto; }
.lw-gantt .tick { stroke: var(--line-soft); }
.lw-gantt .tick-label { font-size: 0.75rem; fill: var(--mute); text-anchor: middle; }
.lw-gantt .row-label { font-size: 12px; font-weight: 700; }
.lw-gantt .row-sub { font-size: 0.75rem; fill: var(--slate); }
.lw-gantt .band-pause { fill: var(--line-soft); }
.lw-gantt .limit { stroke: var(--late); stroke-width: 1.5; stroke-dasharray: 3 3; }
.lw-gantt .limit-label { font-size: 0.75rem; fill: var(--late); font-weight: 700; }
.lw-gantt .seg-prep { fill: var(--line); }
.lw-gantt .seg-travel { fill: var(--tc); opacity: .32; }
.lw-gantt .seg-job { fill: var(--tc); }
.lw-gantt .seg-job.is-late { stroke: var(--late); stroke-width: 2; }
.lw-gantt .seg-wait { fill: url(#lw-hatch); }
.lw-gantt .seg-pause { fill: var(--line); }
.lw-gantt .seg-over { fill: var(--late); opacity: .85; }
.lw-gantt .seg-label { font-size: 0.75rem; font-weight: 700; fill: #fff; pointer-events: none; }
.lw-gantt .seg-label--dark { fill: var(--slate); font-weight: 500; }

.lw-foot {
  display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center;
  padding: 10px 20px; border-top: 1px solid var(--line); background: var(--white);
  color: var(--mute); font-size: 12px;
}
.lw-foot-back { margin-left: auto; font-weight: 600; }

@media (max-width: 960px) {
  .lw { --side: 100%; height: auto; min-height: 100dvh; }
  .lw-side { overflow: visible; }
  .lw-top { grid-template-columns: 1fr; grid-template-areas: "brand" "day" "actions" "status"; gap: 4px; padding: 12px 16px 10px; }
  .lw-actions { margin-top: 6px; }
  .lw-btn { padding: 9px 12px; }
  .lw-body { display: flex; flex-direction: column; }
  .lw-side, .lw-main { display: contents; }
  .lw-kpis { order: 1; } .lw-map { order: 2; } .lw-tours { order: 3; } .lw-backlog { order: 4; } .lw-gantt { order: 5; }
  .lw-kpis { grid-template-columns: repeat(2, 1fr); }
  .lw-kpi { padding: 10px 16px; }
  .lw-kpi:nth-child(2n) { border-right: 0; }
  .lw-kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
  .lw-map { flex: none; min-height: 0; height: 62vh; height: 62dvh; }
  .lw-map .town-label { display: none; }
  .lw-filter { top: 8px; left: 10px; }
  .lw-chip { padding: 6px 11px; }
  .lw-map .pend-dot { r: 11px; }
  .lw-map .pend-mark { font-size: 12px; }
  .lw-map .stop { r: 13px; }
  .lw-map .stop-n { font-size: 13px; }
  .lw-tours { background: var(--white); border-top: 1px solid var(--line); }
  .lw-backlog { background: var(--white); }
  .lw-h, .lw-tour-head, .lw-fiche-btn, .lw-choose, .lw-empty { padding-left: 16px; padding-right: 16px; }
  .lw-stop { padding-left: 19px; padding-right: 10px; }
  .lw-tour-empty { padding-left: 54px; }
  .lw-gantt { padding: 12px 16px; }
  .lw-foot { padding: 12px 16px 14px; }
  .lw-foot-back { margin-left: 0; }
  .lw-loading { min-height: 100vh; min-height: 100dvh; }
}

@media (prefers-reduced-motion: reduce) {
  .lw-map .leg.is-new { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; }
  .lw-btn { transition: none; }
}


.lw-hors-ecran {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.lw .lw-btn.lw-btn--primary,
.lw .lw-btn.lw-btn--primary:hover,
.lw .lw-btn.lw-btn--primary:focus { color: #ffffff; }
.lw .lw-btn.lw-btn--primary:disabled {
  opacity: 1; background: var(--accent-soft);
  border-color: var(--line); color: var(--slate);
}

/* Toucher (Chrome Android) : pas de surlignage natif sur les grands conteneurs écoutés au clic. */
html { -webkit-tap-highlight-color: transparent; }
