:root {
  --bg: #0b0b0b; --panel: #151515; --panel2: #1c1c1c; --line: #2a2a2a;
  --text: #f4f1ea; --muted: #9a968c; --accent: #D9B26A; --ok: #7fdc8f; --err: #ff8a80;
  --radius: 18px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif; background: var(--bg); color: var(--text);
  display: flex; justify-content: center; padding: 16px; min-height: 100vh; }
main { width: 100%; max-width: 440px; }
main.wide { max-width: 980px; }
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
p { line-height: 1.5; }
a { color: var(--accent); }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 12px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1 1 auto; }
.spacer { height: 12px; }
.hidden, [hidden] { display: none !important; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 12px 0; }
.card.flat { background: var(--panel2); }

input, select, textarea { width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid #333; background: #101010;
  color: inherit; font-size: 16px; margin: 6px 0; font-family: inherit; }
input[type=color] { padding: 4px; height: 48px; }
input[type=checkbox] { width: auto; margin: 3px 0 0; accent-color: var(--accent); }
label.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: #bdb8ad; margin: 8px 0; line-height: 1.45; }
label.field { display: block; font-size: 13px; color: var(--muted); margin-top: 10px; }

button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 14px; border-radius: 12px;
  border: 0; background: var(--accent); color: #111; font-weight: 700; font-size: 16px; margin: 6px 0; cursor: pointer;
  text-decoration: none; font-family: inherit; }
button:disabled { opacity: .55; cursor: default; }
button.sec, .btn.sec { background: #242424; color: var(--text); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.danger { background: #3a1d1d; color: var(--err); }
button.mini { width: auto; padding: 8px 12px; font-size: 14px; margin: 0; }

/* Carte client */
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; background: #222; flex: none; }
.logo.ph { display: flex; align-items: center; justify-content: center; font-weight: 800; color: #111; background: var(--accent); font-size: 22px; }
.points { font-size: 44px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.points small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.stamps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 14px 0 8px; }
.stamp { aspect-ratio: 1; border-radius: 50%; border: 2px solid #3a3a3a; }
.stamp.on { background: var(--accent); border-color: var(--accent); }
.qrbox { background: #fff; padding: 12px; border-radius: 14px; display: inline-block; line-height: 0; }
.qrbar { height: 4px; background: #2a2a2a; border-radius: 4px; overflow: hidden; margin: 10px auto 0; max-width: 220px; }
.qrbar > div { height: 100%; background: var(--accent); width: 100%; transition: width 1s linear; }
.code { font-family: ui-monospace, Menlo, monospace; letter-spacing: .12em; font-weight: 700; }
.reward { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.reward:last-child { border-bottom: 0; }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: #262626; color: var(--muted); white-space: nowrap; }
.pill.on { background: var(--accent); color: #111; font-weight: 700; }
.pill.ok { background: #1d3a24; color: var(--ok); }
.pill.err { background: #3a1d1d; color: var(--err); }

/* Espace pro */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 6px 0 4px; padding-bottom: 4px; scrollbar-width: none; }
.tabs button { width: auto; flex: none; background: #1a1a1a; color: var(--muted); font-weight: 600; padding: 10px 14px; font-size: 14px; margin: 0; }
.tabs button.active { background: var(--accent); color: #111; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.kpi { background: var(--panel2); border-radius: 14px; padding: 14px; }
.kpi b { display: block; font-size: 26px; letter-spacing: -.02em; }
.kpi span { font-size: 12px; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; margin-top: 10px; }
.bars div { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars-x { display: flex; gap: 4px; font-size: 10px; color: var(--muted); margin-top: 4px; }
.bars-x span { flex: 1; text-align: center; overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.scroll { overflow-x: auto; }
.result { border-radius: 14px; padding: 16px; margin-top: 10px; }
.result.ok { background: #14301b; border: 1px solid #275c34; }
.result.err { background: #331616; border: 1px solid #6b2a2a; }
.result.wait { background: #2b2614; border: 1px solid #5c5227; }
.result b { font-size: 20px; }
#reader { width: 100%; border-radius: 14px; overflow: hidden; margin-top: 8px; }
#reader video { border-radius: 14px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg button { background: #1e1e1e; color: var(--muted); font-size: 14px; padding: 12px 6px; margin: 0; }
.seg button.active { background: var(--accent); color: #111; }
.banner { background: #2b2614; color: #f0d88a; border-radius: 12px; padding: 10px 14px; font-size: 14px; margin: 8px 0; }
.qty { display: flex; align-items: center; gap: 10px; }
.qty button { width: 48px; margin: 0; }
.qty b { min-width: 40px; text-align: center; font-size: 20px; }
ul.advice { padding-left: 18px; margin: 0; }
ul.advice li { margin: 8px 0; line-height: 1.45; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(40px); background: #222; color: var(--text);
  padding: 12px 18px; border-radius: 12px; opacity: 0; transition: .25s; pointer-events: none; z-index: 99; max-width: 90vw; font-size: 14px; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok { background: #1d3a24; color: var(--ok); }
#toast.err { background: #3a1d1d; color: var(--err); }

@media (min-width: 900px) {
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .grid2 > .card { margin: 0; }
}
