@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500..800&family=Geist:wght@400..600&family=Geist+Mono:wght@400;500&display=swap');

:root {
  --ink: #16123A;
  --ink-2: #211C4A;
  --ink-3: #2A2459;
  --violet: #4B32C3;
  --violet-2: #3A25A3;
  --lilac: #CFC6FA;
  --lilac-2: #EAE6FD;
  --mint: #8DF0C8;
  --mint-2: #A9F5D7;
  --bg: #F6F5FB;
  --bg-2: #ECEAF6;
  --muted: #4E4A6B;
  --muted-2: #8C86B3;
  --line: rgba(22, 18, 58, .1);
  --line-2: rgba(22, 18, 58, .16);
  --ok-bg: #E3F4E9; --ok: #0B6B3A;
  --warn-bg: #FFF1D6; --warn: #8A5A00;
  --bad-bg: #FBE3DF; --bad: #A3321F;
  --off-bg: #E8E6E0; --off: #4A524D;
  --display: 'Bricolage Grotesque', sans-serif;
  --sans: 'Geist', system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--violet); text-decoration: none; }
a:hover { color: var(--ink); }
input, button, select, textarea { font-family: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.mono { font-family: var(--mono); }
.display { font-family: var(--display); letter-spacing: -0.03em; }
.muted { color: var(--muted); }
.kicker { font: 500 11.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--violet); }

/* Logo */
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--violet); display: grid; place-items: center; }
.logo-mark span { width: 12px; height: 12px; border-radius: 50% 50% 50% 2px; background: var(--mint); }
.logo-word { font: 700 22px/1 var(--display); letter-spacing: -0.035em; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 11px; padding: 12px 16px; font: 600 14px/1 var(--sans); background: var(--ink); color: var(--bg); transition: background .15s, color .15s, border-color .15s; }
.btn:hover { background: var(--violet); color: var(--bg); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid rgba(22, 18, 58, .2); }
.btn-ghost:hover { background: var(--bg-2); color: var(--ink); }
.btn-mint { background: var(--mint); color: var(--ink); }
.btn-mint:hover { background: var(--mint-2); color: var(--ink); }
.btn-danger { background: transparent; color: var(--bad); border: 1px solid rgba(22, 18, 58, .18); }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn-sm { padding: 8px 11px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { padding: 16px 22px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.pill { border-radius: 999px; }

/* Formulaires */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--muted); }
.input, .field input, .field select, .field textarea {
  padding: 12px 13px; border-radius: 11px; border: 1px solid var(--line-2); background: #fff; font: 400 14.5px/1.3 var(--sans); color: var(--ink); outline: none; width: 100%;
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(75, 50, 195, .18); }
.hint { font-size: 12.5px; color: var(--muted); }
.error-box { padding: 11px 13px; border-radius: 11px; background: var(--bad-bg); color: var(--bad); font-size: 13.5px; }
.info-box { padding: 13px 15px; border-radius: 12px; background: var(--bg-2); color: var(--muted); font-size: 13.5px; line-height: 1.5; }

/* Badges de statut */
.badge { display: inline-block; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-bad { background: var(--bad-bg); color: var(--bad); }
.b-off { background: var(--off-bg); color: var(--off); }
.b-info { background: var(--lilac-2); color: var(--violet); }

/* Cartes */
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.card-title { font: 600 17px/1 var(--display); letter-spacing: -0.01em; }
.stat { display: flex; flex-direction: column; gap: 14px; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font: 700 30px/1 var(--display); letter-spacing: -0.03em; }
.stat-foot { font: 500 12.5px/1 var(--mono); color: var(--muted); }
.card-violet { background: var(--violet); color: var(--bg); border-color: transparent; }
.card-violet .stat-label { color: var(--lilac); }
.card-violet .stat-foot { color: var(--mint); }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 14px; align-items: stretch; }
.bar { height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--violet); transition: width .5s ease; }

/* Tables */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--line); font: 500 11.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap; }
table.t td { padding: 13px 18px; border-bottom: 1px solid rgba(22, 18, 58, .07); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--bg); }
.t .num { text-align: right; font: 500 13px/1 var(--mono); white-space: nowrap; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* Puces de filtre */
.chips { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg-2); flex-wrap: wrap; }
.chip { border: 0; padding: 8px 12px; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; }
.chip.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(22, 18, 58, .12); }
.chip .n { font-family: var(--mono); font-weight: 400; color: var(--muted); margin-left: 3px; }

