:root {
  --bg: #f6f8f8; --surface: #fff; --surface-2: #f1f5f4; --border: #dfe6e4;
  --text: #0f172a; --muted: #5b6b70; --primary: #0f766e; --primary-dark: #115e59;
  --accent: #ccfbf1; --danger: #dc2626; --warning: #b45309;
  --shadow: 0 1px 2px rgba(15,23,42,.08), 0 6px 18px rgba(15,23,42,.10);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[v-cloak] { display: none; }
#app { min-height: 100%; display: flex; flex-direction: column; }
h1 { font-size: 24px; margin: 0 0 16px; letter-spacing: -.3px; }
h2 { font-size: 18px; margin: 0 0 10px; }
h2 small { color: var(--muted); font-weight: 600; }
h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 12px 0 4px; }
a { color: var(--primary); }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

/* Boutons */
.btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { border-color: #9fb1b5; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; padding: 4px 0; }
.link.danger, .danger { color: var(--danger); }

/* Compte (coin haut droit) */
.account-corner { position: fixed; top: 12px; right: 14px; z-index: 1500; }
.avatar { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; font-weight: 800; font-size: 16px; cursor: pointer; box-shadow: var(--shadow); }
.menu { position: absolute; right: 0; top: 48px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); min-width: 260px; padding: 6px; display: flex; flex-direction: column; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: flex; flex-direction: column; }
.menu a, .menu button { text-align: left; padding: 9px 10px; border-radius: 9px; color: var(--text); text-decoration: none; border: 0; background: none; font: inherit; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }

