:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f7f9fd;
  --ink: #0b1b3f;
  --ink-2: #33415f;
  --muted: #66748f;
  --line: #e2e7f0;
  --brand: #1747e0;
  --brand-ink: #0f34b0;
  --brand-soft: #e9efff;
  --navy: #0b1b3f;
  --accent: #ffb020;
  --ok: #128a47;
  --ok-soft: #e2f5e9;
  --warn: #a86400;
  --warn-soft: #fff3d6;
  --danger: #cf3439;
  --danger-soft: #fde9e9;
  --wa: #1fae55;
  --wa-ink: #138643;
  --flooz: #1f6fd1;
  --tmoney: #e0a100;
  --cash: #2f9e5b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(11, 27, 63, 0.06), 0 4px 16px rgba(11, 27, 63, 0.06);
  --shadow-lg: 0 10px 40px rgba(11, 27, 63, 0.18);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Roboto Mono', Menlo, Consolas, monospace;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
svg:not([width]) { width: 1.15em; height: 1.15em; flex: none; }
.promo-ok span, h2 { display: inline-flex; align-items: center; gap: 8px; }
.logo svg { width: 62%; height: 62%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
.mono { font-family: var(--mono); letter-spacing: 0.02em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.right { text-align: right; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Structure ---------- */
.app { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(243, 245, 250, 0.92);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .back { margin-left: -8px; }
.topbar h1 { font-size: 19px; font-weight: 750; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brandmark { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; letter-spacing: -0.02em; }
.brandmark .logo { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), #4f7bff); color: #fff; }
.brandmark small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
main { padding: 4px 16px calc(var(--nav-h) + var(--safe-b) + 24px); max-width: 760px; margin: 0 auto; }

.router-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.router-pill svg { width: 15px; height: 15px; color: var(--muted); }
.router-pill .pill-long { margin-left: -3px; }
@media (max-width: 480px) { .topbar h1 { font-size: 17px; } .router-pill .pill-long { display: none; } .router-pill { padding: 5px 9px; } }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(18, 138, 71, 0.15); }
.dot.err { background: var(--danger); box-shadow: 0 0 0 3px rgba(207, 52, 57, 0.15); }
.dot.demo { background: var(--accent); box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.2); }
.dot.live { background: var(--ok); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(18, 138, 71, 0.45); } 70% { box-shadow: 0 0 0 7px rgba(18, 138, 71, 0); } 100% { box-shadow: 0 0 0 0 rgba(18, 138, 71, 0); } }

/* ---------- Navigation basse (mobile) ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: var(--nav-h); color: var(--muted); font-size: 11px; font-weight: 600;
}
.bottomnav a.active { color: var(--brand); }
.bottomnav a svg { width: 23px; height: 23px; }
.bottomnav a.sell { position: relative; }
.bottomnav a.sell .fab {
  width: 54px; height: 54px; margin-top: -26px; border-radius: 18px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), #3d6bff); color: #fff; box-shadow: 0 8px 20px rgba(23, 71, 224, 0.4);
}
.bottomnav a.sell.active .fab { background: linear-gradient(135deg, var(--brand-ink), var(--brand)); }
.bottomnav a.sell span { color: var(--ink-2); }

.sidenav { display: none; }

@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: 248px minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .app > .topbar, .app > main { grid-column: 2; }
  .app > main { width: 100%; }
  .sidenav {
    grid-row: 1 / span 2; grid-column: 1;
    display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh;
    padding: 18px 14px; background: var(--navy); color: #c8d3ee; overflow-y: auto;
  }
  .sidenav .brandmark { color: #fff; padding: 4px 8px 18px; }
  .sidenav .brandmark small { color: #8ea0c9; }
  .sidenav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #c8d3ee; font-weight: 600; }
  .sidenav a:hover { background: rgba(255, 255, 255, 0.06); }
  .sidenav a.active { background: rgba(79, 123, 255, 0.22); color: #fff; }
  .sidenav a svg { width: 20px; height: 20px; }
  .sidenav .sep { height: 1px; background: rgba(255, 255, 255, 0.08); margin: 10px 4px; }
  .sidenav .cta { background: var(--brand); color: #fff; margin-bottom: 10px; justify-content: center; }
  .sidenav .cta:hover { background: #2c5af0; }
  .sidenav .who { margin-top: auto; font-size: 13px; padding: 10px 12px; color: #8ea0c9; }
  .bottomnav, .topbar .brandmark, .topbar .menu-btn { display: none; }
  main { max-width: 1100px; padding: 8px 32px 48px; }
  .topbar { padding: 16px 32px; }
  .topbar h1 { font-size: 24px; }
  .desk-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  .desk-2 > * { margin-top: 0 !important; }
}

/* ---------- Composants ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card, .section + .section, .card + .section, .section + .card { margin-top: 14px; }
.card h2, .section-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.section-title { margin: 22px 2px 10px; justify-content: space-between; }
.section-title a { font-size: 13px; font-weight: 600; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row-flex { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 14px; }
.mt-s { margin-top: 8px; }
.mt-l { margin-top: 22px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: 12px; border: 1px solid transparent; background: var(--surface); color: var(--ink); font-weight: 650;
  cursor: pointer; transition: transform 0.06s, background 0.15s, opacity 0.15s; white-space: nowrap; user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; pointer-events: none; }
.btn svg { width: 19px; height: 19px; flex: none; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: #2c5af0; }
.btn.navy { background: var(--navy); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.soft { background: var(--brand-soft); color: var(--brand-ink); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; }
.btn.wa { background: var(--wa); color: #fff; }
.btn.wa:hover { background: var(--wa-ink); }
.btn.block { width: 100%; }
.btn.lg { min-height: 54px; font-size: 16px; border-radius: 14px; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.icon { width: 42px; padding: 0; }
.btn.sm.icon { width: 34px; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-grid .full { grid-column: 1 / -1; }
.btn-grid > .btn { min-width: 0; white-space: normal; text-align: center; line-height: 1.2; padding: 0 10px; }
.iconbtn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.iconbtn:hover { background: rgba(11, 27, 63, 0.06); }
.iconbtn svg { width: 22px; height: 22px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .label { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 12px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); outline: none; transition: border-color 0.15s, box-shadow 0.15s; font-size: 16px;
}
textarea.input { min-height: 120px; resize: vertical; line-height: 1.45; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(23, 71, 224, 0.12); }
.input.big { font-size: 22px; font-weight: 750; min-height: 56px; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; min-width: 0; }
.prefix-input { position: relative; }
.prefix-input .pre { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.prefix-input .input { padding-left: 58px; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

.search { position: relative; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search .input { padding-left: 40px; background: var(--surface); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface); font-size: 13px; font-weight: 650; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip .count { font-size: 11px; padding: 1px 6px; border-radius: 99px; background: rgba(11, 27, 63, 0.08); }
.chip.on .count { background: rgba(255, 255, 255, 0.2); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; padding: 5px; background: #e8ecf5; border-radius: 14px; }
.seg button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; font-weight: 700; color: var(--ink-2); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(11, 27, 63, 0.15); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.unused { background: var(--brand-soft); color: var(--brand-ink); }
.badge.used { background: var(--ok-soft); color: var(--ok); }
.badge.expired { background: #eef0f4; color: #5b6476; }
.badge.disabled, .badge.deleted, .badge.cancelled { background: var(--danger-soft); color: var(--danger); }
.badge.online { background: var(--ok); color: #fff; }
.badge.admin { background: var(--navy); color: #fff; }
.badge.caissier { background: var(--brand-soft); color: var(--brand-ink); }
.net { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; font-size: 13px; }
.net::before { content: ''; width: 9px; height: 9px; border-radius: 3px; background: var(--muted); }
.net.flooz::before { background: var(--flooz); }
.net.tmoney::before { background: var(--tmoney); }
.net.cash::before { background: var(--cash); }
.net.tickets::before { background: var(--accent); }
.net:empty { gap: 0; }
.tiny-ico { width: 15px; height: 15px; vertical-align: -3px; }
.btn .tiny { font-weight: 700; }

/* Listes */
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list .item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line); color: inherit; cursor: pointer; }
.list .item:last-child { border-bottom: 0; }
.list .item:active { background: var(--surface-2); }
.list .item .main { flex: 1; min-width: 0; }
.list .item .title { font-weight: 700; display: flex; align-items: center; gap: 8px; min-width: 0; }
.list .item .sub { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .item .end { text-align: right; flex: none; }
.list .item .sub.wrap { white-space: normal; overflow-wrap: anywhere; }
.list .item .chev { color: #b4bdd0; width: 18px; height: 18px; flex: none; }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; font-weight: 800; font-size: 13px; color: #fff; background: var(--brand); }
.avatar svg { width: 20px; height: 20px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; word-break: break-word; }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty svg { width: 38px; height: 38px; color: #b4bdd0; margin-bottom: 8px; }
.empty b { display: block; color: var(--ink-2); margin-bottom: 4px; }
.more { display: flex; justify-content: center; padding: 14px; }

/* ---------- Tableau de bord ---------- */
.hero {
  background: radial-gradient(120% 140% at 100% 0%, #3c6cff 0%, var(--brand) 40%, #0e2a8c 100%);
  color: #fff; border-radius: 22px; padding: 18px; box-shadow: 0 14px 34px rgba(23, 71, 224, 0.3); position: relative; overflow: hidden;
}
.hero::after { content: ''; position: absolute; right: -40px; bottom: -60px; width: 200px; height: 200px; border-radius: 50%; border: 28px solid rgba(255, 255, 255, 0.06); }
.hero .label { color: rgba(255, 255, 255, 0.75); font-size: 13px; }
.hero .amount { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; margin: 2px 0 6px; }
.hero .amount small { font-size: 16px; font-weight: 700; opacity: 0.8; }
.hero .split { display: flex; gap: 16px; font-size: 13px; color: rgba(255, 255, 255, 0.85); flex-wrap: wrap; }
.hero .delta { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.16); font-size: 12px; font-weight: 700; }
.hero .cta { margin-top: 14px; background: #fff; color: var(--brand-ink); }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 4px; color: inherit; }
.kpi .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 6px; }
.kpi .ico svg { width: 19px; height: 19px; }
.kpi .v { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.kpi .l { font-size: 13px; color: var(--muted); font-weight: 600; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 140px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .bar i { display: block; width: 100%; max-width: 38px; border-radius: 8px 8px 4px 4px; background: #c9d6ff; min-height: 4px; }
.bars .bar.today i { background: var(--brand); }
.bars .bar b { font-size: 11px; color: var(--muted); font-weight: 600; }
.bars .bar em { font-style: normal; font-size: 10.5px; color: var(--ink-2); font-weight: 700; }
.hbar { display: grid; grid-template-columns: 86px 1fr auto; align-items: center; gap: 10px; font-size: 13px; padding: 6px 0; }
.hbar .track { height: 10px; border-radius: 99px; background: #eef1f7; overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: 99px; }
.feed .item { cursor: default; }
.feed .avatar { width: 34px; height: 34px; border-radius: 10px; }

/* ---------- Nouvelle vente ---------- */
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan {
  position: relative; text-align: left; border: 2px solid var(--line); background: var(--surface); border-radius: 16px; padding: 14px;
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s, transform 0.06s;
}
.plan:active { transform: scale(0.98); }
.plan .p-name { font-weight: 750; color: var(--ink-2); font-size: 14px; display: flex; align-items: center; gap: 6px; }
.plan .p-price { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; }
.plan .p-price small { font-size: 13px; font-weight: 700; color: var(--muted); }
.plan .p-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.plan .stripe { position: absolute; left: 14px; top: 0; width: 28px; height: 4px; border-radius: 0 0 4px 4px; }
.plan.on { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(23, 71, 224, 0.12); }
.plan.on::after { content: '✓'; position: absolute; right: 12px; top: 10px; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 13px; font-weight: 800; display: grid; place-items: center; }
.paybar {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 25; padding: 12px 16px;
  background: rgba(255, 255, 255, 0.97); border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(11, 27, 63, 0.08);
}
.paybar .inner { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 14px; }
.paybar .due { font-size: 12px; color: var(--muted); font-weight: 600; }
.paybar .due b { display: block; font-size: 21px; color: var(--ink); letter-spacing: -0.02em; }
.paybar .btn { flex: 1; }
.promo-ok { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); font-weight: 650; font-size: 14px; }
.warnbox { padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 13.5px; font-weight: 600; }
.errbox { padding: 10px 12px; border-radius: 12px; background: var(--danger-soft); color: var(--danger); font-size: 13.5px; font-weight: 600; }
.infobox { padding: 10px 12px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); font-size: 13.5px; font-weight: 600; }
.vente-page { padding-bottom: 84px; }
@media (min-width: 960px) { .paybar { left: 248px; bottom: 0; } }

.success-head { text-align: center; padding: 8px 0 16px; }
.success-head .tick { width: 58px; height: 58px; border-radius: 50%; margin: 0 auto 10px; display: grid; place-items: center; background: var(--ok); color: #fff; box-shadow: 0 0 0 8px var(--ok-soft); animation: pop 0.35s ease-out; }
.success-head .tick svg { width: 30px; height: 30px; }
@keyframes pop { 0% { transform: scale(0.4); opacity: 0; } 80% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }

/* ---------- Carte e-voucher ---------- */
.evoucher {
  position: relative; border-radius: 22px; overflow: hidden; color: #fff; max-width: 420px; margin: 0 auto;
  background: radial-gradient(130% 120% at 100% 0%, #3d6dff 0%, #1747e0 38%, #0b1b3f 100%);
  box-shadow: 0 18px 40px rgba(11, 27, 63, 0.35);
}
.evoucher .ev-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.evoucher .ev-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -0.01em; }
.evoucher .ev-brand .logo { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.16); }
.evoucher .ev-brand small { display: block; font-size: 11px; font-weight: 600; opacity: 0.75; letter-spacing: 0.08em; text-transform: uppercase; }
.evoucher .ev-plan { text-align: right; }
.evoucher .ev-plan b { display: block; font-size: 22px; font-weight: 800; }
.evoucher .ev-plan span { font-size: 13px; opacity: 0.85; font-weight: 600; }
.evoucher .ev-body { display: flex; gap: 16px; align-items: center; padding: 14px 20px 18px; }
.evoucher .ev-creds { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.evoucher .ev-cred label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.72; font-weight: 700; }
.evoucher .ev-cred div { font-family: var(--mono); font-size: 25px; font-weight: 800; letter-spacing: 0.08em; word-break: break-all; }
.evoucher .ev-qr { width: 112px; height: 112px; border-radius: 14px; background: #fff; padding: 7px; flex: none; }
.evoucher .ev-qr svg { width: 100%; height: 100%; display: block; }
.evoucher .ev-foot { position: relative; padding: 14px 20px 16px; background: rgba(255, 255, 255, 0.08); font-size: 12.5px; line-height: 1.45; opacity: 0.95; }
.evoucher .ev-foot::before { content: ''; position: absolute; left: 14px; right: 14px; top: 0; border-top: 2px dashed rgba(255, 255, 255, 0.25); }
.evoucher .ev-foot b { font-weight: 700; }
.evoucher .ev-state { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); }
.evoucher.dim { filter: grayscale(0.8) brightness(0.9); }
.wa-box { margin-top: 16px; }
.msg-preview { white-space: pre-wrap; font-size: 13.5px; background: #e7f8ee; border-radius: 12px 12px 12px 4px; padding: 10px 12px; color: #12321f; border: 1px solid #ccecd9; }

/* ---------- Connexion MikroTik : préparation + diagnostic ---------- */
.setup summary { list-style: none; cursor: pointer; }
.setup summary::-webkit-details-marker { display: none; }
.setup summary h2::after { content: '▾'; margin-left: auto; color: var(--muted); font-size: 13px; }
.setup[open] summary h2::after { content: '▴'; }
.setup summary h2 { display: flex; width: 100%; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; color: var(--ink-2); }
pre.code { margin: 0; padding: 12px; border-radius: 12px; background: var(--navy); color: #e6ecff; font-family: var(--mono); font-size: 12px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; max-height: 280px; overflow: auto; }
.diag { display: flex; flex-direction: column; gap: 8px; }
.diag-item { display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.diag-item .di { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; flex: none; color: #fff; font-weight: 800; font-size: 13px; }
.diag-item.ok .di { background: var(--ok); }
.diag-item.warn .di { background: var(--accent); }
.diag-item.err { border-color: #f4c3c5; background: #fff7f7; }
.diag-item.err .di { background: var(--danger); }
.diag-item.info .di { background: var(--brand); }
.diag-item b { display: block; font-size: 14px; line-height: 1.3; }
.diag-item p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.diag-fix { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.diag-fix code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 11.5px; background: var(--navy); color: #e6ecff; padding: 8px 10px; border-radius: 8px; overflow-x: auto; white-space: nowrap; }

/* ---------- Feuilles (modales) ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(11, 27, 63, 0.45); display: flex; align-items: flex-end; justify-content: center; animation: fade 0.15s; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(18px + var(--safe-b)); box-shadow: var(--shadow-lg); animation: up 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.sheet .grab { width: 42px; height: 5px; border-radius: 99px; background: #d6dce8; margin: 0 auto 12px; }
.sheet .sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sheet .sheet-head h3 { font-size: 18px; }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 22px; } }
@keyframes up { from { transform: translateY(40px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.toasts { position: fixed; left: 0; right: 0; top: calc(max(10px, env(safe-area-inset-top)) + 54px); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--navy); color: #fff; padding: 11px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); max-width: 520px; animation: up 0.2s; display: flex; gap: 8px; align-items: center; }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
.toast svg { width: 18px; height: 18px; flex: none; }
@media (min-width: 960px) { .toasts { top: auto; bottom: 24px; left: 248px; } }

.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: spin 0.7s linear infinite; }
.spinner.dark { border-color: rgba(11, 27, 63, 0.15); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 60px 0; }
.skel { background: linear-gradient(90deg, #e9edf5 25%, #f4f6fb 50%, #e9edf5 75%); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 12px; }
@keyframes sh { to { background-position: -200% 0; } }

/* ---------- Connexion ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(100% 60% at 50% 0%, #dfe7ff 0%, var(--bg) 70%); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brandmark { justify-content: center; font-size: 24px; margin-bottom: 6px; }
.auth-card .brandmark .logo { width: 46px; height: 46px; border-radius: 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 -16px 14px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 12px; font-weight: 700; color: var(--muted); border-bottom: 2.5px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- Impression (ticket thermique 58/80 mm, ou lot A4) ---------- */
.print-only { display: none; }
@media print {
  body { background: #fff; }
  .app > *:not(main), .topbar, .bottomnav, .sidenav, .paybar, .toasts, .no-print, .overlay { display: none !important; }
  .app { display: block; }
  main { padding: 0; max-width: none; }
  main > :not(.print-area) { display: none !important; }
  .print-only { display: block; }
  .print-ticket { width: 54mm; margin: 0 auto; font-family: var(--font); color: #000; text-align: center; font-size: 10pt; }
  .print-ticket .pt-brand { font-weight: 800; font-size: 13pt; }
  .print-ticket .pt-code { font-family: var(--mono); font-size: 15pt; font-weight: 800; margin: 2mm 0; letter-spacing: 0.06em; }
  .print-ticket svg { width: 30mm; height: 30mm; }
  .print-ticket hr { border: 0; border-top: 1px dashed #000; margin: 2mm 0; }
  .print-sheet { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3mm; }
  .print-sheet .tk { border: 1px dashed #777; border-radius: 2mm; padding: 2.5mm; text-align: center; break-inside: avoid; font-size: 8pt; color: #000; }
  .print-sheet .tk b { display: block; font-size: 10pt; }
  .print-sheet .tk .code { font-family: var(--mono); font-size: 12pt; font-weight: 800; letter-spacing: 0.05em; margin: 1mm 0; }
  .print-sheet .tk svg { width: 20mm; height: 20mm; }
  @page { margin: 8mm; }
}
.print-preview .print-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.print-preview .tk { background: #fff; border: 1.5px dashed #b9c2d6; border-radius: 10px; padding: 10px; text-align: center; font-size: 12px; }
.print-preview .tk b { display: block; font-size: 13px; }
.print-preview .tk .code { font-family: var(--mono); font-size: 17px; font-weight: 800; letter-spacing: 0.05em; margin: 3px 0; }
.print-preview .tk svg { width: 80px; height: 80px; }