/* Interrupteur */
.switch { width: 38px; height: 22px; border-radius: 99px; background: #CAC6DA; position: relative; display: inline-block; transition: background .2s; border: 0; padding: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch.on { background: var(--violet); }
.switch.on::after { left: 19px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 500; box-shadow: 0 20px 40px -16px rgba(0, 0, 0, .5); max-width: calc(100% - 32px); }
.toast i { flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--mint); color: var(--ink); display: grid; place-items: center; font-size: 11px; font-weight: 700; font-style: normal; }
.toast.err i { background: #FF8A7A; }

/* Modale */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(22, 18, 58, .55); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; }
.modal { width: 100%; max-width: 460px; max-height: calc(100vh - 40px); overflow-y: auto; background: #fff; border-radius: 24px; padding: 26px; display: flex; flex-direction: column; gap: 20px; box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .5); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.x { width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(22, 18, 58, .15); background: none; font-size: 16px; color: var(--ink); flex: none; }

/* Tiroir latéral */
.drawer-bg { position: fixed; inset: 0; background: rgba(22, 18, 58, .35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100%); background: #fff; z-index: 41; display: flex; flex-direction: column; box-shadow: -30px 0 60px -30px rgba(0, 0, 0, .4); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 24px 24px 18px; border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 24px; }
.drawer-foot { display: flex; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); }

/* Choix de moyen de paiement */
.methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.method { padding: 13px 12px; border-radius: 12px; border: 1px solid rgba(22, 18, 58, .15); background: transparent; font: 500 14px/1 var(--sans); color: var(--muted); text-align: left; }
.method:hover { border-color: rgba(22, 18, 58, .4); }
.method.on { border: 2px solid var(--ink); background: #fff; color: var(--ink); font-weight: 600; padding: 12px 11px; }

/* Coquille des espaces connectés (client et admin) */
.shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); background: var(--bg); }
.side { position: sticky; top: 0; height: 100vh; background: var(--ink); color: var(--bg); display: flex; flex-direction: column; padding: 20px 14px; gap: 28px; overflow-y: auto; }
.side .logo { color: var(--bg); padding: 4px 8px; }
.side .logo-mark { background: var(--mint); width: 28px; height: 28px; border-radius: 8px; }
.side .logo-mark span { background: var(--ink); width: 11px; height: 11px; }
.side .logo-word { font-size: 20px; }
.side .tag { margin-left: auto; font: 500 10.5px/1 var(--mono); color: var(--lilac); border: 1px solid rgba(207, 198, 250, .3); padding: 4px 6px; border-radius: 5px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 0; border-radius: 10px; background: transparent; color: #C3BFDE; font-size: 14.5px; font-weight: 500; text-align: left; }
.nav button::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: transparent; flex: none; }
.nav button:hover { background: var(--ink-2); color: var(--bg); }
.nav button.on { background: var(--ink-3); color: var(--bg); }
.nav button.on::before { background: var(--mint); }
.nav .count { margin-left: auto; font: 500 12px/1 var(--mono); color: var(--muted-2); }
.nav .alert { margin-left: auto; font: 600 11.5px/1 var(--mono); background: var(--mint); color: var(--ink); padding: 4px 7px; border-radius: 999px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.side-box { padding: 14px; border-radius: 12px; background: var(--ink-2); display: flex; flex-direction: column; gap: 8px; }
.side-box .l { font-size: 12px; color: var(--lilac); }
.side-box .v { font: 600 22px/1 var(--display); letter-spacing: -0.02em; }
.side-box .s { font-size: 12px; color: var(--muted-2); }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #3A3370; display: grid; place-items: center; font: 600 12px/1 var(--sans); flex: none; color: var(--bg); }
.me .n { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .e { font-size: 12px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .out { margin-left: auto; border: 0; background: none; color: var(--muted-2); font-size: 12px; padding: 4px; }
.me .out:hover { color: var(--mint); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 28px clamp(20px, 3vw, 40px) 20px; }
.top h1 { margin: 6px 0 0; font: 700 34px/1 var(--display); letter-spacing: -0.03em; }
.date-pill { padding: 9px 12px; border-radius: 10px; border: 1px solid rgba(22, 18, 58, .14); background: #fff; font-size: 13.5px; font-weight: 500; }
.content { padding: 0 clamp(20px, 3vw, 40px) 48px; display: flex; flex-direction: column; gap: 20px; font-size: 14px; }
.burger { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 45; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .4); }
  .burger { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; font-size: 18px; color: var(--ink); }
  .top h1 { font-size: 28px; }
  .date-pill { display: none; }
}

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(22, 18, 58, .15); border-top-color: var(--violet); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
