:root{--blue:#0b63ce;--blue2:#0753b2;--topbar:#0b63ce;--text:#142238;--muted:#6b7890;--bg:#f5f7fb;--card:#fff;--border:#e2e8f0;--green:#18a66a;--orange:#f59e0b;--red:#e45757;--shadow:0 6px 20px rgba(20,34,56,.08)}
*{box-sizing:border-box}body{margin:0;font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;background:var(--bg);color:var(--text)}button,input,textarea,select{font:inherit;width:100%}button{cursor:pointer;border:0;min-width:0}.topbar{height:82.28px;background:var(--topbar);color:#fff;display:flex;align-items:center;justify-content:center;padding:0 18px;position:sticky;top:0;z-index:10}.brand{display:flex;align-items:center;gap:10px}.brand-mark{font-size:28px}.brand strong{display:block;font-size:14px;letter-spacing:.3px}.brand small{display:block;font-size:12px;opacity:.9;letter-spacing:2px}.icon-btn{background:transparent;color:#fff;font-size:22px;position:relative}.badge{position:absolute;right:-5px;top:-5px;background:#e45757;color:#fff;border-radius:20px;font-size:10px;padding:3px 5px}.view{max-width:760px;margin:0 auto;padding:18px 16px 100px}.hello{margin:6px 0 16px}.hello h1{font-size:22px;margin:0 0 4px}.muted{color:var(--muted)}.hero{background:linear-gradient(135deg,var(--blue),#0877e8);color:#fff;border-radius:18px;padding:20px;box-shadow:var(--shadow);margin-bottom:14px}.hero .num{font-size:38px;font-weight:800;display:block;margin:8px 0}.hero button{background:#fff;color:var(--blue);padding:10px 14px;border-radius:10px;font-weight:700}.grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.card{background:var(--card);border:1px solid var(--border);border-radius:15px;padding:15px;box-shadow:0 3px 10px rgba(20,34,56,.03)}.tile{min-height:100px}.tile .ico{font-size:24px}.tile strong{display:block;margin-top:8px}.tile small{color:var(--muted)}.section-title{display:flex;justify-content:space-between;align-items:center;margin:22px 0 10px}.section-title h2{font-size:17px;margin:0}.link{color:var(--blue);font-weight:700;background:none}.appointment{position:relative;padding-left:52px;margin-bottom:10px}.appointment .time{position:absolute;left:12px;top:16px;font-weight:800;color:var(--blue);font-size:13px}.dot{width:10px;height:10px;border-radius:50%;display:inline-block;margin-right:7px}.blue{background:var(--blue)}.orange{background:var(--orange)}.green{background:var(--green)}.gray{background:#94a3b8}.appt-title{font-weight:800}.appt-meta{font-size:12px;color:var(--muted);margin-top:4px;line-height:1.45}.row{display:flex;justify-content:space-between;align-items:center;gap:10px}.primary{background:var(--blue);color:#fff;padding:10px 14px;border-radius:10px;font-weight:750}.secondary{background:#eef5ff;color:var(--blue);padding:10px 14px;border-radius:10px;font-weight:750}.danger{background:#fff0f0;color:var(--red);padding:10px 14px;border-radius:10px;font-weight:750}.pill{padding:5px 9px;border-radius:20px;background:#edf8f3;color:var(--green);font-size:11px;font-weight:800}.bottom-nav{position:fixed;bottom:0;left:0;right:0;height:72px;background:#fff;border-top:1px solid var(--border);display:flex;justify-content:space-around;z-index:20;padding-bottom:env(safe-area-inset-bottom)}.bottom-nav button{background:none;color:#7b8799;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-width:70px}.bottom-nav button span{font-size:22px}.bottom-nav button small{font-size:11px}.bottom-nav button.active{color:var(--blue);font-weight:800}.back{background:none;color:var(--blue);font-weight:800;padding:0;margin-bottom:15px}.detail-head{display:flex;align-items:center;gap:12px}.avatar{width:48px;height:48px;border-radius:50%;background:#e6f0ff;color:var(--blue);display:grid;place-items:center;font-weight:800}.machine{margin-top:12px}.list{display:flex;flex-direction:column;gap:10px}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.field{display:flex;flex-direction:column;gap:6px;min-width:0}.field.full{grid-column:1/-1}.field label{font-size:12px;color:var(--muted);font-weight:700}.field input,.field textarea,.field select{border:1px solid var(--border);border-radius:10px;padding:11px;background:#fff;color:var(--text)}textarea{min-height:100px;resize:vertical}.checks{display:flex;flex-direction:column;gap:8px}.check{display:flex;align-items:center;gap:12px;background:#fff;border:1px solid var(--border);border-left:4px solid var(--blue);border-radius:10px;padding:12px 14px;font-size:14px;font-weight:600;color:var(--text)}.check input{width:20px;height:20px;flex-shrink:0;accent-color:var(--green);margin:0}.check:has(input:checked){background:#eaf8f0;border-left-color:var(--green)}.seg{display:flex;gap:8px;flex-wrap:wrap}.seg button{padding:9px 11px;border:1px solid var(--border);background:#fff;border-radius:10px}.seg button.active{background:var(--blue);color:#fff;border-color:var(--blue)}.signature{height:160px;border:2px dashed #b9c7da;border-radius:12px;background:#fff;display:grid;place-items:center;color:var(--muted)}.empty{text-align:center;padding:30px;color:var(--muted)}.top-actions{display:flex;gap:8px}.modal{position:fixed;inset:0;background:rgba(10,25,45,.45);display:none;align-items:flex-end;z-index:50}.modal.open{display:flex}.sheet{background:#fff;border-radius:20px 20px 0 0;width:100%;max-height:90vh;overflow:auto;padding:18px 18px calc(18px + env(safe-area-inset-bottom, 0px)) 18px}.sheet h3{margin-top:0}.toast{position:fixed;left:50%;bottom:90px;transform:translateX(-50%);background:#142238;color:#fff;padding:11px 16px;border-radius:10px;display:none;z-index:100}.toast.show{display:block}@media(min-width:800px){.bottom-nav{position:fixed;left:calc(50% - 380px);right:calc(50% - 380px);border-radius:18px 18px 0 0}.view{padding-bottom:100px}.grid{grid-template-columns:repeat(4,1fr)}}

.calendar-nav{display:flex;align-items:center;justify-content:space-between;margin:4px 0 12px}
/* En-tête façon Google Agenda — Jour/Semaine/Mois */
.gcal-header{display:flex;align-items:center;justify-content:space-between;margin:4px 0 16px;gap:6px}
.gcal-icon-btn{width:34px;height:34px;min-width:34px;border-radius:50%;background:#fff;border:1px solid var(--border);color:var(--muted);font-size:16px;display:flex;align-items:center;justify-content:center;flex:none}
.gcal-icon-btn:active{background:#eef1f5}
.gcal-title-wrap{display:flex;flex-direction:column;align-items:center;gap:6px;flex:1;min-width:0}
.gcal-title{font-size:16px;font-weight:700;text-align:center;text-transform:capitalize;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.gcal-today-pill{width:auto;border:1px solid var(--border);border-radius:20px;padding:4px 12px;font-size:11px;font-weight:700;color:var(--blue);background:#eef5ff}
.week-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:6px;overflow-x:auto}
.week-day{background:#fff;border:1px solid var(--border);border-radius:12px;min-height:230px;overflow:hidden}
.week-day.today{border:2px solid var(--blue)}
.week-head{display:flex;justify-content:space-between;align-items:center;padding:8px;background:#f7f9fc;border-bottom:1px solid var(--border);font-size:12px}
.week-head span{background:#eaf2ff;color:var(--blue);border-radius:50%;width:26px;height:26px;display:grid;place-items:center;font-weight:800}
.day-events{padding:5px;display:flex;flex-direction:column;gap:5px}
.mini-event{border-radius:8px;padding:6px;font-size:10px;cursor:pointer;color:#142238}
.mini-event b{display:block;font-size:10px}
.mini-event span,.mini-event small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mini-event.blue{background:#eaf2ff;border-left:3px solid var(--blue)}
.mini-event.orange{background:#fff5df;border-left:3px solid var(--orange)}
.mini-event.green{background:#e8f8f1;border-left:3px solid var(--green)}
.mini-event.gray{background:#eef1f5;border-left:3px solid #94a3b8}
.no-event{text-align:center;color:#a0a9b7;font-size:10px;padding:20px 2px}
.legend{display:flex;gap:12px;flex-wrap:wrap;margin-top:12px;font-size:11px;color:var(--muted)}
.legend .dot{margin-right:4px}
.month-weekdays{display:grid;grid-template-columns:repeat(7,1fr);margin-bottom:4px}
.month-weekdays span{text-align:center;color:var(--muted);font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.03em;padding:5px 0}
.month-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:1px;background:var(--border);border:1px solid var(--border);border-radius:12px;overflow:hidden}
.month-cell{background:#fff;min-height:96px;padding:4px;cursor:pointer;overflow:hidden;display:flex;flex-direction:column}
.month-cell.today{background:#f2f8ff}
.empty-cell{background:#fafbfc}
.month-day{font-size:11px;font-weight:700;color:var(--text);width:22px;height:22px;line-height:22px;text-align:center;border-radius:50%;margin-bottom:2px}
.month-cell.today .month-day{background:var(--blue);color:#fff;font-weight:800}
.month-events{display:flex;flex-direction:column;gap:1px;min-width:0}
.month-event{display:flex;align-items:center;gap:4px;font-size:9px;line-height:1.4;overflow:hidden}
.month-event .dot{width:6px;height:6px;min-width:6px;margin-right:0}
.month-event-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.month-more{font-size:8px;color:var(--muted);font-weight:700;margin-top:1px}
@media(max-width:650px){.week-grid{grid-template-columns:repeat(7,110px);padding-bottom:5px}.week-day{min-height:220px}.month-cell{min-height:72px}.month-event{font-size:8px}.month-weekdays span{font-size:9px}}

/* Grille horaire façon Google Agenda — vue Jour */
.day-timeline{background:#fff;border:1px solid var(--border);border-radius:14px;overflow:hidden;padding:10px 0}
.tl-body{position:relative}
.tl-hourline{position:absolute;left:0;right:0;border-top:1px solid #eef1f5}
.tl-hourlabel{position:absolute;left:6px;top:-7px;font-size:10px;color:var(--muted);background:#fff;padding:0 3px}
.tl-events{position:absolute;top:0;bottom:0}
.tl-event{position:absolute;border-radius:6px;padding:4px 8px;overflow:hidden;cursor:pointer;box-shadow:0 1px 3px rgba(20,34,56,.15);color:#fff}
.tl-event-time{font-size:10px;font-weight:700;opacity:.9}
.tl-event-title{font-size:12px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tl-event-client{font-size:10px;color:rgba(255,255,255,.85);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:1px}
.tl-event.blue{background:var(--blue)}
.tl-event.orange{background:var(--orange)}
.tl-event.green{background:var(--green)}
.tl-event.gray{background:#8a97a8}
.tl-free{position:absolute;left:0;right:0;border-radius:6px;background:transparent;display:flex;align-items:center;justify-content:center;cursor:pointer}
.tl-free span{font-size:10px;font-weight:600;color:#c2cbd8}
.tl-free:active{background:#f2f6fc}
.tl-free-locked{cursor:default;opacity:.7}
.tl-free-locked:active{background:transparent}
.tl-now{position:absolute;left:0;right:0;height:2px;background:var(--red);z-index:5}
.tl-now::before{content:'';position:absolute;left:-4px;top:-4px;width:9px;height:9px;border-radius:50%;background:var(--red)}
.ni-slot-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:4px}
.ni-slot{border-radius:8px;padding:10px 8px;font-weight:700;font-size:13px;text-align:center;border:2px solid transparent;cursor:pointer}
.ni-slot.free{background:#eaf7e8;color:var(--green)}
.ni-slot.free:active{background:#d9f1d5}
.ni-slot.busy{background:#f3f0e8;color:#8a6d1f;cursor:not-allowed}
.ni-slot.selected{border-color:var(--blue)}

/* Grille horaire façon Google Agenda — vue Semaine */
.week-timeline{display:flex;gap:0;background:#fff;border:1px solid var(--border);border-radius:14px;overflow:hidden}
.week-timeline-gutter{position:relative;width:44px;flex:0 0 44px;border-right:1px solid var(--border)}
.week-timeline-gutter-head{height:34px}
.week-timeline-days{flex:1;display:flex;overflow-x:auto}
.week-timeline-day{flex:1 0 90px;min-width:90px;border-right:1px solid var(--border);position:relative}
.week-timeline-day:last-child{border-right:0}
.week-timeline-day.today{background:#f7fbff}
.week-timeline-daylabel{height:34px;display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:10px;border-bottom:1px solid var(--border);background:#f7f9fc;gap:2px}
.week-timeline-day.today .week-timeline-daylabel{color:var(--blue)}
.week-timeline-daylabel span{font-weight:700;font-size:11px;width:18px;height:18px;line-height:18px;text-align:center;border-radius:50%}
.week-timeline-daylabel span.wtl-today{background:var(--blue);color:#fff;font-weight:800}
@media(max-width:650px){.week-timeline-day{flex:0 0 78px;min-width:78px}}

/* Logo fourni par l'utilisateur — intégré au bandeau bleu sans modifier sa hauteur */
.mpe-header-logo{
  height:84px;
  width:auto;
  max-width:270px;
  object-fit:contain;
  display:block;
  margin:0 auto;
}
@media (max-width:600px){
  .mpe-header-logo{height:72px;max-width:225px;margin:0 auto}
}

/* Signature rapport — ajout ciblé, sans modifier le reste de l'interface */
.signature-box{border:1px solid #d8e0ea;border-radius:14px;background:#fff;overflow:hidden;position:relative}
.signature-canvas{display:block;width:100%;height:190px;touch-action:none;background:#fff;cursor:crosshair}
.signature-hint{font-size:12px;color:#7b8794;padding:7px 10px;border-top:1px dashed #d8e0ea;background:#f8fafc}
.signature-status{line-height:1.8;margin-top:14px}

/* Rapports PDF — ajout ciblé */
.report-page{background:#fff;max-width:900px;margin:18px auto;padding:34px;box-shadow:0 4px 20px rgba(20,34,56,.12);color:#142238}
.report-head{display:flex;justify-content:space-between;align-items:flex-start;border-bottom:3px solid #1677c8;padding-bottom:16px;margin-bottom:18px}
.report-head h1{margin:0;font-size:25px}.report-type{font-weight:700;margin-top:5px}.report-date{font-weight:700}
.report-section{border:1px solid #dce4ed;border-radius:10px;padding:16px;margin:12px 0}.report-section h2{font-size:17px;margin:0 0 12px}
.report-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.report-text{white-space:pre-wrap;min-height:25px}
.report-section ul{margin:5px 0;padding-left:22px}.report-signatures{display:grid;grid-template-columns:1fr 1fr;gap:30px;margin-top:24px}.report-signatures>div{min-height:145px;border-top:1px solid #142238;padding-top:8px}.report-signatures img{display:block;max-width:260px;height:100px;object-fit:contain;margin-top:8px}.report-footer{border-top:1px solid #dce4ed;margin-top:28px;padding-top:10px;font-size:11px;color:#6c7785}
@media(max-width:700px){.report-page{padding:18px}.report-grid{grid-template-columns:1fr 1fr}.report-signatures{grid-template-columns:1fr}}
@media print{body{background:#fff!important}.no-print,.topbar,.bottomnav{display:none!important}.report-page{box-shadow:none;margin:0;max-width:none;padding:12mm}.report-section{break-inside:avoid}.report-head{break-after:avoid}@page{size:A4;margin:8mm}}

/* Rapport : même logique visuelle que les écrans d'intervention */
.report-page{background:#f6f8fb;max-width:900px;margin:18px auto;padding:22px;color:#142238;box-shadow:0 4px 20px rgba(20,34,56,.12)}
.report-head{display:flex;justify-content:space-between;align-items:flex-start;background:#fff;border-radius:14px;padding:18px;margin-bottom:14px;border-bottom:3px solid #1677c8}
.report-head h1{margin:0;font-size:24px}.report-type{font-weight:700;margin-top:5px}.report-date{font-weight:700}
.report-card{background:#fff;border-radius:14px;padding:18px;margin:14px 0;border:1px solid #e1e7ef;break-inside:avoid;page-break-inside:avoid}
.report-card h2{font-size:18px;margin:0 0 14px}.report-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
.report-grid>div{background:#f8fafc;border-radius:10px;padding:10px;break-inside:avoid;page-break-inside:avoid}.report-grid label{display:block;font-size:12px;color:#718096;margin-bottom:4px}.report-grid strong{display:block}
.report-field{background:#f8fafc;border-radius:10px;padding:11px;margin:9px 0;break-inside:avoid;page-break-inside:avoid}.report-field b{display:block;font-size:12px;color:#718096;margin-bottom:4px}.report-text,.report-field div{white-space:pre-wrap;min-height:22px}
.report-checks{display:grid;grid-template-columns:1fr 1fr;gap:7px}.report-seg{display:flex;gap:8px;margin-bottom:14px}.report-seg span{padding:9px 16px;border:1px solid #d5dde7;border-radius:9px}.report-seg .active{background:#e9f3ff;border-color:#1677c8;font-weight:700}
.report-gauge{height:16px;border-radius:20px;background:linear-gradient(90deg,#e45757 0 25%,#f59e0b 25% 45%,#18a66a 45% 75%,#f59e0b 75% 88%,#e45757 88%);position:relative;margin:15px 0}.report-gauge span{position:absolute;top:-6px;width:4px;height:28px;background:#142238;border-radius:3px;transform:translateX(-50%)}
.report-gauge-labels{display:flex;justify-content:space-between;font-size:12px}.report-status{margin:10px 0}.report-signatures{display:grid;grid-template-columns:1fr 1fr;gap:30px;margin-top:20px}.report-signatures>div{background:#fff;border-radius:14px;padding:18px;min-height:145px;border:1px solid #e1e7ef}.report-signatures img{display:block;max-width:260px;height:100px;object-fit:contain;margin-top:8px}.report-footer{text-align:center;margin-top:18px;font-size:11px;color:#718096}
@media(max-width:700px){.report-page{padding:12px}.report-grid{grid-template-columns:1fr 1fr}.report-checks{grid-template-columns:1fr}.report-signatures{grid-template-columns:1fr}}
@media print{body{background:#fff!important}.no-print,.topbar,.bottomnav{display:none!important}.report-page{box-shadow:none;margin:0;max-width:none;padding:8mm;background:#fff}.report-card{break-inside:avoid}.report-head{break-after:avoid}@page{size:A4;margin:6mm}}

.photo-preview-grid,.photo-report-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:8px}
.photo-thumb{position:relative;border:1px solid #dbe2ea;border-radius:10px;overflow:hidden;background:#f8fafc;aspect-ratio:4/3}
.photo-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.photo-remove{position:absolute;right:5px;top:5px;border:0;border-radius:50%;width:25px;height:25px;background:#e45757;color:#fff;font-weight:800;cursor:pointer}
.photo-report-columns{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.photo-report-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.photo-report-grid img{width:100%;max-height:105mm;object-fit:contain;border:1px solid #dbe2ea;border-radius:8px;background:#fff;display:block}
.pdf-photos{break-inside:avoid;page-break-inside:avoid}


/* PDF : conserver les photos sur la première page */
.pdf-photos-page1 {
  break-before: auto !important;
  page-break-before: auto !important;
  break-after: avoid !important;
  page-break-after: avoid !important;
  break-inside: avoid !important;
  page-break-inside: avoid !important;
}


/* PDF : commencer l'état de charge sur une nouvelle page pour éviter
   qu'il soit coupé en bas de la page des photos. */
/* PDF : faire tenir état de charge + commentaires + signatures sur la page 2 */
.pdf-comment-compact {
  margin-top: 10px !important;
  margin-bottom: 10px !important;
  padding-top: 10px !important;
  padding-bottom: 10px !important;
  break-inside: avoid !important;
  page-break-inside: avoid !important;
}

.pdf-comment-compact h2 {
  margin-top: 0 !important;
  margin-bottom: 8px !important;
}

.pdf-signatures-compact,
.pdf-signatures-compact > * {
  margin-top: 6px !important;
}

.pdf-signatures-compact .signature-card {
  min-height: 120px !important;
  height: 120px !important;
  padding: 12px !important;
}

.pdf-signatures-compact canvas {
  max-height: 70px !important;
}

.pdf-charge-page2 {
  margin-bottom: 8px !important;
  break-inside: avoid !important;
  page-break-inside: avoid !important;
}

/* PDF : compactage réel de la zone commentaires + signatures
   pour conserver l'ensemble sur la page 2. */
.pdf-comment-compact {
  margin: 6px 0 !important;
  padding: 8px 10px !important;
}
.pdf-comment-compact h2 {
  margin: 0 0 5px !important;
  font-size: 14px !important;
}
.pdf-comment-compact .report-text {
  min-height: 12px !important;
}
.report-signatures {
  margin-top: 6px !important;
  gap: 12px !important;
  break-inside: avoid !important;
  page-break-inside: avoid !important;
}
.report-signatures > div {
  min-height: 72px !important;
  height: 72px !important;
  padding-top: 5px !important;
}
.report-signatures img {
  max-width: 180px !important;
  height: 48px !important;
  margin-top: 3px !important;
}
.report-footer {
  margin-top: 6px !important;
  padding-top: 5px !important;
  font-size: 9px !important;
}

/* PDF : pagination directe du bloc état de charge */
.pdf-charge-page-break{height:0!important;margin:0!important;padding:0!important;}

/* html2pdf : saut de page legacy réellement utilisé par l'export */


/* PDF : le bloc (charge + commentaire + signatures) reste groupé,
   mais sans saut de page forcé avant lui : il suit le flux naturel. */
.pdf-page2-group {
  break-inside: avoid !important;
  page-break-inside: avoid !important;
}

/* Cartes rapports interactives */
.report-item-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}
.report-item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(20,34,56,0.1);
}
.report-item-card:active {
  transform: translateY(0);
}

