:root {
  --orange: #F5A300;
  --orange-dark: #D98E00;
  --orange-soft: #FFF4DB;
  --ink: #312B2B;
  --muted: #7A7272;
  --line: #EEE8E1;
  --bg: #FAF7F2;
  --card: #FFFFFF;
  --ok: #1F9D55;
  --warn: #E5484D;
  --night: #1E1B1B;
  --night-2: #2A2626;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 600px at 80% -10%, #FFE3A3 0%, transparent 60%), #F3EEE6;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }

/* ---------- Mise en page desktop : pitch + téléphone ---------- */
.stage {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center; gap: 72px;
  padding: 72px 24px 40px;
}
.pitch { max-width: 400px; }
.pitch-kicker { color: var(--orange-dark); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: 13px; margin: 0 0 12px; }
.pitch h1 { font-size: 34px; line-height: 1.15; margin: 0 0 24px; letter-spacing: -.02em; }
.pitch ol { padding-left: 20px; margin: 0 0 24px; line-height: 1.9; font-size: 16px; }
.pitch-note { color: var(--muted); font-size: 14px; line-height: 1.5; }

.phone {
  position: relative; flex: none;
  width: 390px; height: 800px;
  border-radius: 54px; padding: 12px;
  background: #111; box-shadow: 0 40px 80px rgba(49, 43, 43, .25), inset 0 0 0 2px #333;
}
.notch { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); width: 120px; height: 32px; border-radius: 20px; background: #000; z-index: 20; }
.screen {
  position: relative; width: 100%; height: 100%;
  border-radius: 42px; overflow: hidden; background: var(--bg);
}

/* Sur téléphone : plein écran, sans cadre */
@media (max-width: 760px) {
  body { background: var(--bg); }
  .stage { padding: 0; display: block; }
  .pitch { display: none; }
  .phone { width: 100%; height: 100dvh; border-radius: 0; padding: 0; background: none; box-shadow: none; }
  .notch, .statusbar { display: none; }
  .screen { border-radius: 0; }
  .view { top: env(safe-area-inset-top); }
}

.statusbar { position: absolute; top: 0; left: 0; right: 0; height: 50px; display: flex; justify-content: space-between; align-items: center; padding: 6px 32px 0; font-weight: 700; font-size: 15px; z-index: 15; }
.sb-icons { font-size: 11px; letter-spacing: 2px; }

/* ---------- Vues ---------- */
.view {
  position: absolute; inset: 50px 0 0 0;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none; transform: translateX(24px);
  transition: opacity .28s ease, transform .28s ease;
  background: var(--bg);
}
.view.active { opacity: 1; pointer-events: auto; transform: none; }
.view.leaving { transform: translateX(-24px); }
.scroll { flex: 1; overflow-y: auto; padding: 4px 20px 110px; scrollbar-width: none; }
.scroll::-webkit-scrollbar { display: none; }
.scroll.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding-bottom: 40px; }

.topbar { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; padding: 8px 16px 12px; min-height: 56px; }
.topbar:has(.logo) { grid-template-columns: 1fr 40px; }
.topbar.dark { background: var(--night); color: #fff; }
.topbar-title { text-align: center; font-weight: 700; font-size: 16px; }
.logo { font-weight: 800; font-size: 22px; letter-spacing: -.03em; }
.logo span { color: var(--orange); }
.logo.light { color: #fff; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.logo .tag { font-size: 11px; font-weight: 700; background: var(--orange); color: var(--night); border-radius: 6px; padding: 3px 7px; letter-spacing: 0; }
.back { width: 40px; height: 40px; border-radius: 12px; background: var(--card); font-size: 18px; box-shadow: 0 1px 0 var(--line); }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 12px; background: var(--card); display: grid; place-items: center; font-size: 17px; }
.icon-btn.ghost { background: none; }
.icon-btn .dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); border: 2px solid var(--card); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--orange); color: var(--night); display: grid; place-items: center; font-weight: 800; font-size: 13px; }

