:root {
  /* Thème clair chaleureux (par défaut) */
  --bg: #f4f1e8;
  --dot: rgba(47,58,45,.05);
  --sidebar: #fbfaf5;
  --card: #ffffff;
  --card-2: #f5f2ea;
  --line: #e7e2d5;
  --text: #1e2a23;
  --muted: #77857c;
  --primary: #2f6b4f;
  --primary-ink: #ffffff;
  --primary-soft: #e4eee6;
  --green: #2f8f5b;
  --amber: #b5842a;
  --red: #c7513f;
  /* Pastilles d'icônes */
  --sage-bg:#dde9de; --sage-ink:#2f6b4f;
  --coral-bg:#f7ddd5; --coral-ink:#c7513f;
  --mint-bg:#d5ebda; --mint-ink:#2f8f5b;
  --amber-bg:#f7e7c6; --amber-ink:#b5842a;
  --blue-bg:#dce7f2; --blue-ink:#3a6b9e;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 4px 16px rgba(30,42,35,.06);
  --shadow-lg: 0 10px 30px rgba(30,42,35,.10);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --sidebar-w: 260px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:#141a16; --dot:rgba(255,255,255,.03); --sidebar:#1a211c; --card:#1e2823;
    --card-2:#232e27; --line:#2f3b33; --text:#e8ede8; --muted:#93a29a;
    --primary:#4f9e74; --primary-ink:#0c130f; --primary-soft:#243329;
    --green:#57b483; --amber:#d6a24d; --red:#e07a68;
    --sage-bg:rgba(79,158,116,.18); --sage-ink:#7cc79d;
    --coral-bg:rgba(224,122,104,.18); --coral-ink:#e79a8a;
    --mint-bg:rgba(87,180,131,.18); --mint-ink:#79cfa2;
    --amber-bg:rgba(214,162,77,.18); --amber-ink:#e0be7f;
    --blue-bg:rgba(90,140,190,.18); --blue-ink:#9dbfe0;
    --shadow:0 4px 16px rgba(0,0,0,.28); --shadow-lg:0 10px 30px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1.1px, transparent 1.1px);
  background-size: 22px 22px;
  padding-bottom: calc(76px + var(--safe-b));
}
a { color: var(--primary); text-decoration: none; font-weight: 600; }
h1,h2,h3 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
small { color: var(--muted); }
svg { display: block; }
.icon { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Layout ---------- */
.layout { display: block; }
.sidebar { display: none; }
.content { min-height: 100vh; }
main { max-width: 820px; margin: 0 auto; padding: 16px; }

/* Header mobile */
.app-header {
  position: sticky; top: 0; z-index: 20; background: var(--sidebar);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top, 0px));
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; background: var(--primary);
  display: flex; align-items: center; justify-content: center; flex: none; box-shadow: var(--shadow); }
.brand-logo .icon { stroke: #fff; width: 22px; height: 22px; }
.brand-name { font-weight: 800; font-size: 1.05rem; letter-spacing: -.2px; }
.brand-sub { font-size: .76rem; color: var(--muted); }

/* Views */
.view { display: none; animation: fade .22s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px);} to {opacity:1; transform:none;} }

/* Page title */
.overline { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 700; color: var(--muted); }
.page-title { font-size: 2rem; font-weight: 800; letter-spacing: -.5px; margin: 2px 0 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .page-title { margin: 2px 0 0; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card.tight { padding: 14px 16px; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }

/* ---------- Stat cards (dashboard) ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); cursor: pointer; transition: transform .12s, box-shadow .12s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.badge-ic { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; margin-bottom: 26px; }
.badge-ic .icon { width: 22px; height: 22px; }
.badge-ic.sage { background: var(--sage-bg); color: var(--sage-ink); }
.badge-ic.coral { background: var(--coral-bg); color: var(--coral-ink); }
.badge-ic.mint { background: var(--mint-bg); color: var(--mint-ink); }
.badge-ic.amber { background: var(--amber-bg); color: var(--amber-ink); }
.badge-ic.blue { background: var(--blue-bg); color: var(--blue-ink); }
.stat-val { font-size: 1.65rem; font-weight: 800; letter-spacing: -.5px; line-height: 1; white-space: nowrap; }
.stat-val.sm { font-size: 1.25rem; }
.stat-label { color: var(--muted); font-size: .92rem; margin-top: 6px; font-weight: 600; }

/* Section header */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 2px 12px; }
.section-head h2 { margin: 0; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; }
.link-arrow .icon { width: 18px; height: 18px; }

/* ---------- Forms ---------- */
label { display: block; font-size: .82rem; color: var(--muted); margin: 12px 0 5px; font-weight: 700; }
input, textarea, select { width: 100%; padding: 12px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card-2); color: var(--text); font-size: 1rem; font-family: inherit; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary); border-color: transparent; }
textarea { min-height: 74px; resize: vertical; }
.field-inline { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none;
  border-radius: var(--radius-sm); padding: 12px 18px; font-size: 1rem; font-weight: 700;
  background: var(--primary); color: var(--primary-ink); cursor: pointer; font-family: inherit; }
