/* Sukola — système de design commun (clair / sombre, mobile d'abord) */
:root {
  --brand: #1f5bd8;
  --brand-600: #1a4dbb;
  --brand-50: #eef3fe;
  --brand-100: #dce6fd;
  --accent: #0e9f8e;
  --accent-50: #e6f7f4;
  --warn: #c77700;
  --warn-50: #fff5e0;
  --danger: #d33a2c;
  --danger-50: #fdecea;
  --ok: #178a4c;
  --ok-50: #e7f6ed;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e3e6eb;
  --text: #1a1a1a;
  --text-2: #595959;
  --text-3: #737373;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 48px;
  /* Typographie calquée sur Booking.com : pile système (rapide sur réseau faible), corps 14/20,
     hiérarchie par la graisse (700 titres, 500 boutons et légendes, 400 texte). */
  --font: BlinkMacSystemFont, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --fs-hero: 32px; --fs-page: 28px; --fs-section: 24px; --fs-sub: 20px; --fs-title: 16px; --fs-title-sm: 14px;
  --fs-body: 14px; --fs-small: 12px; --fs-micro: 11px; --fs-price: 24px; --fs-btn: 16px; --fs-btn-sm: 14px;
  --lh-body: 1.43; --lh-small: 1.33;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #6c9bff; --brand-600: #8bb0ff; --brand-50: #172239; --brand-100: #1d2c4a;
    --accent: #34c7b3; --accent-50: #12302c; --warn: #f0a93a; --warn-50: #33270f; --danger: #ff6b5e; --danger-50: #3a1a17;
    --ok: #4cc983; --ok-50: #123222; --bg: #0f1216; --surface: #171b21; --surface-2: #1e232b; --border: #2a303a;
    --text: #eef1f5; --text-2: #b7beca; --text-3: #8a93a3; --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #6c9bff; --brand-600: #8bb0ff; --brand-50: #172239; --brand-100: #1d2c4a;
  --accent: #34c7b3; --accent-50: #12302c; --warn: #f0a93a; --warn-50: #33270f; --danger: #ff6b5e; --danger-50: #3a1a17;
  --ok: #4cc983; --ok-50: #123222; --bg: #0f1216; --surface: #171b21; --surface-2: #1e232b; --border: #2a303a;
  --text: #eef1f5; --text-2: #b7beca; --text-3: #8a93a3; --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }
body { margin: 0; font-family: var(--font); font-size: var(--fs-body); line-height: var(--lh-body); font-weight: 400; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
a.btn:hover, a.card:hover, a.item:hover, a.service:hover, .bottomnav a:hover, .side nav a:hover, .tabs a:hover, a.chip:hover, a.stat:hover { text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: 0; }
h1 { font-size: var(--fs-page); line-height: 1.14; letter-spacing: -.25px; }
h2 { font-size: var(--fs-sub); line-height: 1.2; }
h3 { font-size: var(--fs-title); line-height: 1.25; }
h4 { font-size: var(--fs-title-sm); line-height: 1.29; }
.t-hero { font-size: var(--fs-hero); font-weight: 700; line-height: 1.13; letter-spacing: -.5px; }
.t-section { font-size: var(--fs-section); font-weight: 700; line-height: 1.17; }
.t-sub { font-size: var(--fs-sub); font-weight: 700; line-height: 1.2; }
.t-title { font-size: var(--fs-title); font-weight: 700; line-height: 1.25; }
.t-price { font-size: var(--fs-price); font-weight: 700; line-height: 1; letter-spacing: -.25px; font-variant-numeric: tabular-nums; }
p { margin: 0; }
.muted { color: var(--text-2); } .dim { color: var(--text-3); } .small { font-size: var(--fs-small); line-height: var(--lh-small); } .tiny { font-size: var(--fs-micro); line-height: 1.27; }
.mono { font-family: var(--mono); } .strong { font-weight: 700; } .center { text-align: center; } .right { text-align: right; }
.nowrap { white-space: nowrap; } .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tabnum { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Mise en page */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-top { display: flex; align-items: flex-start; gap: 10px; }
.between { justify-content: space-between; } .wrap { flex-wrap: wrap; } .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: 10px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.page { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(96px + var(--safe-bottom)); }
.page-wide { max-width: 1280px; margin: 0 auto; padding: 20px 24px 48px; }
.section-title { font-size: var(--fs-title); font-weight: 700; line-height: 1.25; color: var(--text); margin: 8px 2px 2px; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

/* Barre du haut */
.appbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid transparent; }
.appbar.scrolled { border-bottom-color: var(--border); }
.appbar-in { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 8px 12px; }
.appbar h1 { font-size: var(--fs-title); line-height: 1.25; letter-spacing: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: var(--fs-sub); letter-spacing: -.25px; color: var(--text); }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; }

/* Navigation du bas */
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: var(--safe-bottom); }
.bottomnav-in { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); }
.bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 9px; color: var(--text-3); font-size: var(--fs-small); line-height: var(--lh-small); font-weight: 500; position: relative; }
.bottomnav a svg { width: 24px; height: 24px; }
.bottomnav a.active { color: var(--brand); }
.bottomnav .dot { position: absolute; top: 5px; left: calc(50% + 8px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: var(--fs-micro); font-weight: 700; display: grid; place-items: center; }

/* Cartes */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.tight { padding: 12px; }
.card.link { display: block; color: inherit; transition: transform .08s ease, border-color .15s; }
.card.link:active { transform: scale(.99); }
.card.link:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.hero { background: linear-gradient(135deg, #1f5bd8, #137a8c); color: #fff; border: 0; }
.card.link.row { display: flex; }
.hero .muted { color: rgba(255,255,255,.85); }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 18px; border-radius: 12px; border: 1px solid transparent; background: var(--surface-2); color: var(--text); font-size: var(--fs-btn); line-height: 1.25; font-weight: 500; cursor: pointer; transition: background .15s, transform .06s, opacity .15s; text-align: center; -webkit-tap-highlight-color: transparent; user-select: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); }
.btn.accent { background: var(--accent); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.outline { background: transparent; border-color: var(--border); }
.btn.ghost { background: transparent; }
.btn.soft { background: var(--brand-50); color: var(--brand); }
.btn.block { width: 100%; }
.btn.lg { min-height: 56px; font-size: var(--fs-btn); font-weight: 700; border-radius: 14px; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: var(--fs-btn-sm); line-height: 1.29; border-radius: 10px; }
.btn.icon { width: var(--tap); padding: 0; }
.btn.icon.sm { width: 36px; }
.btn .spinner { width: 18px; height: 18px; border-width: 2px; }

/* Formulaires */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: var(--fs-title-sm); line-height: 1.29; font-weight: 500; color: var(--text); }
.input, select.input, textarea.input { width: 100%; min-height: var(--tap); padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { min-height: 88px; resize: vertical; }
.input { font-size: 16px; line-height: 1.25; }
@media (min-width: 768px) { .input, select.input, textarea.input { font-size: var(--fs-body); } }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.input.invalid { border-color: var(--danger); }
.field .err { color: var(--danger); font-size: var(--fs-small); }
.input-group { display: flex; align-items: stretch; }
.input-group .prefix { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--border); border-right: 0; border-radius: 12px 0 0 12px; background: var(--surface-2); color: var(--text-2); font-weight: 500; }
.input-group .input { border-radius: 0 12px 12px 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 14px; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(20px); }

/* Choix (segments, pastilles, options) */
.segmented { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.segmented button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; font-size: var(--fs-btn-sm); font-weight: 500; color: var(--text-2); cursor: pointer; padding: 0 8px; }
.segmented button.on { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: var(--shadow); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 19px; border: 1px solid var(--border); background: var(--surface); font-weight: 500; font-size: var(--fs-btn-sm); cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip svg { width: 16px; height: 16px; }
.option { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: left; width: 100%; }
.option.on { border-color: var(--brand); background: var(--brand-50); }
.option .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); flex: none; }
.option.on .ic { background: var(--brand); color: #fff; }
.option .ic svg { width: 22px; height: 22px; }
.option:disabled { opacity: .5; cursor: not-allowed; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: var(--fs-small); line-height: var(--lh-small); font-weight: 500; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.blue { background: var(--brand-50); color: var(--brand); }
.badge.green { background: var(--ok-50); color: var(--ok); }
.badge.orange { background: var(--warn-50); color: var(--warn); }
.badge.red { background: var(--danger-50); color: var(--danger); }
.badge.teal { background: var(--accent-50); color: var(--accent); }
.badge .pulse { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* Listes */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list > .item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-top: 1px solid var(--border); color: inherit; min-height: 56px; }
.list > .item:first-child { border-top: 0; }
.list > a.item:active, .list > button.item:active { background: var(--surface-2); }
.list > button.item { width: 100%; border-left: 0; border-right: 0; border-bottom: 0; background: transparent; text-align: left; cursor: pointer; }
.item .ic { width: 38px; height: 38px; border-radius: 11px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-2); flex: none; }
.item .ic svg { width: 20px; height: 20px; }
.item .chev, .chev { color: var(--text-3); width: 18px; height: 18px; flex: none; }
.hero svg { width: 26px; height: 26px; }

/* Stepper de quantités */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.stepper button { width: 42px; height: 42px; border: 0; background: transparent; font-size: 22px; font-weight: 700; color: var(--brand); cursor: pointer; }
.stepper button:disabled { color: var(--text-3); }
.stepper output { min-width: 34px; text-align: center; font-size: var(--fs-title); font-weight: 700; font-variant-numeric: tabular-nums; }
.garment { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.garment.on { border-color: var(--brand); background: var(--brand-50); }
.garment .ic { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--brand); flex: none; }
.garment.on .ic { background: var(--surface); }

/* Chronologie */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 16px 28px; }
.timeline li::before { content: ""; position: absolute; left: 8px; top: 18px; bottom: -2px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 3px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--brand); }
.timeline li.warn::after { border-color: var(--warn); }
.timeline li.bad::after { border-color: var(--danger); }
.timeline li.done::after { background: var(--brand); }

