:root {
  /* Idée de mise en page : une barre de rôle en haut ; l'app intervenant dans un cadre téléphone, l'app de gestion en barre latérale + contenu. */
  --bg: #e9f0f5;
  --surface: #ffffff;
  --surface-2: #f3f7fa;
  --ink: #15303f;
  --muted: #5f7a8c;
  --line: #d2dde6;
  --accent: #0a7ea4;
  --accent-ink: #ffffff;
  --accent-soft: #d9eef6;
  --terrain: #1c8a5a;
  --terrain-ink: #ffffff;
  --terrain-soft: #dcf2e6;
  --warn: #c2730f;
  --warn-soft: #fcefd9;
  --crit: #c43c3c;
  --crit-soft: #fbe2e2;
  --pole-indoor: #6250d6; --pole-indoor-soft: #e9e6fa;
  --pole-outdoor: #1baf7a; --pole-outdoor-soft: #dcf4ea;
  --pole-bricolage: #eb6834; --pole-bricolage-soft: #fde6dc;
  --pole-eau: #2a78d6; --pole-eau-soft: #dfeafb;
  --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(21, 48, 63, .08), 0 10px 28px rgba(21, 48, 63, .07);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1a22; --surface: #162531; --surface-2: #1b2d3b; --ink: #e4edf3; --muted: #93aabb; --line: #2a4150;
    --accent: #3cb2d8; --accent-ink: #06202b; --accent-soft: #143a4a;
    --terrain: #3fc48b; --terrain-ink: #06241a; --terrain-soft: #143829;
    --warn: #e5a24d; --warn-soft: #3d2c12; --crit: #ef6b6b; --crit-soft: #44201f;
    --pole-indoor: #9085e9; --pole-indoor-soft: #2b2850; --pole-outdoor: #199e70; --pole-outdoor-soft: #163a2c; --pole-bricolage: #d95926; --pole-bricolage-soft: #43261a; --pole-eau: #3987e5; --pole-eau-soft: #1a2f4a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1a22; --surface: #162531; --surface-2: #1b2d3b; --ink: #e4edf3; --muted: #93aabb; --line: #2a4150;
  --accent: #3cb2d8; --accent-ink: #06202b; --accent-soft: #143a4a;
  --terrain: #3fc48b; --terrain-ink: #06241a; --terrain-soft: #143829;
  --warn: #e5a24d; --warn-soft: #3d2c12; --crit: #ef6b6b; --crit-soft: #44201f;
  --pole-indoor: #9085e9; --pole-indoor-soft: #2b2850; --pole-outdoor: #199e70; --pole-outdoor-soft: #163a2c; --pole-bricolage: #d95926; --pole-bricolage-soft: #43261a; --pole-eau: #3987e5; --pole-eau-soft: #1a2f4a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* Pôles de services */
.chip.pole-indoor { background: var(--pole-indoor-soft); color: var(--pole-indoor); border-color: transparent; }
.chip.pole-outdoor { background: var(--pole-outdoor-soft); color: var(--pole-outdoor); border-color: transparent; }
.chip.pole-bricolage { background: var(--pole-bricolage-soft); color: var(--pole-bricolage); border-color: transparent; }
.chip.pole-eau { background: var(--pole-eau-soft); color: var(--pole-eau); border-color: transparent; }
.pole-card { border-top: 4px solid var(--pc); }
.pole-card .pn { font-family: var(--font-display); font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.pole-card .pn i { width: 10px; height: 10px; border-radius: 3px; background: var(--pc); display: inline-block; }
.pole-card .big { font-family: var(--font-display); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.pole-card .mini { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin-top: 10px; font-size: 12px; }
.pole-card .mini b { display: block; font-variant-numeric: tabular-nums; font-size: 13px; }
.pole-card .mini span { color: var(--muted); font-size: 11px; }
.bars { width: 100%; height: auto; display: block; }
.bars .grid { stroke: var(--line); stroke-width: 1; }
.bars .bar { fill: var(--pc); }
.bars .bar:hover { filter: brightness(1.12); }
.bars .lbl { font-size: 10px; fill: var(--muted); font-family: var(--font-body); }
.bars .val { font-size: 10.5px; fill: var(--ink); font-weight: 600; font-family: var(--font-display); }
.periode { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.periode .seg2 { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; }
.periode .seg2 button { border: 0; background: transparent; padding: 5px 10px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.periode .seg2 button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.periode input[type="date"] { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: var(--surface); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.periode .cal { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.pole-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.pole-filter button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.pole-filter button i { width: 8px; height: 8px; border-radius: 50%; background: var(--pc, var(--muted)); display: inline-block; }
.pole-filter button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: 20px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 13.5px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.hide { display: none !important; }
svg.ic { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Barre de rôle (chrome du prototype) */
.topbar { position: sticky; top: 0; z-index: 30; height: 54px; display: flex; align-items: center; gap: 16px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--terrain)); display: grid; place-items: center; color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 13px; }
.brand .t { font-family: var(--font-display); font-weight: 700; font-size: 14px; line-height: 1.1; white-space: nowrap; }
.brand .s { font-size: 11px; color: var(--muted); white-space: nowrap; }
.seg { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; margin-left: auto; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.proto-note { font-size: 11px; color: var(--muted); white-space: nowrap; }
@media (max-width: 760px) { .proto-note, .brand .s { display: none; } .seg button span.lbl { display: none; } .topbar { gap: 8px; padding: 0 10px; } .topbar .user-role { display: none; } }
@media (max-width: 560px) { .brand .t { display: none; } .topbar #sync-badge { font-size: 10.5px; } }

.stage { min-height: calc(100% - 54px); }

/* ---------- Cadre téléphone ---------- */
.phone-stage { display: flex; justify-content: center; align-items: flex-start; padding: 22px 16px 32px; gap: 28px; }
.phone { width: 390px; height: 800px; max-height: calc(100vh - 110px); min-height: 560px; background: var(--surface); border-radius: 38px; border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; position: relative; }
.phone .status { height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 26px 0 28px; font-size: 12px; font-weight: 600; flex: none; }
.phone .status .notch { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); width: 110px; height: 26px; border-radius: 14px; background: var(--ink); opacity: .9; }
.screen { flex: 1; overflow: auto; background: var(--bg); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.screen-inner { padding: 14px 16px 24px; }
.tabbar { flex: none; display: flex; border-top: 1px solid var(--line); background: var(--surface); padding: 6px 4px 10px; }
.tabbar button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 2px; font-size: 10.5px; font-weight: 600; color: var(--muted); border-radius: 10px; }
.tabbar button[aria-current="page"] { color: var(--accent); }
.tabbar button svg.ic { width: 22px; height: 22px; }
.phone-stage.real { padding: 0; justify-content: center; }
.phone-stage.real .phone { width: min(100%, 560px); height: calc(100vh - 54px); max-height: none; border-radius: 0; border: 0; box-shadow: none; }
.phone-stage.real .phone .status { display: none; }
.side-help { max-width: 300px; font-size: 13px; color: var(--muted); padding-top: 8px; }
.side-help h3 { color: var(--ink); margin-bottom: 8px; }
.side-help ol { padding-left: 18px; margin: 0 0 14px; }
.side-help li { margin-bottom: 6px; }
.side-help .kbd { display: inline-block; border: 1px solid var(--line); background: var(--surface); border-radius: 5px; padding: 0 6px; font-family: var(--font-display); font-weight: 600; font-size: 12px; color: var(--ink); }
@media (max-width: 900px) { .side-help { display: none; } }
@media (max-width: 640px) {
  .phone-stage { padding: 0; }
  .phone { width: 100%; height: calc(100vh - 54px); max-height: none; border-radius: 0; border: 0; box-shadow: none; }
  .phone .status { display: none; }
}

/* Écran de verrouillage */
.lock { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; gap: 10px; }
.lock .mark { width: 64px; height: 64px; border-radius: 18px; background: linear-gradient(135deg, var(--accent), var(--terrain)); color: #fff; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 24px; margin-bottom: 6px; }
.dots { display: flex; gap: 14px; margin: 10px 0 16px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); display: block; }
.dots i.on { background: var(--accent); }
.pad { display: grid; grid-template-columns: repeat(3, 68px); gap: 12px; }
.pad button { height: 60px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.pad button:active { background: var(--accent-soft); }
.lock .err { color: var(--crit); font-size: 12px; min-height: 16px; }

/* ---------- Composants ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card + .card { margin-top: 12px; }
.card.pad-0 { padding: 0; }
.card h2, .card h3 { margin-bottom: 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2, .card-head h3 { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.tpe-screen { background: #10202b; color: #dff3ff; border-radius: 14px; padding: 18px; text-align: center; font-family: var(--font-display); }
.tpe-screen .amt { font-size: 32px; font-weight: 700; letter-spacing: -.02em; }
.tpe-screen .st { font-size: 13px; margin-top: 6px; color: #9fd3ea; font-family: var(--font-body); }
.paymodes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 900px) { .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 9px 14px; font-weight: 600; font-size: 13.5px; line-height: 1.2; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.terrain { background: var(--terrain); border-color: var(--terrain); color: var(--terrain-ink); }
.btn.danger { background: var(--crit-soft); border-color: transparent; color: var(--crit); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { padding: 13px 18px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.icon { padding: 7px; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; line-height: 1.5; }
.chip.ok { background: var(--terrain-soft); color: var(--terrain); border-color: transparent; }
.chip.info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.crit { background: var(--crit-soft); color: var(--crit); border-color: transparent; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .v { font-family: var(--font-display); font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi .sub { font-size: 11.5px; margin-top: 6px; }
.kpi.crit { border-left: 4px solid var(--crit); }
.kpi.warn { border-left: 4px solid var(--warn); }
.kpi.ok { border-left: 4px solid var(--terrain); }

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 8px 10px; font-size: 13.5px; }
.field textarea { min-height: 70px; resize: vertical; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline label { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink); font-weight: 500; }
.field.inline input[type="checkbox"] { width: auto; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i { width: 36px; height: 20px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch input:checked + i { background: var(--terrain); }
.switch input:checked + i::after { left: 18px; }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--surface-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; color: inherit; }
.list-row:last-child { border-bottom: 0; }
.list-row .time { font-family: var(--font-display); font-weight: 700; font-size: 14px; min-width: 46px; font-variant-numeric: tabular-nums; }
.list-row .main { flex: 1; min-width: 0; }
.list-row .main .t { font-weight: 600; display: block; }
.list-row .main .s { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.list-row:hover { background: var(--surface-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 12px; color: #fff; flex: none; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 13px; border: 1px solid transparent; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.crit { background: var(--crit-soft); color: var(--crit); }
.alert.ok { background: var(--terrain-soft); color: var(--terrain); }
.alert.info { background: var(--accent-soft); color: var(--accent); }
.alert .body { flex: 1; min-width: 0; color: var(--ink); }
.alert .body .t { font-weight: 600; color: inherit; }
.alert svg.ic { margin-top: 1px; }

/* Étapes de l'intervention */
.steps { display: flex; flex-direction: column; gap: 10px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 12px; }
.step .n { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 12px; flex: none; color: var(--muted); }
.step.done .n { background: var(--terrain); border-color: var(--terrain); color: var(--terrain-ink); }
.step.active .n { border-color: var(--accent); color: var(--accent); }
.step.locked { opacity: .6; }
.step .body { flex: 1; min-width: 0; }
.step .body h3 { margin-bottom: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.step .body .req { font-size: 10.5px; color: var(--crit); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.step .body .hint { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.photo-grid img, .photo-grid .ph { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; background: var(--surface-2); }
.photo-grid figure { margin: 0; position: relative; }
.photo-grid figcaption { font-size: 10px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.checks { display: flex; flex-direction: column; gap: 6px; }
.checks label { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 13.5px; cursor: pointer; }
.checks label:has(input:checked) { background: var(--terrain-soft); border-color: transparent; }
.checks input { width: 18px; height: 18px; accent-color: var(--terrain); }
.sigpad { width: 100%; height: 120px; border: 1px dashed var(--line); border-radius: 9px; background: var(--surface); touch-action: none; display: block; }
.geo { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.geo.ok { color: var(--terrain); }
.geo.bad { color: var(--crit); }

/* Pointage */
.pointage { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.pointage .big { font-family: var(--font-display); font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.pointage .times { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0; }
.pointage .times div { background: var(--surface); border-radius: 9px; padding: 6px 8px; }
.pointage .times .l { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pointage .times .v { font-family: var(--font-display); font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }

/* Feuille modale (mobile) et modale (desktop) */
.overlay { position: absolute; inset: 0; background: rgba(10, 25, 35, .45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-height: 92%; border-radius: 22px 22px 0 0; overflow: auto; padding: 14px 16px 24px; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 12px; }
.modal-wrap { position: fixed; inset: 0; background: rgba(10, 25, 35, .45); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--bg); border-radius: 16px; width: min(760px, 100%); max-height: 90vh; overflow: auto; padding: 18px 20px 22px; box-shadow: var(--shadow); }
.modal .mhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.modal.wide { width: min(980px, 100%); }
@media (max-width: 560px) { .modal-wrap { padding: 0; align-items: flex-end; } .modal { border-radius: 16px 16px 0 0; max-height: 94vh; } }

.toast { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 600; z-index: 60; box-shadow: var(--shadow); max-width: calc(100% - 32px); }

/* ---------- Bureau (gérant / responsable) ---------- */
.desk { display: grid; grid-template-columns: 224px 1fr; min-height: calc(100vh - 54px); }
.sidenav { background: var(--surface); border-right: 1px solid var(--line); padding: 14px 10px; position: sticky; top: 54px; height: calc(100vh - 54px); overflow: auto; }
.sidenav .who { padding: 8px 10px 14px; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.sidenav .who .n { font-weight: 600; font-size: 13px; }
.sidenav .who .r { font-size: 11px; color: var(--muted); }
.sidenav .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 10px 4px; font-weight: 600; }
.sidenav button { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 8px 10px; border-radius: 9px; font-size: 13.5px; font-weight: 500; color: var(--ink); text-align: left; }
.sidenav button:hover { background: var(--surface-2); }
.sidenav button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidenav button .badge { margin-left: auto; background: var(--crit); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.main { padding: 20px 24px 40px; min-width: 0; }
.main > header { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.main > header .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.two { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 1100px) { .two { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .desk { grid-template-columns: 1fr; }
  .sidenav { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); display: flex; gap: 4px; overflow-x: auto; padding: 8px; }
  .sidenav .who, .sidenav .grp { display: none; }
  .sidenav button { width: auto; white-space: nowrap; }
  .main { padding: 14px 16px 30px; }
}

/* Carte schématique */
.map { width: 100%; height: auto; display: block; }
.map .land { fill: var(--surface-2); stroke: var(--line); stroke-width: 1.5; }
.map .ville { fill: var(--muted); font-size: 9px; font-family: var(--font-body); }
.map .vdot { fill: var(--line); }
.map .pin { fill: var(--terrain); stroke: var(--surface); stroke-width: 1.5; }
.map .pin.warn { fill: var(--crit); }
.map .pin.idle { fill: var(--muted); }
.map .lbl { font-size: 9.5px; font-weight: 600; fill: var(--ink); font-family: var(--font-display); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; }

/* Planning */
.plan { display: grid; grid-template-columns: 150px repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); min-width: 860px; }
.plan > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; min-height: 54px; font-size: 12px; }
.plan .hd { background: var(--surface-2); font-weight: 600; font-size: 11.5px; text-align: center; min-height: 0; }
.plan .hd.today { color: var(--accent); }
.plan .who { font-weight: 600; background: var(--surface-2); }
.plan .who .m { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.plan .ev { display: block; width: 100%; text-align: left; border: 0; border-radius: 6px; padding: 3px 6px; margin-bottom: 4px; font-size: 11.5px; line-height: 1.3; background: var(--accent-soft); color: var(--accent); font-weight: 600; cursor: pointer; }
.plan .ev.terminee { background: var(--terrain-soft); color: var(--terrain); }
.plan .ev.en_cours { background: var(--warn-soft); color: var(--warn); }
.plan .ev.we { opacity: .55; }
.plan .ev small { display: block; font-weight: 400; color: var(--ink); opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Rapport (aperçu PDF) */
.a4 { background: #ffffff; color: #15303f; border: 1px solid var(--line); border-radius: 6px; padding: 34px 38px; max-width: 820px; margin: 0 auto; font-size: 13px; box-shadow: var(--shadow); }
.a4 h1, .a4 h2, .a4 h3 { color: #15303f; }
.a4 .rhead { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #0a7ea4; padding-bottom: 12px; margin-bottom: 16px; }
.a4 .rhead .soc { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.a4 .rhead .meta { text-align: right; font-size: 12px; color: #5f7a8c; }
.a4 table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: 12.5px; }
.a4 th, .a4 td { border-bottom: 1px solid #d2dde6; padding: 6px 8px; text-align: left; vertical-align: top; }
.a4 th { background: #f3f7fa; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #5f7a8c; }
.a4 .photos { display: flex; gap: 6px; flex-wrap: wrap; }
.a4 .photos img { width: 118px; aspect-ratio: 4/3; object-fit: cover; border-radius: 4px; border: 1px solid #d2dde6; }
.a4 .photos figure { margin: 0; }
.a4 .photos figcaption { font-size: 9.5px; color: #5f7a8c; }
.a4 .foot { margin-top: 18px; padding-top: 10px; border-top: 1px solid #d2dde6; font-size: 11px; color: #5f7a8c; display: flex; justify-content: space-between; }
.a4 .sig { width: 160px; height: 60px; object-fit: contain; border: 1px solid #d2dde6; border-radius: 4px; background: #fff; }
@media (max-width: 560px) { .a4 { padding: 18px 16px; } }

/* Grille de visite */
.score { display: flex; gap: 4px; }
.score button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 12.5px; }
.score button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--terrain); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters input[type="search"], .filters select { border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 7px 10px; font-size: 13px; }
.filters input[type="search"] { min-width: 220px; }
.empty { padding: 22px; text-align: center; color: var(--muted); font-size: 13px; }
.progress { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 8px 0; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 4px 12px; font-size: 13px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.ph-lbl { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.notice { font-size: 12px; color: var(--muted); border-left: 3px solid var(--line); padding: 4px 10px; margin-top: 10px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