.section-title { font-weight: 700; font-size: 15px; margin: 22px 0 10px; }
.section-title small { font-weight: 500; color: var(--muted); }
.section-title.light small { color: #A8A0A0; }
.muted { color: var(--muted); line-height: 1.5; }
.small { font-size: 13px; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 0 var(--line); }

/* ---------- Accueil ---------- */
.hello { font-size: 26px; line-height: 1.2; margin: 6px 0 16px; letter-spacing: -.02em; }
.hello span { font-size: 16px; font-weight: 500; color: var(--muted); }
.search {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--card); border: 2px solid var(--orange); border-radius: 16px; padding: 12px 14px;
  font-weight: 600; font-size: 15px; box-shadow: 0 8px 20px rgba(245, 163, 0, .18);
}
.search small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.search > span:nth-child(2) { flex: 1; }
.search-pin { font-size: 20px; }
.search-go { width: 36px; height: 36px; border-radius: 10px; background: var(--ink); color: #fff; display: grid; place-items: center; }
.promo { margin-top: 14px; border-radius: 16px; padding: 14px 16px; background: var(--ink); color: #fff; display: flex; flex-direction: column; gap: 2px; }
.promo b { color: var(--orange); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.promo span { font-size: 17px; font-weight: 700; }

.map { position: relative; height: 170px; border-radius: 16px; overflow: hidden; background: #EAF2F6; }
.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pin { position: absolute; transform: translate(-50%, -100%); width: 22px; height: 22px; border-radius: 50% 50% 50% 0; rotate: -45deg; background: var(--ink); border: 2px solid #fff; }
.pin.main { background: var(--orange); width: 28px; height: 28px; z-index: 2; animation: bounce 1.6s ease-in-out infinite; }
@keyframes bounce { 50% { translate: 0 -4px; } }

.centres { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.centres li { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: 0 1px 0 var(--line); cursor: pointer; }
.centres li b { display: block; font-size: 15px; }
.centres li small { color: var(--muted); font-size: 12.5px; }
.centres li div { flex: 1; }
.centres li .km { font-weight: 700; font-size: 13px; color: var(--orange-dark); }
.centres li.featured { outline: 2px solid var(--orange); }

/* ---------- Centre ---------- */
.hero { position: relative; border-radius: 18px; overflow: hidden; height: 150px; }
.hero-img {
  height: 100%;
  background:
    linear-gradient(180deg, transparent 40%, rgba(0,0,0,.55)),
    repeating-linear-gradient(90deg, #F5A300 0 46px, #E89A00 46px 50px, #F5A300 50px 96px, #3A3434 96px 100px),
    #F5A300;
  display: flex; align-items: flex-end; padding: 14px; color: #fff; font-weight: 700;
}
.hero-tags { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.hero-tags span { background: rgba(255,255,255,.95); border-radius: 8px; padding: 4px 8px; font-size: 12px; font-weight: 700; }
.perks { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.perks li { background: var(--card); border-radius: 12px; padding: 10px; font-size: 13px; display: flex; gap: 8px; align-items: center; font-weight: 600; box-shadow: 0 1px 0 var(--line); }
.helper { width: 100%; margin-top: 14px; display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--orange-soft); text-align: left; font-size: 22px; }
.helper span { flex: 1; font-size: 15px; }
.helper small { display: block; color: var(--muted); font-size: 12.5px; }
.helper em { font-style: normal; font-size: 18px; font-weight: 700; }

.box { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; background: var(--card); border-radius: 16px; padding: 14px; margin-bottom: 10px; box-shadow: 0 1px 0 var(--line); border: 2px solid transparent; transition: border-color .2s; }
.box.reco { border-color: var(--orange); position: relative; }
.box.reco::before { content: "Recommandé pour vous"; position: absolute; top: -10px; left: 14px; background: var(--orange); color: var(--night); font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 6px; }
.box-size { width: 56px; height: 56px; border-radius: 12px; background: var(--orange-soft); display: grid; place-items: center; font-weight: 800; font-size: 16px; color: var(--orange-dark); }
.box-info b { font-size: 15px; }
.box-info small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; }
.box-info .limited { color: var(--warn); font-weight: 700; }
.box-price { text-align: right; }
.box-price s { color: var(--muted); font-size: 12px; }
.box-price b { display: block; font-size: 17px; }
.box-price button { margin-top: 6px; background: var(--orange); color: #fff; font-weight: 700; font-size: 13px; padding: 7px 12px; border-radius: 10px; }

/* ---------- Assistant ---------- */
.progress { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; margin: 6px 0 20px; }
.progress i { display: block; height: 100%; width: 0; background: var(--orange); transition: width .35s ease; }
.q h3 { font-size: 22px; line-height: 1.25; margin: 0 0 18px; letter-spacing: -.01em; }
.q .opts { display: flex; flex-direction: column; gap: 10px; }
.q .opt { text-align: left; padding: 16px; border-radius: 14px; background: var(--card); box-shadow: 0 1px 0 var(--line); font-weight: 600; font-size: 15px; display: flex; gap: 12px; align-items: center; border: 2px solid transparent; }
.q .opt:active, .q .opt.picked { border-color: var(--orange); }
.q .opt span { font-size: 22px; }
.result { text-align: center; padding-top: 10px; }
.result .big { width: 120px; height: 120px; margin: 0 auto 16px; border-radius: 28px; background: var(--orange); color: #fff; display: grid; place-items: center; font-size: 34px; font-weight: 800; box-shadow: 0 16px 30px rgba(245, 163, 0, .35); }
.result h3 { margin: 0 0 6px; font-size: 22px; }
.result p { margin: 0 0 22px; }

/* ---------- Paiement ---------- */
.recap { display: flex; gap: 14px; align-items: center; }
.recap .box-size { flex: none; }
.recap b { font-size: 16px; }
.recap small { display: block; color: var(--muted); font-size: 13px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips.wrap { flex-wrap: wrap; }
.chip { flex: none; padding: 10px 14px; border-radius: 12px; background: var(--card); font-weight: 600; font-size: 14px; box-shadow: 0 1px 0 var(--line); border: 2px solid transparent; }
.chip.on { border-color: var(--orange); background: var(--orange-soft); }
.lines { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.lines div { display: flex; justify-content: space-between; }
.lines .disc { color: var(--ok); font-weight: 600; }
.lines .total { border-top: 1px dashed var(--line); padding-top: 10px; font-weight: 800; font-size: 17px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; font-size: 13px; color: var(--muted); line-height: 1.4; }
.check input { accent-color: var(--orange); width: 18px; height: 18px; margin: 0; }

.bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 20px 30px; background: linear-gradient(180deg, transparent, var(--bg) 30%); z-index: 5; }
.primary, .pay { width: 100%; height: 54px; border-radius: 16px; font-weight: 700; font-size: 16px; }
.primary { background: var(--orange); color: #fff; box-shadow: 0 10px 20px rgba(245, 163, 0, .3); }
.pay { background: #000; color: #fff; display: flex; align-items: center; justify-content: center; gap: 8px; }
.pay.loading { opacity: .85; }
.pay.loading::after { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.success { width: 96px; height: 96px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 48px; display: grid; place-items: center; margin-bottom: 18px; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
.done-card { width: 100%; margin: 18px 0 22px; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.done-card div, .next div { display: flex; justify-content: space-between; font-size: 14px; }
.done-card small, .next small { color: var(--muted); }

/* ---------- Mon box ---------- */
.keycard { border-radius: 22px; padding: 18px; background: linear-gradient(160deg, #3A3434, var(--night)); color: #fff; text-align: center; }
.keycard-top { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 15px; text-align: left; }
.pill-ok { font-size: 11px; background: rgba(31, 157, 85, .2); color: #6EE7A0; padding: 4px 8px; border-radius: 20px; }
.keycard-site { text-align: left; color: #B9B0B0; font-size: 13px; margin-top: 2px; }
.hold { position: relative; width: 170px; height: 170px; margin: 18px auto 12px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle, #F5A300 0 52%, rgba(245, 163, 0, .12) 53%); color: var(--night); user-select: none; -webkit-user-select: none; touch-action: none; }
.hold svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,.08); stroke-width: 6; }
.ring { fill: none; stroke: #fff; stroke-width: 6; stroke-linecap: round; stroke-dasharray: 339.3; stroke-dashoffset: 339.3; }
.hold-label { position: relative; font-size: 13px; line-height: 1.3; }
.hold-label b { font-size: 15px; }
.hold.opened { background: radial-gradient(circle, var(--ok) 0 52%, rgba(31, 157, 85, .15) 53%); color: #fff; }
.keycard-code { font-size: 12.5px; color: #B9B0B0; }
.keycard-code b { color: #fff; letter-spacing: .1em; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.tile { background: var(--card); border-radius: 16px; padding: 14px; text-align: left; font-size: 22px; box-shadow: 0 1px 0 var(--line); display: flex; flex-direction: column; gap: 2px; }
.tile b { font-size: 15px; margin-top: 6px; }
.tile small { font-size: 12.5px; color: var(--muted); }
.next { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }

/* ---------- Signalement ---------- */
.photo { width: 100%; height: 170px; border-radius: 18px; border: 2px dashed #D9CFC3; background: var(--card); font-weight: 700; font-size: 15px; color: var(--muted); overflow: hidden; }
.photo.taken {
  border: 0; color: #fff; display: flex; align-items: flex-end; padding: 12px; font-size: 13px;
  background:
    linear-gradient(180deg, transparent 50%, rgba(0,0,0,.6)),
    repeating-linear-gradient(90deg, #8A8F96 0 6px, #6B7078 6px 9px),
    #888;
}
.note { width: 100%; margin-top: 14px; border: 0; border-radius: 14px; padding: 14px; font: inherit; font-size: 14px; background: var(--card); box-shadow: 0 1px 0 var(--line); resize: none; color: var(--ink); }

/* ---------- Notifications ---------- */
.notifs { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.notifs li { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border-radius: 14px; padding: 14px; box-shadow: 0 1px 0 var(--line); }
.notifs li > span { font-size: 20px; }
.notifs li div { flex: 1; }
.notifs b { display: block; font-size: 14.5px; }
.notifs small { color: var(--muted); font-size: 12.5px; }
.notifs time { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* ---------- Exploitant ---------- */
[data-view="admin"] { background: var(--night); color: #fff; }
.admin { padding-top: 12px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpis div { background: var(--night-2); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; }
.kpis small { color: #A8A0A0; font-size: 12px; }
.kpis b { font-size: 26px; margin: 4px 0 2px; letter-spacing: -.02em; }
.kpis em { font-style: normal; font-size: 11.5px; color: #A8A0A0; }
.kpis em.up { color: #6EE7A0; }
.kpis em.warn { color: #FF9A9E; }
.incidents { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.incidents li { display: flex; gap: 12px; align-items: center; background: var(--night-2); border-radius: 14px; padding: 12px 14px; }
.incidents li.fresh { outline: 2px solid var(--orange); animation: pop .5s ease; }
.incidents .ico { font-size: 20px; }
.incidents div { flex: 1; }
.incidents b { display: block; font-size: 14px; }
.incidents small { color: #A8A0A0; font-size: 12px; }
.incidents button { background: var(--orange); color: var(--night); font-weight: 700; font-size: 12px; padding: 7px 10px; border-radius: 9px; }
.incidents li.assigned button { background: #3A3434; color: #6EE7A0; }
.sites { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.sites li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13.5px; }
.sites .bar { grid-column: 1 / -1; height: 8px; background: var(--night-2); border-radius: 8px; overflow: hidden; }
.sites .bar i { display: block; height: 100%; border-radius: 8px; background: var(--orange); width: 0; transition: width .9s cubic-bezier(.2, .8, .2, 1); }
.sites li.low .bar i { background: #FF9A9E; }
.sites li span:last-of-type { font-weight: 700; }
.insight { margin-top: 18px; display: flex; gap: 10px; align-items: flex-start; background: rgba(245, 163, 0, .12); border: 1px solid rgba(245, 163, 0, .35); border-radius: 16px; padding: 14px; font-size: 13.5px; line-height: 1.45; }
.insight span { flex: 1; }
.insight button { background: var(--orange); color: var(--night); font-weight: 700; font-size: 12px; padding: 8px 10px; border-radius: 9px; align-self: center; }

/* ---------- Barre d'onglets, toast, notification push ---------- */
.tabbar {
  position: absolute; left: 12px; right: 12px; bottom: 14px; z-index: 10;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: rgba(255,255,255,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: 22px; padding: 8px; box-shadow: 0 10px 30px rgba(49, 43, 43, .15);
  transition: transform .3s ease, opacity .3s ease;
}
.tabbar.hidden { transform: translateY(120%); opacity: 0; pointer-events: none; }
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 6px 0; border-radius: 14px; }
.tabbar button span { font-size: 19px; filter: grayscale(1); opacity: .6; }
.tabbar button.on { color: var(--ink); background: var(--orange-soft); }
.tabbar button.on span { filter: none; opacity: 1; }
.tabbar.on-dark { background: rgba(42, 38, 38, .92); }
.tabbar.on-dark button.on { background: rgba(245, 163, 0, .18); color: #fff; }

.toast {
  position: absolute; left: 20px; right: 20px; bottom: 100px; z-index: 30;
  background: var(--ink); color: #fff; border-radius: 14px; padding: 14px 16px; font-size: 14px; line-height: 1.4;
  opacity: 0; transform: translateY(10px); transition: all .25s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.push {
  position: absolute; left: 10px; right: 10px; top: 54px; z-index: 40;
  background: rgba(255,255,255,.96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: 18px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.18);
  display: flex; flex-direction: column; gap: 2px; font-size: 13.5px;
  transform: translateY(-200px); visibility: hidden;
  transition: transform .4s cubic-bezier(.2, 1.2, .4, 1), visibility 0s .4s;
}
.push b { font-size: 12px; color: var(--orange-dark); }
.push.show { transform: none; visibility: visible; transition: transform .4s cubic-bezier(.2, 1.2, .4, 1); }
@media (max-width: 760px) {
  .push { top: calc(env(safe-area-inset-top) + 8px); }
  /* Le bandeau Grafen (ajouté par le Worker) occupe le bas de l'écran sur téléphone. */
  .tabbar { bottom: 70px; }
  .bottom { padding-bottom: 76px; }
  .toast { bottom: 156px; }
  .scroll { padding-bottom: 170px; }
}