.btn .icon { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px); }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.subtle { background: var(--card-2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--red); color: #fff; }
.btn.sm { padding: 9px 13px; font-size: .86rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--card-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 11px; font-size: .82rem; }
.chip.plus { border-color: rgba(47,143,91,.45); color: var(--green); background: var(--mint-bg); }
.chip.minus { border-color: rgba(199,81,63,.4); color: var(--red); background: var(--coral-bg); }
.chip.works-chip { border-color: var(--amber); color: var(--amber-ink); background: var(--amber-bg); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip button { background: none; border: none; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0; }
.chip-input { display: flex; gap: 8px; }
.chip-input input { flex: 1; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* Property cards */
.prop { cursor: pointer; }
.prop .thumb { width: 100%; height: 160px; object-fit: cover; border-radius: var(--radius-sm); background: var(--card-2); margin-bottom: 12px; }
.prop .thumb.placeholder { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.prop .thumb.placeholder .icon { width: 44px; height: 44px; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: .74rem; font-weight: 800; white-space: nowrap; }
.badge.great { background: var(--mint-bg); color: var(--green); }
.badge.good { background: var(--blue-bg); color: var(--blue-ink); }
.badge.mid { background: var(--amber-bg); color: var(--amber-ink); }
.badge.bad { background: var(--coral-bg); color: var(--red); }

/* Score ring */
.ring { --v: 0; width: 56px; height: 56px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--primary) calc(var(--v)*1%), var(--line) 0);
  display: flex; align-items: center; justify-content: center; position: relative; }
.ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--card); }
.ring span { position: relative; font-weight: 800; font-size: 1rem; }
.score { display: flex; align-items: center; gap: 12px; }

/* Advice */
.advice { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.advice li { display: flex; gap: 10px; padding: 11px 13px; border-radius: var(--radius-sm); background: var(--card-2); font-size: .9rem; }
.advice li .ic { flex: none; font-size: 1.05rem; line-height: 1.3; }
.advice li.ok { border-left: 3px solid var(--green); }
.advice li.warn { border-left: 3px solid var(--amber); }
.advice li.tip { border-left: 3px solid var(--primary); }
.advice li.info { border-left: 3px solid var(--muted); }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-grid .ph { position: relative; }
.photo-grid img { width: 100%; height: 96px; object-fit: cover; border-radius: var(--radius-sm); }
.photo-grid .ph { position: relative; }
.photo-grid .ph button { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff; border: none;
  border-radius: 50%; width: 24px; height: 24px; cursor: pointer; }
.photo-grid .ph-cap { font-size: .74rem; color: var(--muted); margin-top: 4px; line-height: 1.25; }
.photo-grid .ph-badge { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,.55); border-radius: 6px; font-size: .72rem; padding: 1px 4px; }

/* Éditeur de photos avec légende */
.photo-actions { display: flex; gap: 8px; }
.photo-actions .btn { flex: 1; }
.photo-edit-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.photo-edit { background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; }
.pe-thumb { position: relative; }
.pe-thumb img { width: 100%; height: 110px; object-fit: cover; border-radius: 8px; }
.pe-del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff; border: none;
  border-radius: 50%; width: 24px; height: 24px; cursor: pointer; }
.pe-cap { margin-top: 6px; font-size: .84rem; padding: 7px 9px; }
.photo-viewer-cap { position: absolute; left: 0; right: 0; bottom: 4%; text-align: center; color: #fff;
  font-size: .92rem; padding: 0 16px; text-shadow: 0 1px 4px rgba(0,0,0,.8); }
