:root {
  --bg: #0b0f1a;
  --bg-soft: #121829;
  --card: #161d30;
  --card-2: #1b2338;
  --border: #243048;
  --text: #e8edf7;
  --muted: #8c99b5;
  --brand: #5b8cff;
  --brand-2: #8f5bff;
  --green: #2dd4a7;
  --amber: #f5b945;
  --red: #ff6b7a;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0,0,0,.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(91,140,255,.18), transparent 60%),
              radial-gradient(900px 500px at 0% 10%, rgba(143,91,255,.14), transparent 55%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }

/* ---------- Layout ---------- */
.container { max-width: 1160px; margin: 0 auto; padding: 0 22px; }

.nav {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(14px);
  background: rgba(11,15,26,.72);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.3px; }
.brand .dot {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; font-size: 16px; box-shadow: 0 6px 18px rgba(91,140,255,.45);
}
.brand small { color: var(--muted); font-weight: 500; font-size: 12px; }
.brand-logo { width: 32px; height: 32px; display: block; border-radius: 9px; box-shadow: 0 6px 18px rgba(124,92,255,.40); flex-shrink: 0; }
.nav-actions { display: flex; align-items: center; gap: 12px; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--border); background: var(--card-2); color: var(--text);
  padding: 10px 16px; border-radius: 11px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: .15s; display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { border-color: var(--brand); transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border: none; color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; justify-content: center; padding: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------- Hero ---------- */
.hero { padding: 70px 0 30px; text-align: center; }
.hero h1 { font-size: clamp(32px, 5vw, 54px); font-weight: 800; letter-spacing: -1.5px; line-height: 1.05; }
.hero h1 span { background: linear-gradient(120deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); max-width: 560px; margin: 16px auto 0; font-size: 17px; }
.pill { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); border: 1px solid var(--border); background: var(--card); padding: 6px 14px; border-radius: 999px; margin-bottom: 20px; }
.pill .live { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(45,212,167,.2); }

/* ---------- Boutique (layout 2 colonnes) ---------- */
.shop-layout { display: grid; grid-template-columns: 340px 1fr; gap: 34px; padding: 44px 0 10px; align-items: start; }
.shop-aside { position: sticky; top: 90px; }
.shop-aside h1 { font-size: clamp(30px, 4vw, 42px); font-weight: 800; letter-spacing: -1.4px; line-height: 1.05; margin-top: 16px; }
.shop-aside h1 span { color: var(--brand); }
.shop-aside > p { color: var(--muted); margin: 14px 0 22px; font-size: 15px; }
.steps-list { display: flex; flex-direction: column; gap: 10px; }
.step-chip { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; font-size: 14px; font-weight: 500; }
.sc-num { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.guide { margin-top: 18px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 4px 14px; }
.guide summary { cursor: pointer; padding: 12px 0; font-size: 14px; font-weight: 600; list-style: none; }
.guide summary::-webkit-details-marker { display: none; }
.guide p { color: var(--muted); font-size: 13.5px; padding: 0 0 14px; }

.shop-head { display: flex; align-items: center; gap: 12px; }
.shop-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.source-badge { font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 999px; }
.source-badge.live { background: rgba(45,212,167,.14); color: var(--green); }
.source-badge.demo { background: rgba(245,185,69,.14); color: var(--amber); }
.shop-sub { color: var(--muted); margin: 6px 0 20px; font-size: 14px; }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.fcard {
  text-align: left; background: var(--card); border: 1px solid var(--border); border-radius: 15px;
  padding: 16px 16px 14px; cursor: pointer; transition: .16s; position: relative; color: var(--text); font: inherit;
  display: flex; flex-direction: column; gap: 2px;
}
.fcard:hover { border-color: var(--brand); transform: translateY(-3px); box-shadow: var(--shadow); }
.fcard.pop { border-color: var(--brand); }
.fcard-pop { position: absolute; top: -10px; right: 12px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.fcard-vol { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.fcard-name { font-size: 17px; font-weight: 700; letter-spacing: -.2px; margin-top: 2px; }
.fcard-dur { font-size: 13px; color: var(--muted); margin: 2px 0 14px; display: flex; align-items: center; gap: 6px; }
.fcard-dur .night { background: rgba(143,91,255,.16); color: var(--brand-2); font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px; }
.fcard-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.fcard-price { font-size: 20px; font-weight: 800; letter-spacing: -.5px; }
.fcard-price small { font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 3px; }
.fcard-free { font-size: 18px; font-weight: 800; color: var(--green); }
.fcard-cta { font-size: 12.5px; font-weight: 700; color: var(--brand); background: rgba(91,140,255,.12); padding: 6px 11px; border-radius: 9px; white-space: nowrap; }
.fcard:hover .fcard-cta { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }

@media (max-width: 820px) {
  .shop-layout { grid-template-columns: 1fr; gap: 22px; padding-top: 26px; }
  .shop-aside { position: static; }
}

/* ---------- Cards / shop (ancien, conservé) ---------- */
.section-title { font-size: 22px; font-weight: 700; margin: 36px 0 6px; letter-spacing: -.3px; }
.section-sub { color: var(--muted); margin-bottom: 22px; font-size: 14px; }

.grid { display: grid; gap: 18px; }
.plans { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

.plan-card {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 22px;
  position: relative; transition: .18s;
}
.plan-card:hover { border-color: var(--brand); transform: translateY(-4px); box-shadow: var(--shadow); }
.plan-card.popular { border-color: var(--brand); }
.tag-pop { position: absolute; top: -11px; right: 16px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.op { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.plan-card h3 { font-size: 19px; margin: 4px 0 2px; }
.data-big { font-size: 34px; font-weight: 800; letter-spacing: -1px; margin: 10px 0 2px; }
.data-big small { font-size: 14px; color: var(--muted); font-weight: 500; }
.valid { color: var(--muted); font-size: 13px; margin-bottom: 16px; display: flex; align-items: center; gap: 6px; }
.price-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.price { font-size: 24px; font-weight: 800; }
.price small { font-size: 13px; color: var(--muted); font-weight: 500; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(6,9,16,.72); backdrop-filter: blur(4px); display: none; place-items: center; z-index: 50; padding: 20px; }
.modal-bg.open { display: grid; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: 20px; width: 100%; max-width: 420px; padding: 30px; box-shadow: var(--shadow); animation: pop .22s ease; }
@keyframes pop { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal h2 { font-size: 22px; letter-spacing: -.4px; }
.modal .muted { color: var(--muted); font-size: 14px; margin: 4px 0 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
  padding: 12px 14px; border-radius: 11px; font-size: 15px; outline: none; transition: .15s;
}
.field input:focus, .field select:focus { border-color: var(--brand); }
.switch-line { text-align: center; color: var(--muted); font-size: 14px; margin-top: 16px; }
.switch-line a { color: var(--brand); font-weight: 600; cursor: pointer; }
.err { background: rgba(255,107,122,.12); border: 1px solid rgba(255,107,122,.4); color: var(--red); padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; display: none; }
.err.show { display: block; }
.ok-box { text-align: center; padding: 10px 0; }
.ok-box .circle { width: 64px; height: 64px; border-radius: 50%; background: rgba(45,212,167,.14); color: var(--green); display: grid; place-items: center; font-size: 30px; margin: 0 auto 14px; }

/* ---------- Avatar / menu ---------- */
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: grid; place-items: center; font-weight: 700; cursor: pointer; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip .uname { font-size: 14px; font-weight: 600; }
.user-chip .uname small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }

/* ---------- Orders table ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 14px 18px; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
td { padding: 14px 18px; border-bottom: 1px solid rgba(36,48,72,.5); }
tr:last-child td { border-bottom: none; }
.badge { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; display: inline-block; }
.badge.completé, .badge.complété { background: rgba(45,212,167,.14); color: var(--green); }
.badge.attente { background: rgba(245,185,69,.14); color: var(--amber); }
.badge.échoué { background: rgba(255,107,122,.14); color: var(--red); }

.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 50px 0 30px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--card-2); border: 1px solid var(--border); padding: 14px 22px; border-radius: 12px; box-shadow: var(--shadow); opacity: 0; transition: .25s; z-index: 80; font-size: 14px; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hidden, [hidden] { display: none !important; }

/* ---------- Admin ---------- */
.kpi-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 22px; }
.kpi { background: linear-gradient(180deg, var(--card), var(--bg-soft)); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.kpi .label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.kpi .val { font-size: 30px; font-weight: 800; letter-spacing: -1px; margin-top: 10px; }
.kpi .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; }
.ic.blue { background: rgba(91,140,255,.15); color: var(--brand); }
.ic.green { background: rgba(45,212,167,.15); color: var(--green); }
.ic.violet { background: rgba(143,91,255,.15); color: var(--brand-2); }
.ic.amber { background: rgba(245,185,69,.15); color: var(--amber); }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.panel h3 { font-size: 16px; margin-bottom: 4px; }
.panel .sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.charts { grid-template-columns: 1.6fr 1fr; align-items: start; }
.two-col { grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .charts, .two-col { grid-template-columns: 1fr; } }

.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 14px; }
.bar-row .n { width: 120px; color: var(--text); }
.bar-track { flex: 1; height: 10px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 999px; }
.bar-row .v { width: 90px; text-align: right; color: var(--muted); }

.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab { padding: 8px 16px; border-radius: 10px; cursor: pointer; font-size: 14px; color: var(--muted); border: 1px solid transparent; }
.tab.active { background: var(--card); border-color: var(--border); color: var(--text); }

/* ================= ADMIN CONSOLE (sidebar layout) ================= */
.admin-body { display: flex; min-height: 100vh; }

/* Écran de connexion admin */
.login-screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; z-index: 60;
  background: radial-gradient(1000px 500px at 70% -10%, rgba(91,140,255,.18), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.login-card h2 { font-size: 22px; letter-spacing: -.4px; }
.login-screen[hidden], .sidebar[hidden], .admin-main[hidden] { display: none !important; }

.sidebar {
  width: 250px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  background: var(--bg-soft); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px; z-index: 40;
}
.sb-brand { margin: 6px 8px 22px; font-size: 18px; }
.sb-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sb-group { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin: 16px 10px 6px; }
.sb-link {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 11px;
  color: var(--muted); font-size: 14.5px; font-weight: 500; cursor: pointer; transition: .15s;
}
.sb-link:hover { background: var(--card); color: var(--text); }
.sb-link.active { background: linear-gradient(135deg, rgba(91,140,255,.18), rgba(143,91,255,.14)); color: var(--text); font-weight: 600; }
.sb-ic { width: 22px; text-align: center; font-size: 15px; }
.sb-foot { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 10px; }
.sb-foot .user-chip { padding: 0 6px; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 18px 30px; background: rgba(11,15,26,.8); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.page-sub { color: var(--muted); font-size: 13px; }
.admin-content { padding: 26px 30px 60px; }
.view { display: grid; gap: 18px; }
.view[hidden] { display: none; }

.icon-btn { display: none; background: var(--card-2); border: 1px solid var(--border); color: var(--text); width: 40px; height: 40px; border-radius: 10px; cursor: pointer; font-size: 18px; }
.sb-backdrop { display: none; position: fixed; inset: 0; background: rgba(6,9,16,.6); z-index: 35; }

/* Role split bars */
.role-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.role-row .rn { width: 130px; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.role-dot { width: 11px; height: 11px; border-radius: 3px; }

/* Integrations */
.int-item { border: 1px solid var(--border); border-radius: 13px; padding: 16px; margin-bottom: 12px; background: var(--bg-soft); }
.int-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.int-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.int-key { font-family: ui-monospace, monospace; background: var(--bg); border: 1px solid var(--border); padding: 7px 10px; border-radius: 9px; font-size: 13px; color: var(--muted); margin-top: 10px; display: inline-block; }
.int-meta { color: var(--muted); font-size: 12px; margin-top: 8px; }
.chip-env { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: rgba(91,140,255,.15); color: var(--brand); }
.chip-on { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: rgba(45,212,167,.15); color: var(--green); }
.chip-off { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: rgba(140,153,181,.15); color: var(--muted); }
.int-actions { display: flex; gap: 8px; margin-top: 12px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-danger { color: var(--red); border-color: rgba(255,107,122,.4); }
.btn-danger:hover { border-color: var(--red); background: rgba(255,107,122,.1); }

/* Period filter bar */
.period-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.period-btn { padding: 9px 15px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--muted); font-size: 13.5px; font-weight: 600; cursor: pointer; transition: .15s; }
.period-btn:hover { color: var(--text); border-color: var(--brand); }
.period-btn.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; }

/* Financial summary total row */
tfoot td { font-weight: 700; border-top: 2px solid var(--border); background: var(--bg-soft); }
.marge-pos { color: var(--green); font-weight: 600; }

/* Activation code box */
.code-box { background: var(--bg-soft); border: 1px dashed var(--brand); border-radius: 12px; padding: 14px 16px; margin: 14px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.code-box .code { font-family: ui-monospace, monospace; font-size: 20px; font-weight: 700; letter-spacing: 1px; color: var(--text); }
.code-box .copy { background: var(--card-2); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600; }
.code-box .copy:hover { border-color: var(--brand); }

/* Stepper (3 étapes) */
.stepper { display: flex; align-items: center; gap: 0; margin: 4px 0 20px; }
.step { display: flex; align-items: center; gap: 8px; flex: 1; }
.step .num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--bg-soft); border: 1px solid var(--border); color: var(--muted); flex-shrink: 0; }
.step .lbl { font-size: 12.5px; color: var(--muted); }
.step.active .num { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; }
.step.active .lbl { color: var(--text); font-weight: 600; }
.step.done .num { background: rgba(45,212,167,.16); color: var(--green); border-color: transparent; }
.step .line { flex: 1; height: 2px; background: var(--border); margin: 0 6px; }
.op-row { display: flex; gap: 10px; margin-bottom: 14px; }
.op-pick { flex: 1; border: 1px solid var(--border); border-radius: 11px; padding: 10px; text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.op-pick.on { border-color: var(--brand); color: var(--text); background: rgba(91,140,255,.1); }
.op-pick small { display: block; font-weight: 400; font-size: 11px; margin-top: 2px; }
.processing { text-align: center; padding: 20px 0; }
.spinner { width: 54px; height: 54px; border: 4px solid var(--border); border-top-color: var(--brand); border-radius: 50%; margin: 0 auto 16px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 880px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: .22s; }
  .admin-body.sb-open .sidebar { transform: translateX(0); }
  .admin-body.sb-open .sb-backdrop { display: block; }
  .icon-btn { display: grid; place-items: center; }
  .topbar, .admin-content { padding-left: 18px; padding-right: 18px; }
}

/* Diagnostic connexion Geny */
.geny-ok, .geny-err { border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.6; margin-bottom: 14px; }
.geny-ok  { background: rgba(34,197,94,.12);  border: 1px solid rgba(34,197,94,.35);  color: #bbf7d0; }
.geny-err { background: rgba(239,68,68,.10);  border: 1px solid rgba(239,68,68,.35);  color: #fecaca; }

/* Note forfait gratuit (achat sans numéro) */
.free-note { background: rgba(124,92,255,.10); border: 1px solid rgba(124,92,255,.30); color: #d6ccff; border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.5; margin: 6px 0 18px; }

/* Connexion client */
.auth-wrap { display: grid; place-items: center; min-height: 70vh; padding-top: 24px; padding-bottom: 24px; }
.op-pick { cursor: pointer; }
.table-wrap { overflow-x: auto; }
