/* PLUMBER GO — système visuel partagé.
   Identité : encre bleu nuit + jaune « Go » (action) + bleu eau (information). */
:root {
  --ink: #0d1b2e; --ink-2: #3a4a60; --ink-3: #6b7a8f;
  --bg: #f4f6f9; --surface: #ffffff; --line: #e3e8ef; --line-2: #cfd7e2;
  --go: #ffc629; --go-ink: #241a00; --go-press: #f0b400;
  --water: #0a6cff; --water-soft: #e6f0ff;
  --ok: #138a4b; --ok-soft: #e3f5ea; --warn: #b26b00; --warn-soft: #fff3dc; --bad: #c62828; --bad-soft: #fde8e8;
  --radius: 14px; --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(13, 27, 46, .06), 0 8px 24px rgba(13, 27, 46, .08);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body, #root { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 800; } h2 { font-size: 1.2rem; font-weight: 800; } h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .6em; } a { color: var(--water); }
.muted { color: var(--ink-3); } .small { font-size: .85rem; } .tiny { font-size: .75rem; } .strong { font-weight: 800; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; } .gap { gap: 10px; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; } .grow { flex: 1; } .center { text-align: center; }
.hidden { display: none !important; }
.stack > * + * { margin-top: 12px; }

/* Logo */
.logo { font-weight: 900; letter-spacing: -.03em; font-size: 1.35rem; display: inline-flex; align-items: center; gap: 8px; }
.logo .drop { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--water); display: inline-grid; place-items: center; }
.logo .drop::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--go); }
.logo b { background: var(--go); color: var(--go-ink); padding: 0 7px; border-radius: 7px; }