@media (min-width: 768px) { .photo-edit-grid { grid-template-columns: repeat(3, 1fr); } }

/* Agenda */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-grid .dow { text-align: center; font-size: .7rem; color: var(--muted); padding: 4px 0; font-weight: 700; }
.cal-cell { aspect-ratio: 1; border-radius: 10px; background: var(--card-2); border: 1px solid transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .85rem; position: relative; cursor: pointer; }
.cal-cell.muted { opacity: .35; }
.cal-cell.today { border-color: var(--primary); }
.cal-cell.has-visit { background: var(--primary-soft); font-weight: 700; }
.cal-cell .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); margin-top: 3px; }
.visit-item { display: flex; gap: 10px; align-items: flex-start; padding: 11px; border-radius: var(--radius-sm); background: var(--card-2); margin-bottom: 8px; }
.visit-item .date { font-weight: 700; flex: none; text-align: center; min-width: 48px; }
.visit-item .date .d { font-size: 1.2rem; } .visit-item .date .m { font-size: .7rem; color: var(--muted); text-transform: uppercase; }

/* Toggle */
.pill-toggle { display: flex; gap: 6px; background: var(--card-2); border-radius: var(--radius-sm); padding: 4px; }
.pill-toggle button { flex: 1; border: none; background: none; color: var(--muted); padding: 9px; border-radius: 9px; font-weight: 700; cursor: pointer; font-family: inherit; }
.pill-toggle button.active { background: var(--primary); color: var(--primary-ink); }

.kv { display: flex; justify-content: space-between; padding: 4px 0; font-size: .92rem; }
.kv .k { color: var(--muted); }
.kv.total { font-weight: 800; border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 8px; }
.hint { font-size: .78rem; color: var(--muted); margin-top: 4px; }

/* Import d'annonce depuis un lien */
.import-url { display: flex; gap: 8px; align-items: stretch; }
.import-url input { flex: 1; min-width: 0; }
.import-url .btn { flex: none; white-space: nowrap; }
.or-sep { display: flex; align-items: center; gap: 10px; margin: 16px 0 6px; color: var(--muted); font-size: .76rem; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Aperçu d'e-mail (offre) */
.mail-preview { width: 100%; height: 360px; margin-top: 10px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; display: block; }
.linklike { background: none; border: none; padding: 0; margin: 0; font: inherit; color: var(--primary);
  font-weight: 600; cursor: pointer; text-decoration: underline; }

/* Autocomplétion d'adresse */
.ac-wrap { position: relative; }
.ac-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 90; margin-top: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  max-height: 260px; overflow-y: auto; overflow-x: hidden; }
.ac-item { display: flex; gap: 8px; align-items: flex-start; width: 100%; text-align: left;
  padding: 10px 12px; background: none; border: none; border-bottom: 1px solid var(--line);
  font: inherit; font-size: .9rem; color: var(--text); cursor: pointer; line-height: 1.3; }
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item:focus { background: var(--card-2); }

/* Proximité : critère strict / souple */
.poi-strict-row { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0 2px; font-size: .8rem; color: var(--muted); cursor: pointer; }
.poi-strict-row input { margin-top: 2px; flex: none; width: auto; }
.ct-type-tag.strict { background: var(--coral-bg); color: var(--coral-ink); padding: 1px 6px; border-radius: 6px; }
.ct-type-tag.soft { background: var(--card-2); color: var(--muted); padding: 1px 6px; border-radius: 6px; }

/* Empty state */
.empty { text-align: center; color: var(--muted); padding: 34px 16px; border: 1.5px dashed var(--line);
  border-radius: var(--radius); background: var(--card); }
.empty .em { display: inline-flex; }
.empty .em .icon { width: 40px; height: 40px; color: var(--muted); margin-bottom: 8px; }

/* FAB */
.fab { position: fixed; right: 16px; bottom: calc(84px + var(--safe-b)); z-index: 25;
  width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); border: none;
  box-shadow: var(--shadow-lg); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.fab .icon { width: 26px; height: 26px; }
.fab[hidden] { display: none; }

/* Bottom nav (mobile) */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex;
  background: var(--sidebar); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabbar button { flex: 1; min-width: 0; background: none; border: none; color: var(--muted); padding: 9px 1px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; font-size: .62rem; font-family: inherit; font-weight: 600;
  white-space: nowrap; letter-spacing: -.01em; }