/* Accueil : carte plein écran */
.home { position: fixed; inset: 0; }
.map { width: 100%; height: 100%; min-height: 300px; }
.map.full { position: absolute; inset: 0; }
.floating { position: absolute; top: 12px; left: 12px; width: 400px; max-width: calc(100% - 80px); z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-height: calc(100% - 24px); }
.searchbox { display: flex; align-items: center; gap: 6px; background: var(--surface); border-radius: 26px; box-shadow: var(--shadow); padding: 5px 8px 5px 5px; }
.searchbox .logo img { width: 36px; height: 36px; border-radius: 50%; display: block; }
.searchbox input { flex: 1; border: 0; padding: 8px 4px; font-size: 15px; outline: none; background: transparent; }
.searchbox .clear { border: 0; background: none; font-size: 22px; color: var(--muted); cursor: pointer; }
.panel { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 14px; overflow: auto; position: relative; }
.panel .row, .incident-row { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 9px; cursor: pointer; font: inherit; color: inherit; }
.panel .row:hover, .incident-row:hover { background: var(--surface-2); }
.panel .row span { font-size: 13px; color: var(--muted); }
.store { position: absolute; left: 12px; bottom: 26px; z-index: 900; background: var(--surface); padding: 8px 12px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 700; text-decoration: none; font-size: 13.5px; }
.steps { display: flex; gap: 8px; padding: 0; list-style: none; margin: 10px 0; }
.steps li { flex: 1; text-align: center; font-size: 12.5px; padding: 6px 4px; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.steps li.done { background: var(--accent); color: var(--primary-dark); font-weight: 700; }

/* En-tête des espaces */
.topbar { display: flex; align-items: center; gap: 14px; padding: 10px 70px 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1000; flex-wrap: wrap; min-height: 62px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; color: var(--text); text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.org-name { font-weight: 700; color: var(--muted); border-left: 1px solid var(--border); padding-left: 14px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { padding: 7px 12px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.nav a.active { background: var(--accent); color: var(--primary-dark); }
.badge { background: var(--danger); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; }

/* Pages */
.page { padding: 24px 16px 60px; max-width: 1100px; margin: 0 auto; width: 100%; }
.page.narrow { max-width: 440px; padding-top: 48px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; position: relative; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pad { padding: 12px; }
.error { color: var(--danger); font-weight: 600; }
.info { color: var(--primary-dark); font-weight: 600; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 1px 8px; }
.chip { display: inline-block; font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 3px 10px; }
.code { font-size: 22px; font-weight: 800; letter-spacing: .04em; margin: 2px 0; }
.small-code { font-size: 15px; color: var(--primary); }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 10px 0 0; font-weight: 700; }
.note { background: var(--surface-2); border-radius: 9px; padding: 8px 10px; font-size: 14px; margin: 8px 0; }
.photo { width: 100%; border-radius: 10px; margin: 8px 0; max-height: 240px; object-fit: cover; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.actions.subtle { justify-content: space-between; border-top: 1px solid var(--border); padding-top: 8px; }
.item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; }
.item.clickable { cursor: pointer; text-decoration: none; color: inherit; }
.item.clickable:hover { background: var(--surface-2); }
.block { display: block; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.close { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); z-index: 2; }
.toast { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 2000; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.toast.error { background: var(--danger); }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: 12px; }
.form.inline { flex-direction: row; flex-wrap: wrap; }
.form label, .form-grid label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
label.check { flex-direction: row !important; align-items: center; gap: 8px; font-weight: 500; }
.inline-check { display: inline-flex; align-items: center; gap: 6px; margin: 4px 14px 4px 0; font-size: 14px; }
.fieldset { border: 1px solid var(--border); border-radius: 12px; margin: 14px 0 0; padding: 10px 12px; }
.fieldset legend { font-weight: 700; font-size: 14px; padding: 0 6px; }
.village-list { max-height: 200px; overflow: auto; margin-top: 8px; }
input, select { font: inherit; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); }
.form.inline input { flex: 1; min-width: 220px; }
.links { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* Espace d'une organisation : tableau de bord */
.org { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.board { flex: 1; display: flex; flex-direction: column; min-height: 0; height: calc(100vh - 62px); }
.kpis { display: flex; gap: 10px; padding: 12px 16px; flex-wrap: wrap; align-items: stretch; border-bottom: 1px solid var(--border); background: var(--surface); }
.kpis.inline { padding: 0; border: 0; background: none; margin-bottom: 14px; }
.kpi { background: var(--surface-2); border-radius: 12px; padding: 8px 14px; min-width: 120px; }
.kpi b { display: block; font-size: 22px; }
.kpi span { font-size: 12.5px; color: var(--muted); }
.kpi.alert b { color: var(--danger); }
.kpi-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.create { margin: 12px 16px; flex-shrink: 0; max-height: 46vh; overflow: auto; }
.board-body { flex: 1; display: grid; grid-template-columns: 340px 1fr; min-height: 340px; }
.board-list { overflow: auto; border-right: 1px solid var(--border); background: var(--surface); }
.filters { display: flex; gap: 8px; padding: 8px; align-items: center; }
.filters select { flex: 1; font-size: 13px; padding: 6px 8px; }
.tabs { display: flex; gap: 4px; }
.tabs.wide { padding: 0 0 12px; flex-wrap: wrap; }
.tabs button { flex: 1; border: 1px solid var(--border); background: var(--surface); border-radius: 9px; padding: 7px 10px; font: inherit; font-weight: 600; cursor: pointer; color: var(--muted); }
.tabs button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.incident-row { flex-direction: row; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); border-radius: 0; }
.incident-row.selected { background: var(--accent); }
.incident-row.fresh { animation: fresh 1.2s ease-in-out 4; }
@keyframes fresh { 50% { background: #fee2e2; } }
.incident-row .grow { display: flex; flex-direction: column; flex: 1; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border); }
.dot.big { width: 22px; height: 22px; }
.board-map-wrap { position: relative; min-height: 0; }
.detail { position: absolute; top: 12px; right: 12px; width: 380px; max-height: calc(100% - 24px); overflow: auto; z-index: 500; margin: 0; }
.detail-head { display: flex; align-items: center; gap: 10px; }
.detail-head > div { flex: 1; }
.detail-head h2 { margin: 0; }
.assign { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.assign label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13.5px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
tr.muted td { opacity: .6; }

/* Dessin sur la carte */
.draw-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; padding: 10px; border-radius: 10px; background: #f5f3ff; }
.drawing .leaflet-container, .drawing .leaflet-interactive { cursor: crosshair; }

/* Intégration */
.snippet { background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 12px; overflow-x: auto; font-size: 12.5px; line-height: 1.5; white-space: pre; }

/* Bilan */
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 200px; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bar { width: 100%; background: var(--primary); border-radius: 6px 6px 0 0; min-height: 2px; display: flex; justify-content: center; }
.bar span { color: #fff; font-size: 11px; font-weight: 700; padding-top: 2px; }
.bar-col small { color: var(--muted); font-size: 11.5px; }

/* Marqueurs */
.pin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.pin.pulse { animation: pulse 1.4s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(220,38,38,.6); } 100% { box-shadow: 0 0 0 16px rgba(220,38,38,0); } }
.bubble { background: var(--primary); color: #fff; border: 3px solid #fff; border-radius: 999px; font-weight: 800; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0,0,0,.3); }

/* Téléphone */
@media (max-width: 760px) {
  html, body { overflow-x: hidden; }
  .floating { width: auto; right: 64px; max-width: none; }
  .floating .panel { max-height: 55vh; }
  .store { display: none; }
  .topbar { padding-right: 64px; }
  .org-name { border: 0; padding: 0; width: 100%; }
  .nav { flex-wrap: nowrap; overflow-x: auto; width: 100%; }
  .nav a { white-space: nowrap; }
  .board { height: auto; }
  .kpis { display: grid; grid-template-columns: 1fr 1fr; padding: 10px 12px; }
  .kpis.inline { display: grid; }
  .kpi { min-width: 0; }
  .kpi-actions { grid-column: 1 / -1; margin-left: 0; }
  .kpi-actions .btn { flex: 1; }
  .board-body { display: flex; flex-direction: column; }
  .board-list { border-right: 0; border-bottom: 1px solid var(--border); max-height: 45vh; }
  .board-map-wrap .map { height: 60vh; }
  .detail { position: static; width: auto; max-height: none; margin: 12px; }
  .form.inline input { min-width: 0; }
  .table th:nth-child(2), .table td:nth-child(2) { display: none; }
}

/* Audit n° 5 */
.notice-bar { margin: 0; padding: 10px 16px; background: #fef3c7; color: #92400e; font-weight: 700; font-size: 14px; }
.card.warn { border-color: #f59e0b; }
.mini-form { display: grid; gap: 8px; margin-top: 8px; }
.history { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.history-list { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; max-height: 220px; overflow: auto; }
.scope-grid { display: grid; grid-template-columns: auto auto auto; gap: 6px 14px; align-items: center; justify-content: start; margin-top: 8px; }
.zone-legend { position: absolute; left: 16px; bottom: 56px; z-index: 500; display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.94); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); font-size: 12.5px; font-weight: 700; }
.zone-swatch { width: 16px; height: 16px; border-radius: 50%; background: #dc2626; color: #fff; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.zone-pin { color: #fff; font-weight: 800; font-size: 14px; display: flex; align-items: center; justify-content: center; }
@media (max-width: 720px) { .zone-legend { bottom: 96px; right: 16px; } }
.scope-grid .inline-check { display: inline-flex; flex-direction: row; align-items: center; gap: 4px; margin: 0; font-weight: 400; }
.scope-grid .inline-check input { width: auto; margin: 0; }

/* Audit n° 6 */
.btn.whatsapp { background: #16a34a; color: #fff; border-color: #16a34a; }
.legal h2 { font-size: 16px; margin: 18px 0 6px; }
.legal p { line-height: 1.55; }
.legal-links { position: absolute; left: 16px; bottom: 16px; z-index: 500; font-size: 12px; background: rgba(255, 255, 255, 0.9); padding: 4px 10px; border-radius: 999px; }
@media (max-width: 720px) { .legal-links { bottom: 60px; } }

/* Page de présentation (accueil du site) */
.vt { --vt-dark: #0f2e2b; --vt-yellow: #f2c230; --vt-mint: #e8f1ec; --vt-soft: #3e504d; background: #f6f8f4; color: var(--vt-dark); }
.vt h1, .vt h2, .vt h3 { font-family: Outfit, system-ui, sans-serif; color: var(--vt-dark); text-transform: none; letter-spacing: 0; }
.vt-head { display: flex; align-items: center; gap: 20px; padding: 14px 72px 14px 20px; max-width: 1120px; margin: 0 auto; }
.vt-logo img { height: 38px; display: block; }
.vt-nav { display: flex; gap: 18px; margin-left: auto; }
.vt-nav a { color: var(--vt-dark); font-weight: 700; text-decoration: none; }
.vt-hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center; max-width: 1120px; margin: 0 auto; padding: 40px 20px 56px; }
.vt-hero h1 { font-size: 48px; line-height: 1.05; margin: 0 0 16px; }
.vt-lead { font-size: 18px; color: var(--vt-soft); margin: 0 0 22px; max-width: 560px; }
.vt-search { display: flex; gap: 8px; max-width: 520px; }
.vt-search input { flex: 1; min-width: 0; padding: 12px 14px; border: 1px solid #c9d6d2; border-radius: 12px; font: inherit; font-size: 16px; background: #fff; }
.vt-ctas { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.vt .btn { padding: 11px 18px; border-radius: 12px; }
.vt-card { background: var(--vt-dark); color: #f6f8f4; border-radius: 22px; padding: 28px; box-shadow: 0 20px 40px rgba(15,46,43,.25); }
.vt-card-label { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px; color: #bfd8d5; }
.vt-card-code { margin: 8px 0 4px; font: 700 34px/1.1 ui-monospace, "SF Mono", Menlo, monospace; color: var(--vt-yellow); letter-spacing: 1px; }
.vt-card-place { margin: 0 0 18px; color: #bfd8d5; }
.vt-card-parts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 14px; color: #bfd8d5; }
.vt-card-parts b { color: #f6f8f4; font-family: ui-monospace, Menlo, monospace; }
.vt-section { max-width: 1120px; margin: 0 auto; padding: 48px 20px; }
.vt-alt, .vt-dark { max-width: none; padding-left: max(20px, calc((100% - 1080px) / 2)); padding-right: max(20px, calc((100% - 1080px) / 2)); }
.vt-alt { background: var(--vt-mint); }
.vt-dark { background: var(--vt-dark); color: #f6f8f4; }
.vt-dark h2 { color: #f6f8f4; }
.vt-dark .vt-text { color: #bfd8d5; }
.vt-section h2 { font-size: 32px; margin: 0 0 22px; }
.vt-steps, .vt-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.vt-steps > div, .vt-box { background: #fff; border-radius: 18px; padding: 22px; }
.vt-steps h3, .vt-box h3 { font-size: 20px; margin: 8px 0 6px; }
.vt-steps p, .vt-box p { margin: 0; color: var(--vt-soft); }
.vt-num { display: inline-flex; width: 36px; height: 36px; border-radius: 50%; background: var(--vt-dark); color: var(--vt-yellow); align-items: center; justify-content: center; font: 700 18px Outfit, sans-serif; }
.vt-note, .vt-text { color: var(--vt-soft); font-size: 17px; max-width: 760px; }
.vt-note { margin: 18px 0 0; }
.vt-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 28px; }
.vt-stats div { border-left: 5px solid var(--primary); padding: 4px 0 4px 16px; display: flex; flex-direction: column; }
.vt-stats strong { font: 700 44px/1 Outfit, sans-serif; color: var(--primary); }
.vt-stats span { color: var(--vt-soft); margin-top: 6px; }
.vt details { background: #fff; border-radius: 14px; padding: 14px 18px; margin-bottom: 10px; max-width: 760px; }
.vt summary { font-weight: 700; cursor: pointer; }
.vt details p { margin: 10px 0 0; color: var(--vt-soft); }
.vt-foot { text-align: center; padding: 36px 20px 48px; color: var(--vt-soft); font-size: 14px; border-top: 1px solid #dfe6e4; }
.vt-foot img { height: 30px; }
.vt-foot p { margin: 8px 0 0; }
@media (max-width: 760px) {
  .vt-hero { grid-template-columns: 1fr; padding-top: 20px; gap: 28px; }
  .vt-hero h1 { font-size: 34px; }
  .vt-steps, .vt-grid3, .vt-stats { grid-template-columns: 1fr; }
  .vt-nav { display: none; }
  .vt-section, .vt-alt, .vt-dark { padding: 36px 16px; }
  .vt-head { padding-left: 16px; }
  .vt-card-code { font-size: 28px; }
}