/* Boutons */
.btn { appearance: none; border: 0; border-radius: 12px; padding: 13px 18px; font: inherit; font-weight: 800; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; transition: transform .06s, background .15s; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--go); color: var(--go-ink); } .btn.primary:hover { background: var(--go-press); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.blue { background: var(--water); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-2); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.block { width: 100%; } .btn.sm { min-height: 36px; padding: 7px 12px; font-size: .85rem; border-radius: 10px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ''; position: absolute; width: 18px; height: 18px; border: 2.5px solid var(--ink); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
:focus-visible { outline: 3px solid var(--water); outline-offset: 2px; }

/* Formulaires */
label.field { display: block; font-weight: 700; font-size: .85rem; color: var(--ink-2); }
label.field > span { display: block; margin-bottom: 6px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line-2); border-radius: 12px; padding: 12px 14px; min-height: 48px; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--water); box-shadow: 0 0 0 3px var(--water-soft); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line-2); font-weight: 700; font-size: .85rem; cursor: pointer; user-select: none; }
.chip input { display: none; } .chip:has(input:checked) { background: var(--ink); color: #fff; border-color: var(--ink); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; }
.switch input { width: 48px; height: 28px; min-height: 0; appearance: none; background: var(--line-2); border-radius: 99px; border: 0; position: relative; cursor: pointer; padding: 0; flex: none; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--ok); } .switch input:checked::after { left: 23px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 10px; font: inherit; font-weight: 800; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* Cartes & listes */
.card { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--surface); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; cursor: pointer; border: 0; width: 100%; text-align: left; font: inherit; color: inherit; }
.item .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--bg); display: grid; place-items: center; font-size: 1.35rem; flex: none; }
.empty { text-align: center; color: var(--ink-3); padding: 40px 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.kpi .v { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .l { font-size: .78rem; color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--ink); color: var(--go); display: grid; place-items: center; font-weight: 900; flex: none; }

/* Statuts */
.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: .75rem; font-weight: 800; background: var(--bg); color: var(--ink-2); white-space: nowrap; }
.st-searching, .st-scheduled { background: var(--warn-soft); color: var(--warn); }
.st-accepted, .st-en_route, .st-arrived, .st-quote_sent, .st-in_progress { background: var(--water-soft); color: var(--water); }
.st-completed { background: #fff6d6; color: #7a5600; } .st-paid, .st-success, .st-active { background: var(--ok-soft); color: var(--ok); }
.st-cancelled, .st-failed, .st-suspended, .st-rejected { background: var(--bad-soft); color: var(--bad); }
.st-pending, .st-requested { background: var(--warn-soft); color: var(--warn); }

/* Toasts & modales */
#toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 24px)); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; animation: drop .25s ease; pointer-events: auto; }
.toast-error { background: var(--bad); } .toast-ok { background: var(--ok); }
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes drop { from { transform: translateY(-10px); opacity: 0; } }
.modal-backdrop { position: fixed; inset: 0; background: rgba(13, 27, 46, .5); z-index: 2000; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
@media (min-width: 640px) { .modal-backdrop { align-items: center; } }
.modal { background: var(--surface); width: min(480px, 100%); max-height: 92vh; overflow: auto; border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); animation: up .25s ease; }
@media (min-width: 640px) { .modal { border-radius: var(--radius-lg); } }
.modal-text { font-weight: 600; margin-bottom: 18px; }
@keyframes fade { from { opacity: 0; } } @keyframes up { from { transform: translateY(40px); } }

/* Marqueurs carte */
.pin span { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.pin.me span { background: var(--water); width: 22px; height: 22px; margin: 7px; box-shadow: 0 0 0 8px rgba(10,108,255,.2); }
.pin.home span { background: var(--ink); color: var(--go); }
.pin.plumber span { background: var(--go); }
.pin.plumber-busy span { background: #ff8a3d; }
.pin.job span { background: var(--ink); color: #fff; font-size: 14px; }
.leaflet-container { font-family: var(--font); background: #e8edf2; }

/* ===== Application mobile (client / plombier) ===== */
.mobile { max-width: 560px; margin: 0 auto; height: 100%; display: flex; flex-direction: column; background: var(--bg); position: relative; overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 500; }
.view { flex: 1; overflow-y: auto; padding: 16px 16px 24px; }
.view.mapview { padding: 0; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.mapview .map { flex: 1; min-height: 200px; }
.sheet { background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: 0 -8px 30px rgba(13,27,46,.12); padding: 10px 16px 16px; position: relative; z-index: 600; max-height: 68%; overflow-y: auto; margin-top: -18px; }
.sheet::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); margin: 0 auto 12px; }
.tabbar { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 700; }
.tabbar button { border: 0; background: none; padding: 9px 4px 10px; font: inherit; font-size: .72rem; font-weight: 700; color: var(--ink-3); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; }
.tabbar button .i { font-size: 1.25rem; line-height: 1; }
.tabbar button.on { color: var(--ink); } .tabbar button.on .i { transform: scale(1.1); }
.dot { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 17px; height: 17px; border-radius: 9px; background: var(--bad); color: #fff; font-size: .65rem; display: grid; place-items: center; padding: 0 4px; }
.services { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.svc { border: 0; background: var(--bg); border-radius: 14px; padding: 12px 4px 10px; font: inherit; font-size: .72rem; font-weight: 700; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ink); line-height: 1.15; text-align: center; }
.svc .e { font-size: 1.6rem; } .svc.on { background: var(--ink); color: #fff; }
.price-big { font-size: 1.9rem; font-weight: 900; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.breakdown { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: .88rem; color: var(--ink-2); }
.breakdown .tot { font-weight: 800; color: var(--ink); border-top: 1px solid var(--line); padding-top: 6px; }
.steps { display: flex; gap: 4px; margin: 6px 0 12px; } .steps i { flex: 1; height: 5px; border-radius: 4px; background: var(--line); } .steps i.done { background: var(--ok); } .steps i.now { background: var(--go); }
.pulse { width: 72px; height: 72px; border-radius: 50%; margin: 8px auto 14px; background: var(--go); position: relative; display: grid; place-items: center; font-size: 30px; }
.pulse::before, .pulse::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--go); animation: ring 1.8s infinite; }
.pulse::after { animation-delay: .9s; }
@keyframes ring { to { transform: scale(2.1); opacity: 0; } }
.methods { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.method { border: 2px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 6px; font: inherit; font-weight: 800; font-size: .8rem; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink); }
.method .logo-m { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 900; font-size: .8rem; }
.method.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.m-orange { background: #ff7900; } .m-mtn { background: #ffcc00; color: #1a1a1a !important; } .m-moov { background: #0057a8; } .m-wave { background: #1dc3ff; } .m-cash { background: #2e7d32; }
.quote-lines { width: 100%; border-collapse: collapse; font-size: .9rem; } .quote-lines td { padding: 6px 0; border-bottom: 1px dashed var(--line); } .quote-lines td:last-child { text-align: right; }
.rating-input { display: flex; gap: 6px; justify-content: center; font-size: 2.2rem; }
.rating-input button { background: none; border: 0; cursor: pointer; color: var(--line-2); font-size: inherit; padding: 0 2px; } .rating-input button.on { color: var(--go); }
.online-btn { width: 100%; border: 0; border-radius: 18px; padding: 18px; font: inherit; font-size: 1.15rem; font-weight: 900; cursor: pointer; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; }
.online-btn.on { background: var(--ok); }
.online-btn .led { width: 12px; height: 12px; border-radius: 50%; background: #8a96a8; } .online-btn.on .led { background: #b9ffd2; box-shadow: 0 0 0 4px rgba(185,255,210,.35); }
.countdown { height: 6px; background: var(--line); border-radius: 4px; overflow: hidden; } .countdown i { display: block; height: 100%; background: var(--go); transition: width .25s linear; }
.auth { min-height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 28px 20px; max-width: 440px; margin: 0 auto; }
.auth .hero { background: var(--ink); color: #fff; border-radius: var(--radius-lg); padding: 22px; margin-bottom: 18px; }
.auth .hero .logo { color: #fff; } .auth .hero p { color: #c5d0de; margin: 10px 0 0; }
.demo { font-size: .8rem; background: var(--water-soft); color: #0c3d8a; border-radius: 12px; padding: 10px 12px; }
.timeline { list-style: none; padding: 0; margin: 0; } .timeline li { padding: 0 0 12px 18px; border-left: 2px solid var(--line); position: relative; font-size: .85rem; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--water); }

/* ===== Back-office ===== */
.admin { display: grid; grid-template-columns: 236px 1fr; min-height: 100%; }
.side { background: var(--ink); color: #c5d0de; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { color: #fff; margin: 0 8px 22px; }
.side nav button { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: none; color: inherit; font: inherit; font-weight: 700; padding: 10px 12px; border-radius: 10px; cursor: pointer; text-align: left; }
.side nav button:hover { background: rgba(255,255,255,.06); } .side nav button.on { background: var(--go); color: var(--go-ink); }
.side nav .count { margin-left: auto; background: var(--bad); color: #fff; border-radius: 99px; font-size: .7rem; padding: 1px 7px; }
.main { padding: 24px 28px; min-width: 0; }
.main .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .main .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.main header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; } .grid2b { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.t th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #f8fafc; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; min-height: 40px; padding: 8px 12px; }
.livemap { height: calc(100vh - 140px); min-height: 420px; border-radius: var(--radius); overflow: hidden; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--surface); box-shadow: -10px 0 40px rgba(13,27,46,.2); z-index: 1500; overflow-y: auto; padding: 22px; animation: slide .2s ease; }
@keyframes slide { from { transform: translateX(30px); opacity: .5; } }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .bar { fill: var(--water); } .chart .bar:hover, .chart .bar.hl { fill: #0050c8; }
.chart .grid { stroke: var(--line); stroke-width: 1; } .chart .axis { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; border-radius: 8px; padding: 7px 10px; font-size: .8rem; white-space: nowrap; transform: translate(-50%, -110%); z-index: 10; }
.hbar { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; gap: 8px; align-items: center; font-size: .85rem; margin-bottom: 8px; }
.hbar .track { height: 12px; background: var(--bg); border-radius: 0 4px 4px 0; } .hbar .fill { height: 100%; background: var(--water); border-radius: 0 4px 4px 0; min-width: 2px; }
@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; } .side { position: static; height: auto; display: flex; flex-direction: column; }
  .side nav { display: flex; overflow-x: auto; gap: 4px; } .side nav button { white-space: nowrap; width: auto; }
  .grid2, .grid2b { grid-template-columns: 1fr; } .main { padding: 16px; }
}
