/* =====================================================================
   SysPay — design system (console marchand, super-admin, checkout, installateur)
   ===================================================================== */
:root {
  --ink: #0b1026; --ink-2: #1c2240; --muted: #636b86; --muted-2: #8b92aa;
  --line: #e6e8f0; --line-2: #eef0f6; --bg: #f5f6fb; --card: #ffffff;
  --brand: #6247ff; --brand-2: #4a2be0; --brand-soft: #efecff;
  --mint: #12c99a; --mint-soft: #e2f9f1; --amber: #f5a524; --amber-soft: #fff4dd;
  --red: #e5484d; --red-soft: #fdecec; --blue: #2f7cf6; --blue-soft: #e7f0ff;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 64, .05), 0 6px 24px rgba(16, 24, 64, .06);
  --shadow-lg: 0 24px 64px rgba(16, 24, 64, .18);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; }
code, .mono { font-family: var(--mono); font-size: .88em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

/* ------------------------------ boutons ------------------------------ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--brand); color: #fff; font: 600 14px var(--font); cursor: pointer; transition: .15s ease; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--brand-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.loading { opacity: .6; pointer-events: none; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { border-color: #cfd3e2; background: #fafbff; }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--line-2); }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #c93a3f; }
.btn.success { background: var(--mint); }
.btn.success:hover { background: #0fb088; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn.block { width: 100%; }
.btn.lg { height: 48px; font-size: 15px; padding: 0 22px; }
.icon-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--line-2); }
.btn .fa-spinner { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------ formulaires ------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-weight: 600; font-size: 13px; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--red); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink);
  font: 500 14px var(--font); outline: none; transition: border-color .15s, box-shadow .15s; }
.textarea { height: auto; min-height: 96px; padding: 10px 13px; resize: vertical; line-height: 1.5; }
.textarea.code { font-family: var(--mono); font-size: 12.5px; min-height: 260px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(98, 71, 255, .12); }
.input.invalid, .select.invalid { border-color: var(--red); box-shadow: 0 0 0 4px rgba(229, 72, 77, .1); }
.input::placeholder, .textarea::placeholder { color: #a6abbe; }
.select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23636b86' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.select.sm, .input.sm { height: 34px; font-size: 13px; border-radius: 8px; }
.input-group { display: flex; align-items: stretch; }
.input-group .addon { display: flex; align-items: center; padding: 0 12px; background: var(--line-2); border: 1px solid var(--line); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--muted); font-weight: 600; font-size: 13.5px; }
.input-group .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted-2); }
.input-icon .input { padding-left: 38px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 600; font-size: 13.5px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 40px; height: 23px; background: #d8dbe7; border-radius: 99px; position: relative; transition: .2s; flex: 0 0 auto; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .2s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { left: 20px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; border: 1.5px solid #c6cad8; border-radius: 5px; display: grid; place-content: center; margin: 0; cursor: pointer; background: #fff; }
.check input:checked { background: var(--brand); border-color: var(--brand); }
.check input:checked::after { content: ''; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
input[type=file].input { padding: 8px 10px; height: auto; }
input[type=color].input { padding: 4px; width: 64px; }

/* ------------------------------ cartes & tableaux ------------------------------ */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.card-h h3 { font-size: 15px; margin: 0; display: flex; gap: 9px; align-items: center; }
.card-h h3 i { color: var(--brand); }
.card-b { padding: 18px; }
.card-b.flush { padding: 0; }
.kpi { padding: 16px 18px; }
.kpi .lbl { color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; gap: 8px; align-items: center; text-transform: uppercase; letter-spacing: .04em; }
.kpi .val { font-size: 24px; font-weight: 800; margin-top: 6px; letter-spacing: -.02em; }
.kpi .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); float: right; }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 11px 14px; background: #fafbfe; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #fafaff; }
.tbl .amt { font-weight: 700; white-space: nowrap; }
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty i { font-size: 30px; color: #c5c9d9; display: block; margin-bottom: 10px; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.badge.ok { background: var(--mint-soft); color: #08875f; }
.badge.warn { background: var(--amber-soft); color: #a26200; }
.badge.bad { background: var(--red-soft); color: #c0353a; }
.badge.info { background: var(--blue-soft); color: #1f5fcc; }
.badge.brand { background: var(--brand-soft); color: var(--brand-2); }
.badge.dark { background: var(--ink); color: #fff; }
.net { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; white-space: nowrap; }
.net .dot { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; color: #fff; font-size: 11px; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 12px 14px; border-top: 1px solid var(--line-2); }
.pager span { color: var(--muted); font-size: 13px; margin-right: auto; }
.alert { display: flex; gap: 12px; padding: 13px 15px; border-radius: var(--radius-sm); font-size: 13.5px; align-items: flex-start; }
.alert i { margin-top: 2px; }
.alert.info { background: var(--blue-soft); color: #1d4ea8; }
.alert.warn { background: var(--amber-soft); color: #8a5300; }
.alert.bad { background: var(--red-soft); color: #a52b30; }
.alert.ok { background: var(--mint-soft); color: #06714f; }
.alert.brand { background: var(--brand-soft); color: var(--brand-2); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 9px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.code-block { position: relative; background: #0d1230; color: #dfe4ff; border-radius: var(--radius-sm); padding: 14px 16px; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; overflow-x: auto; white-space: pre; }
.code-block .copy { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.08); border: 0; color: #cfd5ff; border-radius: 7px; height: 28px; padding: 0 9px; cursor: pointer; font: 600 12px var(--font); }
.code-block .copy:hover { background: rgba(255,255,255,.16); }
.secret { display: flex; gap: 8px; align-items: center; background: #0d1230; color: #b9f6df; padding: 12px 14px; border-radius: var(--radius-sm); font-family: var(--mono); font-size: 13px; word-break: break-all; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 24px; font-size: 13px; }
.timeline li::before { content: ''; position: absolute; left: 6px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.timeline li::after { content: ''; position: absolute; left: 9px; top: 16px; bottom: 0; width: 2px; background: var(--line-2); }
.timeline li:last-child::after { display: none; }
.timeline .t { color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font: 600 13.5px var(--font); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px; border-bottom: 1px solid var(--line-2); }
.filters .input, .filters .select { height: 36px; font-size: 13px; width: auto; min-width: 140px; }
.skeleton { background: linear-gradient(90deg, #eef0f6 25%, #f6f7fb 50%, #eef0f6 75%); background-size: 400% 100%; animation: sk 1.3s infinite; border-radius: 8px; height: 14px; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ------------------------------ coque applicative ------------------------------ */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #c9cde3; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 18px; color: #fff; font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.side .brand img { width: 32px; height: 32px; }
.side .brand small { display: block; font-size: 10.5px; font-weight: 600; color: #8d93b8; letter-spacing: .08em; text-transform: uppercase; }
.side nav { padding: 6px 12px; flex: 1; }
.side .sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #6c7298; font-weight: 700; padding: 16px 10px 6px; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: #c9cde3; font-weight: 600; font-size: 13.5px; text-decoration: none; margin-bottom: 2px; }
.side nav a i { width: 18px; text-align: center; color: #8d93b8; }
.side nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side nav a.active { background: rgba(123, 92, 255, .22); color: #fff; }
.side nav a.active i { color: #a993ff; }
.side nav a .count { margin-left: auto; background: var(--amber); color: #3b2600; border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 800; }
.side .foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.07); font-size: 12.5px; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 26px; background: rgba(245, 246, 251, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 19px; margin: 0; }
.topbar .burger { display: none; }
.content { padding: 24px 26px 60px; max-width: 1360px; }
.mode-toggle { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 3px; }
.mode-toggle button { border: 0; background: transparent; padding: 6px 13px; border-radius: 99px; font: 700 12px var(--font); color: var(--muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.mode-toggle button.on.test { background: var(--amber); color: #3b2600; }
.mode-toggle button.on.live { background: var(--mint); color: #fff; }
.test-banner { background: repeating-linear-gradient(45deg, #fff3d6, #fff3d6 12px, #ffecc2 12px, #ffecc2 24px); color: #7a4c00; font-size: 12.5px; font-weight: 700; text-align: center; padding: 6px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-2); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-h p { margin: 0; color: var(--muted); }
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 262px; z-index: 60; transform: translateX(-100%); transition: transform .25s; }
  .side.open { transform: none; box-shadow: var(--shadow-lg); }
  .topbar .burger { display: inline-flex; }
  .content { padding: 18px 14px 60px; }
  .topbar { padding: 10px 14px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
}
.scrim { position: fixed; inset: 0; background: rgba(11, 16, 38, .45); z-index: 55; }

/* ------------------------------ graphique barres ------------------------------ */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding: 8px 4px 0; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .b .v { width: 100%; max-width: 34px; background: linear-gradient(180deg, #8a73ff, var(--brand)); border-radius: 6px 6px 3px 3px; min-height: 3px; position: relative; transition: height .5s ease; }
.bars .b .v:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 11.5px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; z-index: 2; }
.bars .b .d { font-size: 10.5px; color: var(--muted-2); white-space: nowrap; }
.meter { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

/* ------------------------------ modales & toasts ------------------------------ */
.modal-back { position: fixed; inset: 0; background: rgba(11, 16, 38, .5); backdrop-filter: blur(3px); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; animation: fade .15s ease; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); animation: pop .18s ease; }
.modal.wide { max-width: 760px; }
.modal.xl { max-width: 980px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line-2); }
.modal-h h3 { margin: 0; font-size: 16.5px; display: flex; gap: 10px; align-items: center; }
.modal-b { padding: 20px; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line-2); background: #fafbfe; border-radius: 0 0 18px 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 36px)); }
.toast { display: flex; gap: 11px; align-items: flex-start; background: var(--ink); color: #fff; padding: 13px 15px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: pop .2s ease; }
.toast i { margin-top: 2px; }
.toast.ok i { color: #4be3b6; } .toast.bad i { color: #ff8a8e; } .toast.warn i { color: #ffc65c; } .toast.info i { color: #9fb9ff; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .25s; }

/* ------------------------------ écran d'authentification ------------------------------ */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth .art { background: radial-gradient(1200px 500px at -10% -10%, #7b5cff 0%, transparent 55%), radial-gradient(800px 500px at 110% 110%, #12c99a 0%, transparent 50%), var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth .art h2 { font-size: 36px; letter-spacing: -.03em; max-width: 480px; }
.auth .art p { color: #c9cde3; max-width: 440px; font-size: 15px; }
.auth .art .pts { display: grid; gap: 12px; margin-top: 26px; }
.auth .art .pts div { display: flex; gap: 12px; align-items: center; color: #e2e5f5; font-weight: 600; }
.auth .art .pts i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.1); color: #a993ff; }
.auth .form-side { display: flex; align-items: center; justify-content: center; padding: 40px 22px; }
.auth .box { width: 100%; max-width: 420px; }
.auth .box h1 { font-size: 26px; }
.auth .logo-row { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; }
.auth .logo-row img { width: 36px; height: 36px; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth .art { display: none; } }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted-2); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.steps-list { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps-list li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.steps-list li:last-child { border-bottom: 0; }
.steps-list li::before { content: counter(s); flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-2); display: grid; place-items: center; font-weight: 800; font-size: 12.5px; }
.steps-list li.done::before { content: '\2713'; background: var(--mint-soft); color: #08875f; }
input[type=file].input { color: var(--muted); cursor: pointer; }
input[type=file].input::file-selector-button { font: 600 13px var(--font); height: 30px; padding: 0 12px; margin-right: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--brand-soft); color: var(--brand-2); cursor: pointer; }
input[type=file].input::file-selector-button:hover { background: #e2dcff; }