/* Progression d'étapes */
.progress-steps { display: flex; gap: 4px; }
.progress-steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.progress-steps span.on { background: var(--brand); }

/* Carte géographique */
.map { position: relative; overflow: hidden; background: #dfe6e9; border-radius: var(--radius); touch-action: none; user-select: none; -webkit-user-select: none; min-height: 200px; }
:root[data-theme="dark"] .map, .map.dark { background: #1b2229; }
.map .tiles, .map .overlay, .map .markers { position: absolute; inset: 0; }
.map .tiles img { position: absolute; width: 256px; height: 256px; max-width: none; pointer-events: none; user-select: none; }
.map .overlay svg { position: absolute; overflow: visible; pointer-events: none; }
.map .marker { position: absolute; transform: translate(-50%, -100%); pointer-events: auto; cursor: pointer; }
.map .marker.center { transform: translate(-50%, -50%); }
.map .attrib { position: absolute; right: 4px; bottom: 4px; font-size: 10px; background: rgba(255,255,255,.8); color: #333; padding: 1px 5px; border-radius: 4px; z-index: 3; }
.map .zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 3; }
.map .zoom button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-size: 20px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow); display: grid; place-items: center; color: var(--text); }
.map .zoom button svg { width: 18px; height: 18px; }
.map .crosshair { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); pointer-events: none; z-index: 4; filter: drop-shadow(0 3px 4px rgba(0,0,0,.3)); }
.map .crosshair.lift { transform: translate(-50%, calc(-100% - 10px)); transition: transform .15s; }
.pin { width: 34px; height: 44px; }
.dot-marker { width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.agent-marker { width: 38px; height: 38px; border-radius: 50%; background: var(--brand); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); display: grid; place-items: center; color: #fff; }
.agent-marker svg { width: 20px; height: 20px; }
.map-label { background: var(--surface); color: var(--text); padding: 3px 8px; border-radius: 8px; font-size: var(--fs-small); font-weight: 700; box-shadow: var(--shadow); white-space: nowrap; }

/* Feuilles modales et boîtes de dialogue */
.backdrop { position: fixed; inset: 0; background: rgba(10, 14, 20, .45); z-index: 80; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--surface); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 8px 16px calc(20px + var(--safe-bottom)); animation: up .2s ease-out; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 4px auto 12px; }
@media (min-width: 720px) { .backdrop.dialog { align-items: center; } .backdrop.dialog .sheet { border-radius: 20px; max-width: 520px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }

/* Notifications éphémères */
.toasts { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast { background: #1d2330; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: var(--fs-body); animation: drop .2s ease-out; pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; }
.toast.err { background: var(--danger); } .toast.ok { background: var(--ok); }
.toast b { display: block; }
@keyframes drop { from { transform: translateY(-12px); opacity: 0; } }

/* Chargement */
.spinner { width: 28px; height: 28px; border: 3px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; min-height: 40vh; color: var(--brand); }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; }
@keyframes sk { to { background-position: -200% 0; } }
.empty { text-align: center; padding: 36px 16px; color: var(--text-2); }
.empty svg { width: 48px; height: 48px; margin: 0 auto 10px; color: var(--text-3); }

/* Bandeaux */
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--brand-50); color: var(--text); font-size: var(--fs-body); }
.banner svg { width: 20px; height: 20px; flex: none; color: var(--brand); margin-top: 1px; }
.banner.warn { background: var(--warn-50); } .banner.warn svg { color: var(--warn); }
.banner.err { background: var(--danger-50); } .banner.err svg { color: var(--danger); }
.banner.ok { background: var(--ok-50); } .banner.ok svg { color: var(--ok); }
.testmode { background: repeating-linear-gradient(45deg, #ffe08a, #ffe08a 10px, #ffd35c 10px, #ffd35c 20px); color: #3a2c00; text-align: center; font-size: var(--fs-small); font-weight: 700; padding: 3px; }

/* Montants et récapitulatif */
.amount { font-size: var(--fs-hero); font-weight: 700; line-height: 1.13; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.amount.md { font-size: var(--fs-price); line-height: 1; letter-spacing: -.25px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-variant-numeric: tabular-nums; }
.kv.total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 12px; font-weight: 700; font-size: var(--fs-sub); line-height: 1.2; }
.stars { display: flex; gap: 4px; }
.stars button { border: 0; background: none; padding: 2px; cursor: pointer; color: var(--border); }
.stars button.on { color: #f5b301; }
.stars svg { width: 34px; height: 34px; }
.stars.sm svg { width: 18px; height: 18px; }

/* QR */
.qr-box { background: #fff; padding: 14px; border-radius: 16px; width: min(260px, 70vw); margin: 0 auto; }
.pin-code { font-family: var(--mono); font-size: var(--fs-page); letter-spacing: .3em; font-weight: 700; text-align: center; }

/* Scanner */
.scanner { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 3/4; max-height: 60vh; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.9); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }

/* Tableaux (administration) */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
.table th { text-align: left; font-weight: 700; color: var(--text); font-size: var(--fs-small); line-height: var(--lh-small); padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Indicateurs */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: var(--fs-price); font-weight: 700; line-height: 1.17; letter-spacing: -.25px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .l { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--text-2); font-weight: 500; }
.stat .s { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--text-3); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }

/* Administration : barre latérale */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--border); padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { padding: 4px 10px 16px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; font-size: var(--fs-body); }
.side nav a:hover { background: var(--surface-2); color: var(--text); }
.side nav a.active { background: var(--brand-50); color: var(--brand); font-weight: 700; }
.side nav a svg { width: 19px; height: 19px; flex: none; }
.side nav .grp { font-size: var(--fs-small); font-weight: 700; color: var(--text-3); padding: 14px 12px 4px; }
.side nav a .count { margin-left: auto; background: var(--danger); color: #fff; border-radius: 9px; font-size: var(--fs-micro); font-weight: 700; padding: 1px 6px; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: var(--fs-sub); line-height: 1.2; letter-spacing: 0; flex: 1; }
.menu-btn { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; z-index: 90; transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .page-wide { padding: 16px 14px 40px; }
  .topbar { padding: 10px 14px; }
}
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .input, .toolbar select { min-height: 40px; width: auto; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button, .tabs a { border: 0; background: none; padding: 10px 14px; font-size: var(--fs-body); font-weight: 500; color: var(--text-2); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs .on { color: var(--brand); font-weight: 700; border-bottom-color: var(--brand); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.cols-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .cols-2 { grid-template-columns: 1fr; } }

/* Graphiques SVG */
.chart { width: 100%; }
.chart text { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .grid line { stroke: var(--border); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: var(--fs-small); color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.chart-tip { position: fixed; pointer-events: none; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: 10px; padding: 8px 10px; font-size: var(--fs-small); z-index: 120; }

/* Écran d'accueil / connexion */
.auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px 20px calc(24px + var(--safe-bottom)); max-width: 440px; margin: 0 auto; gap: 22px; }
.auth .logo-big { width: 64px; height: 64px; border-radius: 18px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.auth .logo-big svg { width: 36px; height: 36px; }

/* Services (accueil client) */
.services { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.service { display: flex; flex-direction: column; gap: 10px; padding: 16px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text); text-align: left; cursor: pointer; min-height: 132px; box-shadow: var(--shadow); }
.service .ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.service .ic svg { width: 24px; height: 24px; }
.service b { font-size: var(--fs-title); font-weight: 700; line-height: 1.25; }
.service span { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--text-2); }
.service.alt .ic { background: var(--accent-50); color: var(--accent); }

/* Barre d'action collante */
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; background: var(--surface); border-top: 1px solid var(--border); padding: 10px 16px calc(10px + var(--safe-bottom)); }
.actionbar-in { max-width: 608px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }

/* Hors connexion */
.offline-bar { position: fixed; top: 0; left: 0; right: 0; background: var(--warn); color: #fff; text-align: center; font-size: var(--fs-small); font-weight: 700; padding: 4px; z-index: 110; }

@media print {
  .side, .topbar, .bottomnav, .actionbar, .toolbar .btn, .no-print { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .card, .stat, .table-wrap { box-shadow: none; break-inside: avoid; }
}

/* Tuiles de carte atténuées en thème sombre */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .map .tiles { filter: brightness(.72) contrast(1.08) saturate(.85); } }
:root[data-theme="dark"] .map .tiles { filter: brightness(.72) contrast(1.08) saturate(.85); }

/* Palette des graphiques (validée pour le daltonisme, clair et sombre) */
:root { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; } }
:root[data-theme="dark"] { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; }