.tabbar button .icon { width: 21px; height: 21px; }
@media (max-width: 360px) { .tabbar button { font-size: .56rem; } }
.tabbar button.active { color: var(--primary); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; display: none; }
.modal.open { display: block; }
.modal .backdrop { position: absolute; inset: 0; background: rgba(20,26,22,.5); }
.modal .sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto;
  background: var(--bg); border-radius: 22px 22px 0 0; padding: 18px 16px calc(24px + var(--safe-b));
  max-width: 640px; margin: 0 auto; animation: slideup .24s ease; }
@keyframes slideup { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal .sheet .grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 12px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sheet-head .close { background: none; border: none; color: var(--muted); font-size: 1.6rem; cursor: pointer; line-height: 1; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(94px + var(--safe-b));
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 999px; z-index: 60; font-size: .86rem;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* Critères — checklist en visite */
.crit-list { display: grid; gap: 12px; margin-top: 8px; }
.crit-row { background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.crit-label { font-weight: 600; font-size: .92rem; margin-bottom: 8px; }
.crit-states { display: flex; gap: 6px; }
.crit-states button { flex: 1; border: 1px solid var(--line); background: var(--card); color: var(--muted);
  padding: 8px; border-radius: 9px; font-weight: 700; font-size: .82rem; cursor: pointer; font-family: inherit; }
.crit-states button.cs-ok.active { background: var(--mint-bg); color: var(--green); border-color: var(--green); }
.crit-states button.cs-warn.active { background: var(--amber-bg); color: var(--amber-ink); border-color: var(--amber); }
.crit-states button.cs-bad.active { background: var(--coral-bg); color: var(--red); border-color: var(--red); }
.crit-comment { margin-top: 8px; font-size: .88rem; padding: 8px 10px; }

/* Critères — synthèse sur la fiche */
.crit-eval { display: grid; gap: 6px; margin-top: 4px; }
.crit-eval-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.crit-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--line); }
.crit-dot.cs-ok { background: var(--green); } .crit-dot.cs-warn { background: var(--amber); } .crit-dot.cs-bad { background: var(--red); }
.crit-dot.cs-none-empty { background: var(--line); }

/* Critères — configuration en réglages */
.crit-config { display: grid; gap: 8px; margin-top: 8px; }
.crit-cfg-row { display: flex; gap: 8px; align-items: center; }
.crit-cfg-input { flex: 1; }
.crit-del { width: 38px; height: 40px; flex: none; border: 1px solid var(--line); background: var(--card-2);
  border-radius: 10px; color: var(--red); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.crit-del .icon { width: 18px; height: 18px; transform: rotate(45deg); }

/* Mode visite — sections */
.visit-sec { font-size: 1rem; margin: 4px 0 8px; }

/* Travaux — éditeur */
.works-list { display: grid; gap: 8px; }
.works-add { margin-top: 10px; display: grid; gap: 8px; background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; }
.works-add .wk-costrow { display: flex; gap: 8px; }
.works-add .wk-costrow .wk-cost { flex: 1; }
.wk-status button { padding: 8px; font-size: .82rem; }
.work-item { display: flex; align-items: center; gap: 10px; background: var(--card-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 10px; }
.work-item.done { opacity: .8; }
.wk-chk { width: 26px; height: 26px; flex: none; border-radius: 8px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--green); font-weight: 800; cursor: pointer; }
.wk-chk.on { background: var(--mint-bg); border-color: var(--green); }
.wk-body { flex: 1; min-width: 0; }
.wk-cat-lbl { font-weight: 700; font-size: .9rem; }
.wk-cmt { font-size: .82rem; color: var(--muted); }
.wk-done-tag { color: var(--green); font-weight: 700; font-size: .78rem; }
.wk-price { font-weight: 700; white-space: nowrap; }
.wk-del { background: none; border: none; color: var(--muted); font-size: 1.3rem; cursor: pointer; line-height: 1; padding: 0 2px; }
.works-sum { font-size: .86rem; padding: 6px 2px 2px; color: var(--muted); }
.wk-view { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--line); }
.wk-view:last-child { border-bottom: none; }
.wk-group-title { font-size: .84rem; font-weight: 700; color: var(--muted); margin: 4px 0; }

/* Page dédiée d'un bien */
.detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 10px 0;
  position: sticky; top: 0; background: var(--bg); z-index: 10; border-bottom: 1px solid var(--line); }
