/* =====================================================
   MERIDIAN OPS — Design system
   Tokens repris de Meridian Stay, variante "outil" :
   plus dense, orienté lisibilité terrain (mobile, plein soleil).
   ===================================================== */

:root {
  --ink:     #111009;
  --ink-2:   #1B1814;
  --bone:    #EDE6D5;
  --stone:   #918B81;
  --brass:   #C4A55A;
  --gold:    #A8893A;
  --cream:   #F8F4EF;
  --cream-2: #EFE9DF;
  --muted:   #7A7268;

  /* Langage visuel métier (Sprint 1 UX — couleur = état, badge texte systématique)
     ⚪ libre · 🟩 sous contrôle · 🟨 en attente d'acceptation · 🟧 à pourvoir
     🟥 action immédiate · ⚫ terminée — le BLEU est banni. */
  --st-ok:       #427C4B;   /* sous contrôle (affectée ET acceptée) — blanc 4.98:1 */
  --st-pending:  #E3B23C;   /* en attente d'acceptation (texte ENCRE dessus : 9.7:1) */
  --st-open:     #AD600D;   /* à pourvoir — blanc 4.71:1 */
  --st-action:   #C23B2B;   /* action immédiate requise */
  --st-done:     #3A3733;   /* terminée */
  --st-cancel:   #918B81;
  --st-assigned: var(--st-ok);      /* alias legacy → vert */

  /* Priorités */
  --prio-urgent: var(--st-action);

  --serif: 'Playfair Display', Georgia, serif;   /* chiffres lisibles (1 ≠ I) */
  --sans:  'DM Sans', -apple-system, sans-serif;

  --nav-h:    64px;
  --topbar-h: 56px;
  --safe-b:   env(safe-area-inset-bottom);
  --safe-t:   env(safe-area-inset-top);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Icônes de service (SVG ligne, currentColor) — mêmes tracés que le back-office */
.svc-icon {
  width: 1.15em; height: 1.15em; vertical-align: -0.2em; display: inline-block;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}

/* iOS Safari colore les <button> en bleu système si aucune couleur n'est posée
   (constaté en recette terrain sur iPhone) — le bleu est banni du produit. */
button { color: inherit; font-family: var(--sans); -webkit-tap-highlight-color: transparent; }

/* L'attribut hidden doit gagner sur les display: flex des composants */
[hidden] { display: none !important; }

body {
  font-family: var(--sans);
  background: var(--cream);
  color: var(--ink);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: calc(var(--topbar-h) + var(--safe-t));
  padding-top: var(--safe-t);
  background: var(--ink);
  color: var(--bone);
  display: flex; align-items: center; justify-content: space-between;
  padding-left: 20px; padding-right: 20px;
}
.topbar .brand { font-family: var(--serif); font-size: 20px; letter-spacing: .06em;
  display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .brand em { color: var(--brass); font-style: normal; }
.topbar .brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Pastille claire derrière le logo du topbar : garde lisible un PNG transparent / à encre sombre sur le fond noir */
.brand-logo { height: 34px; box-sizing: border-box; padding: 4px 8px; background: #f7f3ea;
  border-radius: 8px; width: auto; max-width: 156px; object-fit: contain; flex: none; }
/* Logo de marque sur le splashscreen (carte de login) */
.login-brand { text-align: center; margin-bottom: 14px; }
.login-brand .login-logo { max-height: 68px; max-width: 210px; width: auto; border-radius: 10px; }

main {
  padding: calc(var(--topbar-h) + var(--safe-t) + 16px) 16px
           calc(var(--nav-h) + var(--safe-b) + 24px);
  max-width: 640px; margin: 0 auto;
}

/* ── Vues (une seule visible) ───────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ── Login ──────────────────────────────────────────── */
.login-card {
  background: #fff; border-radius: 14px; padding: 28px 22px;
  margin-top: 10vh; box-shadow: 0 2px 24px rgba(17,16,9,.07);
}
.login-card h1 { font-family: var(--serif); font-size: 28px; margin-bottom: 4px; }
.login-card p  { color: var(--muted); font-size: 14px; margin-bottom: 20px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 13px 14px; font-size: 16px;
  border: 1px solid var(--cream-2); border-radius: 10px;
  background: var(--cream); font-family: var(--sans);
}
.field input:focus { outline: 2px solid var(--brass); border-color: transparent; }

.btn {
  display: block; width: 100%; padding: 14px; border: 0; border-radius: 10px;
  background: var(--ink); color: var(--bone); font-size: 15px; font-weight: 600;
  font-family: var(--sans); cursor: pointer;
}
.btn.brass { background: var(--brass); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn:disabled { opacity: .5; }

.form-error { color: var(--prio-urgent); font-size: 13px; margin-top: 10px; min-height: 18px; }
.form-note { color: var(--st-ok); font-size: 13px; line-height: 1.5; margin-top: 12px; min-height: 18px; }
.form-note.is-error { color: var(--prio-urgent); }
.link-btn {
  display: inline-block; margin-top: 16px; padding: 6px 0;
  background: none; border: none; color: var(--muted);
  font-size: 13px; text-decoration: underline; cursor: pointer;
}
.link-btn:hover { color: var(--ink); }

/* ── Missions : carte ───────────────────────────────── */
.day-header {
  font-family: var(--serif); font-size: 20px; margin: 22px 0 10px;
  text-transform: capitalize;
}

.mission-card {
  background: #fff; border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
  border-left: 4px solid var(--villa-color, var(--brass));
  box-shadow: 0 1px 10px rgba(17,16,9,.05);
}
.mission-card .row1 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.mission-card .villa { font-weight: 600; font-size: 15px; }
.mission-card .type  { color: var(--muted); font-size: 13px; }

.badge {
  font-size: 11px; font-weight: 600; letter-spacing: .05em;
  padding: 3px 9px; border-radius: 20px; white-space: nowrap;
}
.badge.open     { background: color-mix(in srgb, var(--st-open) 16%, white);     color: #8A4E0F; }
.badge.pending  { background: color-mix(in srgb, var(--st-pending) 22%, white);  color: #7A5A10; }
.badge.ok       { background: color-mix(in srgb, var(--st-ok) 16%, white);       color: #2E5A34; }
.badge.assigned { background: color-mix(in srgb, var(--st-ok) 16%, white);       color: #2E5A34; }
.badge.done     { background: color-mix(in srgb, var(--st-done) 14%, white);     color: var(--st-done); }
.badge.urgent   { background: var(--prio-urgent); color: #fff; }

.mission-card .actions { margin-top: 12px; display: flex; gap: 8px; }
.mission-card .actions .btn { padding: 11px; font-size: 14px; min-height: 44px; }

/* ── Carte recto/verso : RECTO = action, VERSO = informations utiles ──
   Retournement en deux quarts de tour (aller ease-in, retour ease-out)
   pour que la hauteur suive naturellement le contenu de chaque face. */
.mission-card { transition: transform .16s ease-out, opacity .25s ease, box-shadow .25s ease; transform: perspective(700px) rotateY(0); }
.mission-card.flip-half { transform: perspective(700px) rotateY(90deg); transition-timing-function: ease-in; }
.mission-card.flip-return { transition: none; transform: perspective(700px) rotateY(-90deg); }

.row1-right { display: flex; align-items: center; gap: 8px; flex: none; }
.info-btn {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--cream-2); background: var(--cream); color: var(--gold);
  font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 17px;
  line-height: 1; cursor: pointer; margin: -4px -4px -4px 0;
}
.info-btn .svc-icon { width: 18px; height: 18px; vertical-align: 0; }
.info-btn:active { background: var(--cream-2); }

/* Verso : hiérarchie fixe literie → consignes → accès → contact */
.v-sec { margin-top: 12px; font-size: 13.5px; line-height: 1.55; }
.v-title {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 4px; font-weight: 600;
}
.v-muted { color: var(--muted); }
.bed-line { padding: 2px 0; }
.bed-line b { font-variant-numeric: tabular-nums; }
.bed-note { color: var(--muted); font-size: 12.5px; }

/* ── Bottom nav ─────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--ink); display: flex;
}
.bottom-nav button {
  flex: 1; background: none; border: 0; color: var(--stone);
  font-family: var(--sans); font-size: 12.5px; font-weight: 500; letter-spacing: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  cursor: pointer; padding: 0 1px; white-space: nowrap;
}
.bottom-nav button.active { color: var(--brass); }
.bottom-nav svg { width: 22px; height: 22px; }

.empty { text-align: center; color: var(--muted); padding: 48px 20px; font-size: 14px; }

/* ── Centre de notifications (admin + partenaire) ───── */
.notif-btn {
  position: relative; border: 0; background: transparent; color: inherit;
  font-size: 19px; cursor: pointer; padding: 4px 6px; line-height: 1;
}
.notif-badge {
  position: absolute; top: -3px; right: -4px;
  background: var(--prio-urgent); color: #fff;
  font-size: 10px; font-weight: 700; font-family: var(--sans);
  border-radius: 10px; padding: 1px 5px; line-height: 1.4;
}
.notif-panel {
  position: fixed; top: calc(var(--topbar-h) + var(--safe-t) + 6px); right: 10px;
  width: min(370px, calc(100vw - 20px)); max-height: 62vh;
  display: flex; flex-direction: column; overflow: hidden;   /* le panneau clippe ; SEULE la liste scrolle */
  background: #fff; border-radius: 12px; z-index: 80;
  box-shadow: 0 10px 40px rgba(17,16,9,.25);
}
/* en-tête HORS du scroll (flex, plus de position:sticky : buggé sur iOS dans un
   conteneur fixed+overflow → fond non peint pendant le scroll = effet transparent) */
.notif-head {
  flex: none; background: #fff;
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 14px; border-bottom: 1px solid var(--cream-2);
  font-size: 13px; font-weight: 600;
}
.notif-list { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.notif-head button {
  border: 0; background: none; color: var(--gold); font-size: 12.5px;
  cursor: pointer; font-family: var(--sans);
}
.notif-item {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 11px 14px; border-bottom: 1px solid var(--cream-2);
  cursor: pointer; font-family: var(--sans);
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--cream); }
.notif-item .nt { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.notif-item .nb { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.notif-item .nd { font-size: 11px; color: var(--stone); margin-top: 3px; }
.notif-empty { padding: 26px 14px; text-align: center; color: var(--muted); font-size: 13px; }

/* ── Espace partenaire : Flux du jour ───────────────── */
.topbar-session { display: flex; align-items: center; gap: 12px; }
#logout-btn {
  padding: 6px 13px; border: 1px solid rgba(237,230,213,.3); border-radius: 18px;
  background: transparent; font-family: var(--sans); font-size: 12.5px;
  color: inherit; cursor: pointer;
}

/* En mobile, « Bonjour {prénom} » suffit — on ne répète pas le nom dans la topbar */
@media (max-width: 480px) {
  #topbar-user { display: none; }
}

.refresh-btn {
  display: block; width: 100%; margin: 2px 0 14px; padding: 12px;
  border: 1px solid var(--cream-2); border-radius: 10px;
  background: #fff; color: var(--gold); font-family: var(--sans);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.refresh-btn:disabled { opacity: .5; }

.hello { margin: 6px 0 18px; }
.hello h1 { font-family: var(--serif); font-size: 26px; }
.hello p  { color: var(--muted); font-size: 14px; margin-top: 2px; }

.section-title {
  font-size: 14px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink); margin: 22px 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.section-title .count {
  background: var(--cream-2); border-radius: 12px; padding: 1px 8px;
  font-weight: 600; color: var(--ink);
}

.badge.late { background: var(--prio-urgent); color: #fff; }

/* Code mission lisible (YYMMDD-NNN) — référence à citer, discrète */
.mission-card .mcode {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  color: var(--gold); background: var(--cream); border: 1px solid var(--cream-2);
  border-radius: 6px; padding: 2px 8px; margin-top: 6px;
}
/* Type de service + moment : l'information n°1 de l'intervenant — bien visible */
.mission-card .slotline { color: var(--ink); font-size: 17.5px; font-weight: 650; margin-top: 5px; letter-spacing: .01em; }
/* Rémunération convenue — visible dès l'offre (levier de claim, décision 2026-07-06) */
.mission-card .payline { display: flex; align-items: center; gap: 6px; color: var(--gold); font-size: 14px; margin-top: 4px; }
.mission-card .payline b { font-size: 15px; }
/* Bandeau adresse + navigation (recto, missions assignées uniquement) */
.mission-card .where { color: var(--muted); font-size: 13px; margin-top: 8px; }
.mission-card.done-card { opacity: .55; }


/* Navigation vers la villa (Waze / Maps) — boutons secondaires, accessibles au pouce */
.nav-actions { display: flex; gap: 8px; margin-top: 10px; }
.nav-btn {
  flex: 1; text-align: center; padding: 11px 8px; min-height: 44px;
  display: flex; align-items: center; justify-content: center; gap: 7px; box-sizing: border-box;
  border: 1px solid var(--cream-2); border-radius: 9px;
  background: #fff; color: var(--ink); font-size: 13.5px; font-weight: 600;
  text-decoration: none; font-family: var(--sans);
}
.nav-btn:active { background: var(--cream-2); }

/* Deux actions côte à côte (Je prends/Indisponible, Confirmer/Signaler) */
.mission-card .actions { display: flex; gap: 8px; }
.mission-card .actions .btn { flex: 1; }
.btn.outline {
  background: #fff; border: 1px solid var(--cream-2); color: var(--muted); font-weight: 600;
}

/* ── Disponibilité villas (partenaire) ──────────────── */
.villa-avail {
  background: #fff; border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
  border-left: 4px solid var(--villa-color, var(--brass));
  box-shadow: 0 1px 10px rgba(17,16,9,.05);
}
.villa-avail .vname { font-weight: 600; font-size: 15px; }
.villa-avail .vfree { font-size: 13px; color: var(--st-done); font-weight: 600; margin-top: 2px; }
.villa-avail .vfree.none { color: var(--muted); font-weight: 400; }
.avail-strip { display: flex; gap: 2px; margin-top: 10px; }
.avail-day { flex: 1; }
.avail-day .sq {
  height: 16px; border-radius: 3px; background: var(--cream-2);
}
.avail-day.busy .sq { background: color-mix(in srgb, var(--villa-color, var(--stone)) 45%, white); }
.avail-day.today .sq { outline: 2px solid var(--gold); outline-offset: 1px; }
.avail-day .dl { font-size: 8.5px; color: var(--muted); text-align: center; margin-top: 3px; }
.avail-legend { font-size: 12px; color: var(--muted); padding: 4px 2px 14px; }
/* Bloc « Disponibilité de la villa » au verso d'une mission (réutilise .avail-*) */
.v-avail .vfree { font-size: 13px; color: var(--st-done); font-weight: 600; }
.v-avail .vfree.none { color: var(--muted); font-weight: 400; }

.toast {
  position: fixed; bottom: calc(var(--nav-h) + var(--safe-b) + 14px);
  left: 50%; transform: translateX(-50%); z-index: 95;
  background: var(--ink); color: var(--bone); border-radius: 10px;
  padding: 11px 20px; font-size: 13.5px; white-space: nowrap;
  box-shadow: 0 8px 30px rgba(17,16,9,.3);
}

/* ── Facturation partenaire ─────────────────────────── */
.billing { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--cream-2); }
.bill-status { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.bill-amount { font-weight: 700; color: var(--ink); }
.bill-rejected { color: var(--st-action); font-size: 13px; margin-bottom: 8px; }
.bill-deposit { min-height: 46px; }
.bill-del { min-height: 40px; margin-top: 8px; font-size: 13px; }

/* Feuille modale de dépôt (bottom sheet mobile) */
.sheet-veil {
  position: fixed; inset: 0; z-index: 100; background: rgba(17,16,9,.4);
  display: flex; align-items: flex-end; justify-content: center;
}
/* Modale de confirmation premium (remplace confirm() natif) */
.ui-modal { position: fixed; inset: 0; z-index: 300; background: rgba(17,16,9,.5); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 22px; animation: uiFade .14s ease; }
@keyframes uiFade { from { opacity: 0 } to { opacity: 1 } }
.ui-modal-card { background: #fff; border-radius: 18px; padding: 22px; max-width: 380px; width: 100%;
  box-shadow: 0 24px 60px rgba(17,16,9,.28); animation: uiPop .16s ease; }
@keyframes uiPop { from { transform: translateY(8px) scale(.98); opacity: .6 } to { transform: none; opacity: 1 } }
.ui-modal-card h3 { font-family: var(--serif); font-size: 20px; margin: 0 0 8px; }
.ui-modal-body { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0 0 18px; }
.ui-modal-actions { display: flex; gap: 10px; }
.ui-mbtn { flex: 1; padding: 14px; border: 0; border-radius: 11px; font: inherit; font-size: 14.5px; font-weight: 600;
  cursor: pointer; min-height: 48px; }
.ui-mbtn.ghost { background: var(--cream); color: var(--ink); }
.ui-mbtn.brass { background: var(--brass); color: var(--ink); }
.ui-mbtn.danger { background: var(--st-action); color: #fff; }
.sheet {
  background: #fff; width: 100%; max-width: 640px; border-radius: 18px 18px 0 0;
  padding: 20px 18px calc(24px + var(--safe-b)); max-height: 92vh; overflow-y: auto;
  box-shadow: 0 -8px 40px rgba(17,16,9,.25);
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head b { font-family: var(--serif); font-size: 20px; }
.sheet-x { border: 0; background: none; font-size: 20px; color: var(--muted); cursor: pointer; }
.sheet-sub { color: var(--muted); font-size: 13px; margin: 2px 0 16px; }
.sheet-file {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; border: 2px dashed var(--brass); border-radius: 12px;
  color: var(--gold); font-weight: 600; font-size: 15px; cursor: pointer; text-align: center;
  padding: 12px; background: var(--cream);
}
.sheet-file-btns { display: flex; gap: 8px; }
.sheet-file-btn { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 56px; border: 2px dashed var(--brass); border-radius: 12px; color: var(--gold);
  font-weight: 600; font-size: 14px; cursor: pointer; text-align: center; padding: 12px 10px; background: var(--cream); }
.sheet-file-btn svg { width: 1.1em; height: 1.1em; }
.sheet-filelist { font-size: 12.5px; color: var(--muted); margin: 8px 2px 0; }
.sheet-label { display: block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 16px 0 6px; }
.sheet-input {
  width: 100%; padding: 13px 14px; font-size: 16px; font-family: var(--sans);
  border: 1px solid var(--cream-2); border-radius: 10px; background: var(--cream);
}
.sheet-err { color: var(--st-action); font-size: 13px; min-height: 18px; margin-top: 8px; }
.sheet .btn { margin-top: 14px; }
.sheet-motif { color: var(--st-action); font-size: 13px; margin: 8px 0 4px; }
.sheet-existing { margin-bottom: 12px; }
.ex-file {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; border: 1px solid var(--cream-2); border-radius: 9px; margin-bottom: 6px;
  font-size: 13px; background: var(--cream);
}
.ex-file.removed { opacity: .45; text-decoration: line-through; }
.ex-del { border: 0; background: none; color: var(--st-action); font-size: 15px; cursor: pointer; padding: 4px 8px; }

/* Vue Factures partenaire */
.inv-p-seg { display: flex; overflow-x: auto; gap: 6px; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.inv-p-seg button {
  flex: 0 0 auto; border: 1px solid var(--cream-2); border-radius: 18px; background: #fff;
  padding: 8px 14px; min-height: 40px; font-family: var(--sans); font-size: 13px; color: var(--ink); cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
/* Hover premium seulement sur périphérique à survol (évite l'état « collé » après tap sur mobile). */
@media (hover: hover) {
  .inv-p-seg button:not(.active):hover { background: color-mix(in srgb, var(--brass) 9%, #fff); color: var(--gold); border-color: color-mix(in srgb, var(--brass) 35%, var(--cream-2)); }
}
.inv-p-seg button.active { background: var(--ink); color: var(--bone); border-color: var(--ink); }
.inv-p-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.inv-p-filters input, .inv-p-filters select {
  flex: 1 1 30%; min-width: 0; padding: 11px 12px; font-size: 15px; font-family: var(--sans);
  border: 1px solid var(--cream-2); border-radius: 10px; background: var(--cream);
  color: var(--ink); -webkit-text-fill-color: var(--ink);   /* iOS : jamais de texte bleu système */
  appearance: none; -webkit-appearance: none;
}
.inv-p-filters select {
  padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23A89A82' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.inv-p-filters input::placeholder { color: var(--muted); -webkit-text-fill-color: var(--muted); opacity: 1; }
.inv-p-filters input:focus, .inv-p-filters select:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brass) 14%, transparent); }
/* Focus lecture : quand une carte est retournée, on estompe les autres.
   (La transition opacity/box-shadow est portée par la règle .mission-card de base — ligne ~156 —
   pour ne PAS écraser la transition `transform` de l'animation de flip.) */
body.card-focus .mission-card:not(.flipped) { opacity: .32; }
body.card-focus .mission-card.flipped { box-shadow: 0 8px 34px rgba(17, 16, 9, .16); }
.pinv-card {
  background: #fff; border-radius: 12px; padding: 13px 15px; margin-bottom: 10px;
  border-left: 4px solid var(--iv, var(--stone)); box-shadow: 0 1px 10px rgba(17,16,9,.05);
}
.pinv-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pinv-title { font-weight: 600; font-size: 14.5px; }
.pinv-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.pinv-await { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; color: var(--gold); background: #faf6ec; border-radius: 8px; padding: 8px 10px; }
.pinv-files { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 9px; }
.pinv-file {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; cursor: pointer;
  color: var(--ink); border: 1px solid var(--cream-2); border-radius: 8px; padding: 8px 11px; background: var(--cream); font-family: var(--sans);
}
.bill-actions { display: flex; gap: 8px; margin-top: 10px; }
.bill-actions .btn { flex: 1; min-height: 44px; margin-top: 0; }

/* ══ Rapport d'intervention (Report Engine, remplissage partenaire) ══ */
.report-cta { margin-top: 10px; }
.report-cta .btn { width: 100%; min-height: 46px; margin-top: 0; }
.rep-veil { align-items: stretch; }
.rep-sheet {
  max-width: 720px; border-radius: 0; max-height: 100vh; height: 100%;
  padding: 0; display: flex; flex-direction: column;
}
.rep-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: calc(14px + var(--safe-t)) 18px 12px; border-bottom: 1px solid var(--cream-2);
  position: sticky; top: 0; background: #fff; z-index: 2;
}
.rep-head b { font-family: var(--serif); font-size: 18px; line-height: 1.2; }
.rep-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.rep-save-ind { font-size: 12px; color: var(--muted); padding: 6px 18px; background: var(--cream); display: flex; align-items: center; gap: 5px; }
.rep-save-ind .svc-icon { color: var(--st-ok); }
.rep-banner-ok { display: flex; align-items: center; gap: 7px; padding: 11px 18px; background: color-mix(in srgb, var(--st-ok) 12%, white); color: #2E5A34; font-weight: 600; font-size: 14px; }
/* Mot de reconnaissance de la conciergerie (044) — visible sur le rapport validé, valorise l'intervenant. */
.rep-kudos { display: flex; align-items: flex-start; gap: 10px; margin: 10px 14px 0; padding: 13px 15px; background: color-mix(in srgb, var(--brass) 12%, white); border: 1px solid color-mix(in srgb, var(--brass) 40%, white); border-radius: 12px; }
.rep-kudos .svc-icon { width: 18px; height: 18px; color: var(--gold); flex: none; margin-top: 1px; }
.rep-kudos-t { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.rep-kudos-b { font-size: 14.5px; color: var(--ink); line-height: 1.45; margin-top: 2px; font-family: var(--serif); }
.rep-body { flex: 1; overflow-y: auto; padding: 6px 18px 20px; }
.rep-sec { margin-top: 20px; }
.rep-sec h3 { font-family: var(--serif); font-size: 15px; color: var(--ink); margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--cream-2); }
.rep-foot { padding: 12px 18px calc(14px + var(--safe-b)); border-top: 1px solid var(--cream-2); position: sticky; bottom: 0; background: #fff; }
.rep-foot .btn { width: 100%; min-height: 50px; margin-top: 0; }

.rb { margin-bottom: 15px; }
.rb-label { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.rb-req { color: var(--st-action); }
.rb-help { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; line-height: 1.4; }
.rb-empty { font-size: 13px; color: var(--muted); font-style: italic; padding: 8px 0; }
.rb-input {
  width: 100%; padding: 12px 13px; font-size: 16px; font-family: var(--sans);
  border: 1px solid var(--cream-2); border-radius: 10px; background: var(--cream); color: var(--ink);
}
.rb-input:focus { outline: 2px solid var(--brass); border-color: transparent; }
.rb-area { resize: vertical; line-height: 1.45; }
.rb-mesure { display: flex; align-items: center; gap: 10px; }
.rb-mesure .rb-input { max-width: 180px; }
.rb-unit { color: var(--muted); font-size: 14px; }
.rb-mission { background: var(--cream); border-radius: 12px; padding: 13px 15px; border-left: 4px solid var(--brass); }
.rbm-code { font-family: var(--mono, monospace); font-size: 12px; letter-spacing: .04em; color: var(--gold); font-weight: 700; }
.rbm-line { font-size: 14px; margin-top: 4px; }

.rb-yesno { display: flex; gap: 8px; }
.rb-yesno button {
  flex: 1; min-height: 44px; border: 1px solid var(--cream-2); border-radius: 10px;
  background: #fff; font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer;
}
.rb-yesno button.on { background: var(--ink); color: var(--bone); border-color: var(--ink); }

.rb-checklist, .rb-assets { display: flex; flex-direction: column; gap: 4px; }
.rb-crow, .rb-arow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--cream); }
.rb-cname, .rb-aname { font-size: 13.5px; color: var(--ink); flex: 1; }
.rb-aname em { color: var(--muted); font-style: normal; font-size: 12px; }
/* iOS : l'appui long sur un contrôle déclenchait la loupe de sélection / le menu
   contextuel (et laissait la page zoomée). On coupe la sélection + le callout sur
   la feuille de rapport (les champs texte restent sélectionnables) et on désactive
   le double-tap zoom sur les éléments tactiles. */
.rep-sheet, .rep-body, .rb-seg button, .rb-yesno button, .rb-tile, .rb-photo-btn { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.rep-body button, .rep-body label, .rb-seg button, .rb-yesno button, .rb-tile { touch-action: manipulation; }
.rep-body input, .rep-body textarea, .rep-body select { -webkit-user-select: text; user-select: text; }
.rb-seg { display: flex; gap: 4px; flex: 0 0 auto; }
.rb-seg button {
  border: 1px solid var(--cream-2); background: #fff; border-radius: 8px; cursor: pointer;
  font-family: var(--sans); font-size: 11.5px; color: var(--muted); padding: 7px 9px; min-height: 34px; white-space: nowrap;
}
/* Fond par défaut sur .on → un bouton sélectionné n'est JAMAIS invisible, même si
   sa clé n'a pas de couleur sémantique (bug corrigé : fait/partiel/non_prevu/a_signaler). */
.rb-seg button.on { background: var(--ink); color: #fff; border-color: transparent; font-weight: 600; }
.rb-seg button.on.bon, .rb-seg button.on.ok, .rb-seg button.on.fait { background: var(--st-ok); }
.rb-seg button.on.moyen, .rb-seg button.on.surveiller, .rb-seg button.on.a_remplacer, .rb-seg button.on.partiel { background: var(--st-pending); color: var(--ink); }
.rb-seg button.on.a_reprendre, .rb-seg button.on.defectueux { background: var(--st-action); }
.rb-seg button.on.a_signaler { background: var(--st-open); }
.rb-seg button.on.na, .rb-seg button.on.non_prevu { background: var(--st-cancel); }
.rb-asset { padding: 6px 0; border-bottom: 1px solid var(--cream); }
.rb-asset .rb-arow { border: 0; padding: 4px 0; }
.rb-acomment { margin-top: 6px; }

.rb-literie { background: var(--cream); border-radius: 10px; padding: 4px 12px; margin-bottom: 10px; }
.rb-literie + .rb-yesno { margin-bottom: 8px; }

.rb-obs-list { display: flex; flex-direction: column; gap: 10px; }
.rb-obs { border: 1px solid var(--cream-2); border-radius: 12px; padding: 11px; background: var(--cream); }
.rb-obs-top { display: flex; gap: 8px; align-items: center; }
.rb-obs-top .rb-input { background: #fff; }
.rb-obs .rb-input { margin-bottom: 7px; background: #fff; }
.rb-obs-del { border: 0; background: none; color: var(--st-action); font-size: 16px; cursor: pointer; padding: 6px 8px; flex: 0 0 auto; }
.rb-obs-bot { display: flex; gap: 8px; align-items: center; margin-bottom: 0; }
.rb-obs-bot .rb-sel { flex: 1; margin-bottom: 0; }
.rb-sel { padding: 10px 12px; }
.rb-photo-btn, .rb-tile {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--cream-2); border-radius: 9px; background: #fff; color: var(--gold);
  font-family: var(--sans); font-size: 12.5px; font-weight: 600; padding: 10px 12px; min-height: 42px;
}
.rb-add-obs { width: 100%; margin-top: 10px; }
.rb-thumb { display: block; margin-top: 8px; max-height: 120px; border-radius: 8px; }

.rb-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rb-tile { flex-direction: column; gap: 5px; min-height: 84px; aspect-ratio: 1; text-align: center; overflow: hidden; position: relative; padding: 6px; }
.rb-tile span { font-size: 11px; color: var(--muted); line-height: 1.15; }
.rb-tile .svc-icon { width: 22px; height: 22px; color: var(--brass); }
.rb-tile.filled { border-color: var(--st-ok); }
.rb-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rb-tile.filled span { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(17,16,9,.6); color: #fff; padding: 3px; }

.rb-sig-wrap { border: 1px dashed var(--cream-2); border-radius: 10px; background: var(--cream); margin: 8px 0; }
canvas.rb-sig { width: 100%; height: 160px; display: block; touch-action: none; }
.rb-sig-img { width: 100%; max-height: 160px; object-fit: contain; }
.rb-sig-actions { display: flex; gap: 8px; }
.rb-sig-actions .btn { flex: 1; margin-top: 0; min-height: 42px; }
/* Certification intervenant (bloc signature) */
.rb-certif { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; line-height: 1.45; padding: 4px 0; cursor: pointer; }
.rb-certif input[type="checkbox"] { width: 22px; height: 22px; flex: none; accent-color: var(--st-ok); margin-top: 1px; }
.rb-certif.ro { color: var(--st-ok); font-weight: 600; align-items: center; }
.rb-certif.ro .svc-icon { width: 16px; height: 16px; flex: none; }
/* Échec de soumission : message persistant près du bouton (plus qu'un toast) */
.rep-submit-err:not(:empty) { color: var(--st-action); font-size: 13.5px; font-weight: 600; padding: 0 2px 10px; text-align: center; }

.rep-sheet.ro .rb-input, .rep-sheet.ro .rb-seg button, .rep-sheet.ro .rb-yesno button,
.rep-sheet.ro .rb-photo-btn, .rep-sheet.ro .rb-tile, .rep-sheet.ro .rb-obs-del,
.rep-sheet.ro .rb-add-obs { pointer-events: none; opacity: .92; }
