/* ─── Charte inspirée de fibre.mtn.ci ───────────────────────
   jaune MTN #ffcb05 (bg-main), noir, fond #f8f8f6, cartes blanches
   arrondies, MTN Brighter Sans pour les titres, Inter pour le texte. */
@font-face { font-family: 'MTNBrighterSans'; font-weight: 300; src: url('/assets/fonts/MTNBrighterSans-Light.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'MTNBrighterSans'; font-weight: 400; src: url('/assets/fonts/MTNBrighterSans-Regular.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'MTNBrighterSans'; font-weight: 500; src: url('/assets/fonts/MTNBrighterSans-Medium.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'MTNBrighterSans'; font-weight: 700; src: url('/assets/fonts/MTNBrighterSans-Bold.woff') format('woff'); font-display: swap; }

:root {
  --main: #ffcb05;
  --main-dark: #e6b600;
  --main-soft: #fff6cc;
  --black: #000;
  --ink: #111827;
  --text: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f8f8f6;
  --card: #fff;
  --green: #22c55e; --green-soft: #f0fdf4; --green-line: #86efac;
  --red: #ef4444;   --red-soft: #fef2f2;   --red-line: #fca5a5;
  --cyan: #06b6d4;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; }
a { color: inherit; }
.font-mtn { font-family: 'MTNBrighterSans', 'Inter', sans-serif; letter-spacing: -.01em; }
.muted { color: var(--muted); font-size: 13px; }
[hidden] { display: none !important; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* ── Header ── */
.topbar { background: var(--main); border-bottom: 1px solid rgba(0,0,0,.06); }
.topbar__in { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand__logo { width: 46px; height: 46px; border-radius: 12px; background: #fff; display: grid; place-items: center; box-shadow: var(--shadow); overflow: hidden; }
.brand__logo img { width: 46px; height: 46px; display: block; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-weight: 700; font-size: 18px; }
.brand__sub { font-size: 12px; color: #4b5563; }
.topnav { display: none; gap: 20px; font-size: 13px; color: var(--ink); }
.topnav a { text-decoration: none; }
.topnav a:hover { text-decoration: underline; }
.topnav__cgu { font-size: 11px; text-decoration: underline !important; opacity: .75; }
@media (min-width: 760px) { .topnav { display: flex; align-items: center; } }

/* ── Page ── */
.page { padding: 20px 16px 40px; }
.layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.main, .side { min-width: 0; }
@media (min-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ── Stepper ── */
.stepper { display: flex; list-style: none; margin: 0 0 20px; padding: 0; gap: 4px; counter-reset: s; }
.stepper li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; min-width: 0; }
.stepper li::before { content: ''; position: absolute; top: 14px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.stepper li:first-child::before { display: none; }
.stepper__dot { z-index: 1; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); }
.stepper__label { font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.stepper li.is-done .stepper__dot { background: var(--main); border-color: var(--main); color: #000; }
.stepper li.is-done::before { background: var(--main); }
.stepper li.is-active .stepper__dot { border-color: #000; background: #000; color: #fff; }
.stepper li.is-active .stepper__label, .stepper li.is-done .stepper__label { color: var(--ink); font-weight: 600; }
@media (min-width: 560px) { .stepper__label { font-size: 12px; } }

/* ── Hero / accueil ── */
.hero { overflow: hidden; display: grid; grid-template-columns: 1fr; }
.hero__media { min-height: 180px; background: url('/assets/bg.jpg') center 20% / cover no-repeat; }
.hero__body { padding: 22px 20px 24px; }
.hero h1 { margin: 0 0 8px; font-size: 32px; line-height: 1.05; font-weight: 700; color: var(--ink); }
.lead { margin: 0 0 18px; color: var(--text); }
@media (min-width: 760px) { .hero { grid-template-columns: 300px 1fr; } .hero__media { min-height: 100%; } .hero__body { padding: 28px; } .hero h1 { font-size: 38px; } }

/* ── Formulaires ── */
.form { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink); }
.field em { font-weight: 400; color: var(--muted); font-style: normal; }
.field input[type=text], .field input[type=tel], .composer input, .map__q {
  width: 100%; height: 44px; padding: 0 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font: inherit; color: var(--ink); outline: none; transition: border-color .15s;
}
.field input:focus, .composer input:focus, .map__q:focus { border-color: var(--main); }
.form__error { margin: 0; color: var(--red); font-size: 13px; }
.form__hint { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

/* ── Boutons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 10px; border: 0; font: inherit; font-weight: 600; cursor: pointer; transition: transform .05s, background .15s, opacity .15s; text-decoration: none; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--main); color: #000; }
.btn--primary:hover:not(:disabled) { background: var(--main-dark); }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover:not(:disabled) { background: #000; }
.btn--ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn--sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn--block { width: 100%; }

/* ── Chat ── */
.chat { display: flex; flex-direction: column; min-height: 520px; overflow: hidden; }
.chat__head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.chat__head > div { flex: 1; min-width: 0; }
.chat__avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--main); display: grid; place-items: center; }
.chat__avatar img { width: 40px; height: 40px; }
.chat__title { font-weight: 700; font-size: 16px; color: var(--ink); }
.chat__status { font-size: 12px; color: var(--green); }
.chat__status.is-busy { color: var(--muted); }
.chat__log { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); overflow-y: auto; max-height: 62vh; }

.msg { display: flex; flex-direction: column; gap: 8px; max-width: 92%; min-width: 0; }
.msg--bot { align-self: flex-start; }
.msg--user { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 12px 14px; border-radius: 16px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.msg--bot .bubble { background: #fff; color: var(--ink); border-bottom-left-radius: 6px; box-shadow: var(--shadow); }
.msg--user .bubble { background: var(--ink); color: #fff; border-bottom-right-radius: 6px; }
.bubble__header { font-family: 'MTNBrighterSans', sans-serif; font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.bubble__footer { margin-top: 8px; font-size: 12px; color: var(--muted); }
.msg time { font-size: 11px; color: var(--muted); padding: 0 4px; }

.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opts .btn { height: 40px; }
.msg.is-old .opts .btn, .msg.is-old .list__row, .msg.is-old .map { opacity: .55; pointer-events: none; }

.list { display: grid; gap: 8px; width: 100%; }
.list__title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.list__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; background: #fff; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; font: inherit; color: var(--ink); transition: border-color .15s, background .15s; }
.list__row:hover { border-color: var(--main); background: var(--main-soft); }
.list__row strong { display: block; font-weight: 600; }
.list__row small { display: block; color: var(--muted); font-size: 12px; }
.list__row::after { content: '›'; font-size: 22px; color: var(--muted); }

.cta { display: grid; gap: 10px; }
.cta .btn { height: 46px; font-size: 15px; }

.eligibility { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; font-weight: 600; }
.eligibility--ok { background: var(--green-soft); border: 1.5px solid var(--green-line); color: #15803d; }
.eligibility--ko { background: var(--red-soft); border: 1.5px solid var(--red-line); color: #b91c1c; }
.eligibility__dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 13px; }
.eligibility--ok .eligibility__dot { background: var(--green); }
.eligibility--ko .eligibility__dot { background: var(--red); }

/* ── Carte ── */
.map { display: grid; gap: 10px; width: 100%; }
.map__search { position: relative; }
.map__results { position: absolute; z-index: 1000; top: 46px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: 220px; overflow: auto; }
.map__results li { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.map__results li:hover { background: var(--main-soft); }
.map__canvas { height: 260px; border-radius: 12px; overflow: hidden; border: 2px solid var(--line); background: #e5e7eb; }
.map__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.map__actions .btn { flex: 1; min-width: 160px; white-space: normal; height: auto; min-height: 42px; padding: 8px 14px; line-height: 1.2; }
.leaflet-container { font: inherit; }

/* ── Composer / chips ── */
.composer { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: #fff; }
.composer input { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 14px; background: #fff; }
.chip { height: 30px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-size: 12px; color: var(--text); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.chip:hover { border-color: var(--main); background: var(--main-soft); }
.chip--wa { border-color: #25d366; color: #128c7e; font-weight: 600; }

/* ── Colonne latérale ── */
.side { display: grid; gap: 16px; }
.recap { padding: 18px; }
.recap h3, .help h3 { margin: 0 0 10px; font-size: 18px; color: var(--ink); }
.recap dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; }
.recap dt { color: var(--muted); }
.recap dd { margin: 0; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.recap .total { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); display: flex; justify-content: space-between; font-weight: 700; color: var(--ink); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge--ok { background: var(--green-soft); color: #15803d; }
.badge--ko { background: var(--red-soft); color: #b91c1c; }
.badge--paid { background: var(--main-soft); color: #92400e; }
.help { padding: 18px; font-size: 14px; }
.help p { margin: 0 0 8px; }

/* ── Footer ── */
.footer { border-top: 1px solid var(--line); background: #fff; margin-top: 20px; }
.footer__in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 14px 16px; font-size: 12px; color: var(--muted); }
.footer a { text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ── Typing ── */
.typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: #9ca3af; animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3 } 40% { opacity: 1 } }