.detail-title { flex: 1; min-width: 0; font-weight: 800; font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.viewing-property .app-header { display: none; }

/* Mode visite — plein écran, grosses tuiles (type Metro) */
.vm-overlay { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: flex; flex-direction: column;
  background-image: radial-gradient(var(--dot) 1.1px, transparent 1.1px); background-size: 22px 22px; }
.vm-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; padding-top: calc(14px + env(safe-area-inset-top, 0px));
  background: var(--sidebar); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.vm-titlewrap { flex: 1; min-width: 0; text-align: center; }
.vm-title { font-weight: 800; font-size: 1.15rem; }
.vm-sub { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vm-back, .vm-close { background: var(--card-2); border: 1px solid var(--line); border-radius: 11px; width: 42px; height: 42px;
  font-size: 1.15rem; cursor: pointer; color: var(--text); flex: none; }
.vm-body { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); width: 100%; max-width: 900px; margin: 0 auto; }
.tile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile { border: none; border-radius: 20px; color: #fff; padding: 18px; min-height: 132px; display: flex; flex-direction: column;
  justify-content: space-between; align-items: flex-start; cursor: pointer; text-align: left; text-decoration: none; box-shadow: var(--shadow); font-family: inherit; }
.tile:active { transform: scale(.98); }
.tile .tile-ic { font-size: 2.6rem; line-height: 1; }
.tile-txt { display: flex; flex-direction: column; }
.tile .tile-label { font-size: 1.12rem; font-weight: 800; }
.tile .tile-sub { font-size: .82rem; opacity: .92; }
.tile.t-green { background: #2f8f5b; } .tile.t-blue { background: #3a6b9e; } .tile.t-amber { background: #c88a2e; }
.tile.t-violet { background: #7a5bb0; } .tile.t-teal { background: #2f8f8f; } .tile.t-slate { background: #556170; } .tile.t-red { background: #c7513f; }
.vm-save { margin-top: 18px; padding: 16px; font-size: 1.1rem; }
.vm-crit .crit-row { padding: 14px; } .vm-crit .crit-states button { padding: 13px; font-size: .92rem; }
@media (min-width: 640px) { .tile-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 980px) { .tile-grid { grid-template-columns: repeat(4, 1fr); } }

/* Offre — sélection de destinataires */
.pick-list { display: grid; gap: 8px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--card-2); cursor: pointer; }
.pick .pick-check { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--line); background: var(--card);
  color: transparent; display: flex; align-items: center; justify-content: center; font-weight: 800; flex: none; }
.pick.on { border-color: var(--primary); }
.pick.on .pick-check { background: var(--primary); border-color: var(--primary); color: #fff; }
.offer-row { padding: 9px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.offer-row:last-child { border-bottom: none; }
.sub-list { display: grid; gap: 10px; margin-top: 8px; }
.sub-row { background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: grid; gap: 8px; }
.sub-head { display: flex; justify-content: space-between; align-items: center; }
.sub-name { font-weight: 700; font-size: .92rem; }
.sub-del { background: none; border: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; line-height: 1; }
.sub-note { font-size: .88rem; padding: 8px 10px; }
.sub-mail { font-size: .8rem; font-weight: 600; }

/* Export PDF (impression) */
#print-area { display: none; }
@media print {
  @page { margin: 12mm; }
  body { background: #fff !important; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  .pdoc, .pdoc * { -webkit-print-color-adjust: exact; print-color-adjust: exact; box-sizing: border-box; }
  .pdoc { color: #222; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 12px; line-height: 1.45; }
  .pdf-head { background: #2f6b4f; color: #fff; padding: 15px 18px; border-radius: 12px; display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
  .pdf-logo { width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; flex: none; }
  .pdf-logo svg { width: 24px; height: 24px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .pdf-head .t { font-size: 18px; font-weight: 800; letter-spacing: .3px; }
  .pdf-head .s { font-size: 11px; opacity: .88; }
  .pdf-head .meta { margin-left: auto; text-align: right; font-size: 10px; opacity: .9; }
  .pdf-title { font-size: 21px; font-weight: 800; margin: 0 0 2px; }
  .pdf-subrow { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; flex-wrap: wrap; }
  .pdf-sub { color: #6b7280; font-size: 12px; }
  .pdf-sec { margin: 0 0 13px; page-break-inside: avoid; }
  .pdf-sec > h2 { font-size: 13px; font-weight: 800; color: #2f6b4f; border-bottom: 2px solid #e5e7eb; padding-bottom: 4px; margin: 0 0 8px; }
  .pdf-kv { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid #eee; }
  .pdf-kv .k { color: #4b5563; } .pdf-kv .v { font-weight: 600; text-align: right; }
  .pdf-kv.tot { border-top: 2px solid #333; border-bottom: none; font-weight: 800; padding-top: 6px; color: #2f6b4f; }
  .pdf-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; }
  .pdf-badge.great { background: #dff2e6; color: #1c7a48; } .pdf-badge.good { background: #e6f0ff; color: #2456b3; }
  .pdf-badge.mid { background: #fbeecb; color: #8a6413; } .pdf-badge.bad { background: #fadedd; color: #b23a2c; }
  .pdf-score { margin-left: auto; font-weight: 800; font-size: 14px; color: #2f6b4f; }
  .pdf-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .pdf-photos figure { margin: 0; page-break-inside: avoid; }
  .pdf-photos img { width: 100%; height: 108px; object-fit: cover; border-radius: 6px; border: 1px solid #ddd; display: block; }
  .pdf-photos figcaption { font-size: 10px; color: #555; margin-top: 2px; }
  .pdf-list { margin: 2px 0; padding-left: 16px; } .pdf-list li { margin: 2px 0; }
  .pdf-note { background: #f6f5ef; border-left: 3px solid #2f6b4f; padding: 6px 10px; border-radius: 0 6px 6px 0; margin: 4px 0; white-space: pre-wrap; }
  .pdf-item { border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px 11px; margin: 6px 0; page-break-inside: avoid; }
  .pdf-item .ih { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
  .pdf-muted { color: #6b7280; }
  .pdf-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .pdf-adv { display: flex; gap: 7px; padding: 3px 0; }
  .pdf-adv .ic { flex: none; }
  .pdf-foot { margin-top: 18px; padding-top: 8px; border-top: 1px solid #ddd; font-size: 10px; color: #777; text-align: center; }
}

/* Carte (localisation) */
.map-embed { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); }
.map-embed iframe { width: 100%; height: 220px; border: 0; display: block; }

/* Premium / freemium */
.premium-card { border: 1.5px solid var(--amber); background: linear-gradient(180deg, var(--amber-bg), var(--card)); }
.premium-card.on { border-color: var(--green); background: linear-gradient(180deg, var(--mint-bg), var(--card)); }
.lock-tag { font-size: .72rem; font-weight: 800; color: var(--amber-ink); background: var(--amber-bg);
  border-radius: 999px; padding: 2px 8px; cursor: pointer; white-space: nowrap; }
.premium-teaser { cursor: pointer; border-style: dashed; }
.upsell-hero { text-align: center; padding: 6px 0 10px; }
.upsell-crown { font-size: 2.6rem; }
.upsell-list { list-style: none; padding: 0; margin: 6px 0 14px; display: grid; gap: 8px; }
.upsell-list li { background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font-weight: 600; font-size: .92rem; }

/* Contacts */
.contacts-list { display: grid; gap: 8px; }
.contacts-add { margin-top: 10px; display: grid; gap: 8px; background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; }
.contacts-add .ct-noterow { display: flex; gap: 8px; }
.contacts-add .ct-noterow .ct-note { flex: 1; }
.contact-item, .contact-view { display: flex; gap: 10px; align-items: flex-start; }
.contact-item { background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; }
.contact-view { padding: 8px 0; border-bottom: 1px solid var(--line); }
.contact-view:last-child { border-bottom: none; }
.ct-ic { width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--card); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.contact-item .ct-ic { background: var(--card); }
.ct-body { flex: 1; min-width: 0; }
.ct-name-lbl { font-weight: 700; font-size: .92rem; }
.ct-type-tag { font-size: .74rem; color: var(--muted); font-weight: 600; }
.ct-line { font-size: .86rem; margin-top: 1px; }
.ct-line a { font-weight: 600; }

/* Questions — préparation & réponses */
.q-list { display: grid; gap: 10px; }
.q-row { background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.q-q { font-weight: 600; font-size: .9rem; }
.q-del { background: none; border: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; line-height: 1; }
.q-ans { margin-top: 8px; font-size: .9rem; padding: 8px 10px; }
.qa { padding: 8px 0; border-bottom: 1px solid var(--line); }
.qa:last-of-type { border-bottom: none; }
.qa-q { font-weight: 600; font-size: .9rem; }
.qa-a { font-size: .9rem; margin-top: 2px; }

/* Cursus de suivi — stepper */
.stepper { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 4px 2px 8px; }
.step { flex: none; display: flex; flex-direction: column; align-items: center; gap: 5px; width: 84px;
  background: none; border: none; cursor: pointer; color: var(--muted); font-family: inherit; }
.step-dot { width: 30px; height: 30px; border-radius: 50%; background: var(--card-2); border: 1.5px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .82rem; }
.step-lbl { font-size: .68rem; text-align: center; line-height: 1.1; }
.step.done .step-dot { background: var(--mint-bg); border-color: var(--green); color: var(--green); }
.step.current .step-dot { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.step.current { color: var(--text); font-weight: 700; }
.step.drop.current .step-dot { background: var(--coral-bg); border-color: var(--red); }

/* Comparateur */
.compare-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
table.compare { border-collapse: collapse; width: 100%; font-size: .86rem; }
table.compare th, table.compare td { padding: 9px 11px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.compare thead th { font-weight: 800; position: sticky; top: 0; background: var(--bg); }
table.compare td.rowlabel, table.compare .rowlabel { text-align: left; color: var(--muted); font-weight: 600; position: sticky; left: 0; background: var(--bg); }
table.compare td.best { background: var(--mint-bg); color: var(--green); font-weight: 800; border-radius: 6px; }

.mobile-only { display: block; }
.desktop-only { display: none; }

/* ============ TABLETTE & PC ============ */
@media (min-width: 768px) {
  body { padding-bottom: 0;
    background-image: radial-gradient(var(--dot) 1.1px, transparent 1.1px); background-size: 24px 24px; }
  .layout { display: flex; align-items: flex-start; }
  .sidebar { display: flex; flex-direction: column; width: var(--sidebar-w); flex: none;
    position: sticky; top: 0; height: 100vh; background: var(--sidebar); border-right: 1px solid var(--line);
    padding: 20px 16px; }
  .sidebar .brand { padding: 6px 8px 22px; }
  .side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
  .side-nav button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
    background: none; border: none; color: var(--text); padding: 12px 14px; border-radius: 12px;
    font-size: .98rem; font-weight: 600; cursor: pointer; font-family: inherit; }
  .side-nav button .icon { width: 20px; height: 20px; color: var(--muted); flex: none; }
  .side-nav button:hover { background: var(--card-2); }
  .side-nav button.active { background: var(--primary); color: var(--primary-ink); box-shadow: var(--shadow); }
  .side-nav button.active .icon { color: var(--primary-ink); }
  .side-foot { display: flex; align-items: center; gap: 11px; padding: 12px 10px 4px; border-top: 1px solid var(--line); margin-top: 8px; }
  .side-foot-ic { width: 38px; height: 38px; border-radius: 11px; background: var(--card-2); color: var(--primary);
    display: flex; align-items: center; justify-content: center; flex: none; }
  .side-foot-ic .icon { width: 19px; height: 19px; }
  .ff-t { font-weight: 700; font-size: .88rem; } .ff-s { font-size: .74rem; color: var(--muted); }

  .content { flex: 1; min-width: 0; }
  main { max-width: 1080px; padding: 34px 40px; margin: 0; }
  .mobile-only { display: none; }
  .desktop-only { display: block; }
  .tabbar, .fab { display: none; }
  .grid2 { gap: 16px; }
  .modal .sheet { border-radius: 22px; top: 50%; bottom: auto; left: 50%; right: auto;
    transform: translate(-50%, -50%); width: min(640px, 92vw); max-height: 88vh; animation: pop .2s ease; }
  .modal .sheet .grip { display: none; }
  @keyframes pop { from { transform: translate(-50%,-46%); opacity: .5; } to { transform: translate(-50%,-50%); opacity: 1; } }
}
@media (min-width: 900px) {
  .prop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
  .prop-grid .card { margin-bottom: 0; }
  .agenda-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  .advice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
  .advice-grid .card { margin-bottom: 0; }
}
@media (min-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}
