/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg0: #0A0F1E;
  --bg1: #111827;
  --bg2: #1A2235;
  --bg3: #1E293B;
  --border: #2A3A50;
  --text: #E2E8F0;
  --muted: #64748B;
  --hint: #94A3B8;
  --blue: #1D6FA8;
  --blue-l: #2d87c8;
  --gold: #EF9F27;
  --gold-l: #f5b84a;
  --red: #E24B4A;
  --green: #1D9E75;
  --radius: 14px;
  --radius-sm: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif; background: var(--bg0); color: var(--text); overflow: hidden; }
input, select, textarea, button { font-family: inherit; font-size: 15px; }
button { cursor: pointer; border: none; background: none; }

/* ── Screens ───────────────────────────────────────────────────────────────── */
.screen { position: fixed; inset: 0; display: none; overflow: hidden; }
.screen.active { display: flex; flex-direction: column; }

/* ── Licence Screen ────────────────────────────────────────────────────────── */
.licence-wrap { flex: 1; overflow-y: auto; padding: 24px 20px calc(40px + var(--safe-bottom)); display: flex; flex-direction: column; align-items: center; background: var(--bg0); }
.logo-big { text-align: center; margin-bottom: 32px; }
.logo-icon-big { display: inline-flex; width: 88px; height: 88px; background: var(--blue); border-radius: 24px; align-items: center; justify-content: center; margin-bottom: 14px; position: relative; }
.phone-icon { width: 44px; height: 58px; border: 3px solid rgba(255,255,255,0.3); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.phone-screen { width: 32px; height: 40px; background: rgba(255,255,255,0.15); border-radius: 4px; display: flex; align-items: flex-end; padding: 4px; gap: 3px; }
.bars { display: flex; align-items: flex-end; gap: 3px; width: 100%; }
.bar { width: 6px; border-radius: 2px; background: rgba(255,255,255,0.7); }
.b1 { height: 8px; }
.b2 { height: 14px; }
.b3 { height: 20px; }
.bar.gold { background: var(--gold); }
.dot-gold { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; background: var(--gold); border-radius: 50%; border: 2px solid var(--bg0); }
.dot-gold-sm { position: absolute; top: -4px; right: -4px; width: 10px; height: 10px; background: var(--gold); border-radius: 50%; border: 1.5px solid var(--bg1); }
.logo-sm { position: relative; }

/* ── Crédits ── */
.credit-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px; margin-bottom: 14px; }
.credit-sum-item { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; text-align: center; }
.credit-sum-val { font-size: 20px; font-weight: 800; color: var(--gold); }
.credit-sum-lbl { font-size: 10px; color: var(--muted); margin-top: 3px; text-transform: uppercase; letter-spacing: .04em; }
.credit-card { background: var(--bg2); border: 1px solid var(--border); border-left: 3px solid var(--gold); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.credit-card-nom { font-size: 14px; font-weight: 700; color: var(--text); }
.credit-card-detail { font-size: 11px; color: var(--muted); margin-top: 3px; }
.credit-card-montant { font-size: 17px; font-weight: 800; color: var(--gold); margin: 8px 0; }
.credit-card-actions { display: flex; gap: 8px; margin-top: 10px; }
.logo-text-big { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }
.logo-text-big .gold { color: var(--gold); }
.logo-text-big .mob { color: var(--blue); font-size: 20px; vertical-align: super; font-weight: 700; }
.logo-sub-big { font-size: 13px; color: var(--muted); margin-top: 4px; }
.licence-card { width: 100%; max-width: 400px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.lc-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.lc-sub { font-size: 13px; color: var(--muted); margin-bottom: 20px; }

/* ── App Header ────────────────────────────────────────────────────────────── */
.app-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); background: var(--bg1); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.header-logo { display: flex; align-items: center; gap: 10px; }
.logo-sm { width: 36px; height: 36px; background: var(--blue); border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.logo-icon-sm { display: flex; align-items: flex-end; gap: 2px; padding-bottom: 3px; }
.bar-sm { width: 4px; border-radius: 1px; background: rgba(255,255,255,0.8); }
.bar-sm:nth-child(1) { height: 8px; }
.bar-sm:nth-child(2) { height: 13px; }
.bar-sm:nth-child(3) { height: 18px; }
.bar-sm.gold-sm { background: var(--gold); }
.header-title { font-size: 16px; font-weight: 800; line-height: 1; }
.header-title .gold { color: var(--gold); }
.header-shop { font-size: 11px; color: var(--muted); margin-top: 2px; }
.header-right { display: flex; align-items: center; gap: 8px; }
.header-date { font-size: 11px; color: var(--muted); }
.btn-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: var(--bg3); border-radius: 8px; font-size: 18px; color: var(--text); }

/* ── Main Content ──────────────────────────────────────────────────────────── */
.app-main { flex: 1; overflow: hidden; position: relative; }
.page { position: absolute; inset: 0; overflow-y: auto; padding: 16px 16px calc(80px + var(--safe-bottom)); display: none; }
.page.active { display: block; }

/* ── Bottom Nav ────────────────────────────────────────────────────────────── */
.bottom-nav { display: flex; align-items: center; background: var(--bg1); border-top: 1px solid var(--border); padding-bottom: var(--safe-bottom); flex-shrink: 0; }
.nav-btn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 4px; gap: 3px; color: var(--muted); transition: color 0.15s; }
.nav-btn.active { color: var(--blue); }
.nav-icon { font-size: 20px; line-height: 1; }
.nav-label { font-size: 10px; font-weight: 500; }
.nav-center { position: relative; }
.nav-center-btn { width: 52px; height: 52px; background: var(--blue); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 28px; color: white; font-weight: 300; margin-top: -20px; box-shadow: 0 4px 16px rgba(29,111,168,0.4); }

/* ── Dashboard ─────────────────────────────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.stat-card { border-radius: var(--radius); padding: 16px; }
.stat-card.blue { background: var(--blue); }
.stat-card.gold-card { background: var(--gold); }
.stat-card.dark { background: var(--bg2); border: 1px solid var(--border); }
.stat-card.red-card { background: rgba(226,75,74,0.15); border: 1px solid rgba(226,75,74,0.3); }
.stat-label { font-size: 11px; opacity: 0.8; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.stat-value { font-size: 18px; font-weight: 800; letter-spacing: -0.5px; }
.stat-sub { font-size: 11px; opacity: 0.75; margin-top: 4px; }
.actions-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.action-btn { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; transition: background 0.15s; }
.action-btn:active { background: var(--bg3); }
.action-icon { font-size: 28px; line-height: 1; }
.action-label { font-size: 11px; font-weight: 600; color: var(--hint); text-align: center; }

/* ── Section titles ────────────────────────────────────────────────────────── */
.section-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; margin-top: 4px; }
.badge { display: inline-flex; align-items: center; justify-content: center; background: var(--blue); color: white; border-radius: 50%; width: 20px; height: 20px; font-size: 11px; font-weight: 700; margin-left: 6px; }

/* ── Page headers ──────────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.page-header h2 { flex: 1; font-size: 20px; font-weight: 800; }
.btn-back { color: var(--blue); font-size: 14px; font-weight: 600; padding: 6px 0; flex-shrink: 0; }
.btn-add { background: var(--blue); color: white; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; flex-shrink: 0; border: none; cursor: pointer; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; padding: 13px 14px; background: var(--bg3); border: 1.5px solid var(--border); border-radius: 10px; color: var(--text); outline: none; transition: border-color 0.15s; }
.field input:focus, .field select:focus { border-color: var(--blue); background: var(--bg1); }
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394A3B8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; }
.btn-sm { background: var(--bg3); border: 1px solid var(--border); color: var(--hint); padding: 0 12px; border-radius: 10px; font-size: 13px; white-space: nowrap; }
.radio-group { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-option { display: flex; align-items: center; gap: 6px; font-size: 14px; padding: 8px 12px; background: var(--bg3); border: 1.5px solid var(--border); border-radius: 8px; cursor: pointer; }
.radio-option input[type=radio]:checked + span, .radio-option:has(input:checked) { border-color: var(--blue); }
.input-inline { display: flex; align-items: center; gap: 6px; }
.input-inline input { width: 80px; padding: 6px 10px; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; color: var(--text); }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn-primary { background: var(--blue); color: white; padding: 14px 20px; border-radius: 12px; font-size: 15px; font-weight: 700; transition: background 0.15s; }
.btn-primary:active { background: var(--blue-l); }
.btn-secondary { background: var(--bg3); color: var(--text); padding: 14px 20px; border-radius: 12px; font-size: 15px; font-weight: 600; border: 1px solid var(--border); }
.btn-danger { background: rgba(226,75,74,0.15); color: #E24B4A; padding: 14px 20px; border-radius: 12px; font-size: 15px; font-weight: 600; border: 1px solid rgba(226,75,74,0.3); }
.btn-whatsapp { background: #25D366; color: white; padding: 14px 20px; border-radius: 12px; font-size: 15px; font-weight: 700; }
.btn-full { width: 100%; display: block; text-align: center; margin-top: 6px; }
.btn-vendre { margin-top: 16px; font-size: 17px; padding: 16px; }

/* ── Ventes ────────────────────────────────────────────────────────────────── */
.produits-liste { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; margin-bottom: 16px; }
.produit-item { display: flex; align-items: center; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; gap: 10px; }
.pi-info { flex: 1; }
.pi-nom { font-size: 14px; font-weight: 600; }
.pi-prix { font-size: 12px; color: var(--gold); font-weight: 600; }
.pi-stock { font-size: 11px; color: var(--muted); }
.pi-add { width: 34px; height: 34px; background: var(--blue); border-radius: 8px; color: white; font-size: 20px; display: flex; align-items: center; justify-content: center; }
.panier-section { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-top: 8px; }
.panier-items { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.panier-item { display: flex; align-items: center; gap: 8px; padding: 8px; background: var(--bg3); border-radius: 8px; }
.pan-nom { flex: 1; font-size: 13px; font-weight: 600; }
.pan-prix { font-size: 13px; color: var(--gold); font-weight: 600; white-space: nowrap; }
.pan-qty { display: flex; align-items: center; gap: 6px; }
.pan-qty button { width: 28px; height: 28px; background: var(--bg2); border-radius: 6px; color: var(--text); font-size: 16px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); }
.pan-qty span { font-size: 15px; font-weight: 700; min-width: 24px; text-align: center; }
.panier-total { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.total-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.total-row.discount { color: var(--muted); }
.total-row.total-final { font-size: 18px; font-weight: 800; color: var(--gold); border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }
.monnaie-info { font-size: 13px; color: var(--green); margin-top: 4px; font-weight: 600; }

/* ── Stock / Clients / Items liste ─────────────────────────────────────────── */
.search-bar { margin-bottom: 12px; }
.search-bar input { width: 100%; padding: 12px 14px; background: var(--bg2); border: 1.5px solid var(--border); border-radius: 10px; color: var(--text); font-size: 14px; outline: none; }
.search-bar input:focus { border-color: var(--blue); }
.items-liste { display: flex; flex-direction: column; gap: 8px; }
.item-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: flex; align-items: center; gap: 12px; }
.item-card:active { background: var(--bg3); }
.item-icon { width: 42px; height: 42px; background: var(--bg3); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.item-info { flex: 1; min-width: 0; }
.item-name { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.item-badge { font-size: 13px; font-weight: 700; color: var(--gold); white-space: nowrap; }
.item-actions { display: flex; gap: 6px; }
.btn-edit { width: 32px; height: 32px; background: var(--bg3); border-radius: 6px; border: 1px solid var(--border); color: var(--hint); font-size: 14px; display: flex; align-items: center; justify-content: center; }
.badge-danger { color: var(--red); }
.badge-warn { color: var(--gold); }
.badge-ok { color: var(--green); }

/* ── Caisse ────────────────────────────────────────────────────────────────── */
.caisse-content { display: flex; flex-direction: column; gap: 16px; }
.caisse-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.caisse-ventes { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cv-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.cv-header span { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Rapports ──────────────────────────────────────────────────────────────── */
.rapport-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.rtab { flex: 1; padding: 10px; background: var(--bg2); border: 1.5px solid var(--border); border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.rtab.active { background: var(--blue); border-color: var(--blue); color: white; }
.rapport-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.rapport-card-title { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 12px; }
.paie-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 12px; border-bottom: 1px solid var(--border); }
.paie-row:last-child { border-bottom: none; }
.top-prod-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.top-prod-row:last-child { border-bottom: none; }

/* ── Paramètres ────────────────────────────────────────────────────────────── */
.params-list { display: flex; flex-direction: column; gap: 4px; }
.param-section { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 20px; margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.upload-zone { background: var(--bg3); border: 2px dashed var(--border); border-radius: 12px; padding: 16px; cursor: pointer; min-height: 80px; display: flex; align-items: center; justify-content: center; }
.upload-placeholder { font-size: 13px; color: var(--muted); text-align: center; }
.upload-preview img { max-height: 80px; border-radius: 6px; }
.licence-info-box { background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--hint); }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: none; align-items: flex-end; justify-content: center; z-index: 100; }
.modal.open { display: flex; }
/* max-height utilise dvh (dynamic viewport = exclut le clavier sur mobile) */
.modal-content {
  background: var(--bg1);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0;
  width: 100%;
  max-height: 92dvh;
  max-height: 92vh; /* fallback */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 20px 8px;
}
.modal-header {
  display: flex;
  align-items: center;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { flex: 1; font-size: 18px; font-weight: 800; }
.modal-close { width: 32px; height: 32px; background: var(--bg3); border-radius: 50%; color: var(--muted); font-size: 14px; display: flex; align-items: center; justify-content: center; }
.modal-actions {
  display: flex;
  gap: 10px;
  padding: 12px 20px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg1);
}
.modal-actions button { flex: 1; }

/* ── Reçu ──────────────────────────────────────────────────────────────────── */
.recu-preview { background: white; color: #1A1A2E; border-radius: 10px; padding: 4px; overflow-y: auto; max-height: 65vh; }
.recu-wrap { background: #fff; color: #111; font-family: 'Courier New', monospace; font-size: 12px; padding: 16px; min-width: 280px; }
.recu-header { text-align: center; border-bottom: 2px dashed #bbb; padding-bottom: 10px; margin-bottom: 10px; }
.recu-boutique { font-size: 17px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.recu-info { font-size: 11px; color: #444; margin-top: 2px; }
.recu-num { font-size: 11px; color: #555; margin-top: 8px; line-height: 1.5; }
.recu-client { font-size: 12px; font-weight: 700; margin-top: 6px; }
.recu-table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.recu-table th { font-size: 11px; font-weight: 700; border-bottom: 1px solid #ccc; padding: 3px 2px; text-align: left; }
.recu-table td { font-size: 11px; padding: 4px 2px; border-bottom: 1px dotted #eee; vertical-align: top; }
.ri-nom  { width: 45%; }
.ri-qty  { width: 10%; text-align: center; }
.ri-pu   { width: 20%; text-align: right; }
.ri-total{ width: 25%; text-align: right; font-weight: 700; }
.recu-totaux { border-top: 2px dashed #bbb; padding-top: 8px; margin-top: 6px; }
.recu-row-total { display: flex; justify-content: space-between; font-size: 12px; padding: 2px 0; }
.recu-remise { color: #c0392b; }
.recu-grand-total { font-size: 15px; font-weight: 800; border-top: 1px solid #ccc; padding-top: 6px; margin-top: 4px; }
.recu-mode { font-size: 10px; color: #666; margin-top: 5px; }
.recu-signatures { display: flex; justify-content: space-between; margin-top: 14px; border-top: 1px dashed #bbb; padding-top: 10px; }
.recu-sig-block { width: 46%; text-align: center; }
.recu-sig-label { font-size: 10px; color: #666; margin-bottom: 5px; }
.recu-sig-img { max-width: 100%; max-height: 55px; object-fit: contain; }
.recu-sig-vide { height: 45px; border-bottom: 1px solid #ccc; }
.recu-footer { text-align: center; margin-top: 12px; padding-top: 8px; border-top: 1px dashed #bbb; }
.recu-merci { font-size: 12px; font-weight: 700; }
.recu-powered { font-size: 9px; color: #aaa; margin-top: 4px; }

/* ── Menu latéral ──────────────────────────────────────────────────────────── */
.menu-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; display: none; }
.menu-overlay.open { display: block; }
.menu-lateral { position: fixed; right: -280px; top: 0; bottom: 0; width: 280px; background: var(--bg1); border-left: 1px solid var(--border); z-index: 201; transition: right 0.25s ease; display: flex; flex-direction: column; padding-bottom: var(--safe-bottom); }
.menu-lateral.open { right: 0; }
.menu-header { padding: 20px 16px; padding-top: calc(20px + env(safe-area-inset-top, 0px)); border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; }
.menu-shop { flex: 1; font-size: 17px; font-weight: 800; }
.menu-licence { font-size: 11px; color: var(--green); margin-top: 3px; }
.menu-items { flex: 1; overflow-y: auto; padding: 8px 0; }
.menu-item { width: 100%; text-align: left; padding: 14px 20px; font-size: 15px; color: var(--text); display: flex; align-items: center; gap: 10px; }
.menu-item:active { background: var(--bg2); }
.menu-divider { height: 1px; background: var(--border); margin: 8px 0; }

/* ── Dernières ventes ──────────────────────────────────────────────────────── */
.liste-ventes { display: flex; flex-direction: column; gap: 8px; }
.vente-row { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.vente-row:active { background: var(--bg3); }
.vr-dot { width: 8px; height: 8px; background: var(--green); border-radius: 50%; flex-shrink: 0; }
.vr-info { flex: 1; }
.vr-montant { font-size: 15px; font-weight: 700; }
.vr-client { font-size: 12px; color: var(--muted); }
.vr-heure { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: calc(80px + var(--safe-bottom) + 12px); left: 50%; transform: translateX(-50%) translateY(20px); background: var(--bg1); border: 1px solid var(--border); color: var(--text); padding: 12px 20px; border-radius: 24px; font-size: 14px; font-weight: 600; opacity: 0; transition: all 0.25s ease; z-index: 300; white-space: nowrap; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--green); border-color: var(--green); color: white; }
.toast.error { background: var(--red); border-color: var(--red); color: white; }

/* ── Error box ─────────────────────────────────────────────────────────────── */
.err-box { background: rgba(226,75,74,0.1); border: 1px solid rgba(226,75,74,0.3); color: #fca5a5; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.licence-info { font-size: 12px; color: var(--muted); text-align: center; margin-top: 16px; line-height: 1.6; }

/* ── Animations ────────────────────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.page.active > * { animation: fadeIn 0.2s ease; }

/* ── Dropdown clients ──────────────────────────────────────────────────────── */
#clients-dropdown > div > div:active { background: var(--bg3); }
#clients-dropdown > div > div:hover { background: var(--bg2); }

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Filtres boutons ─────────────────────────── */
.filter-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: white;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s;
}
.filter-btn.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
  font-weight: 600;
}

/* ── Écran Rôle ─────────────────────────────────────────────────────────────── */
.role-wrap { flex:1; overflow-y:auto; padding:40px 20px; display:flex; flex-direction:column; align-items:center; justify-content:center; background:var(--bg0); }
.role-btn { width:100%; max-width:340px; display:flex; align-items:center; gap:14px; padding:16px 18px; background:var(--bg2); border:2px solid var(--border); border-radius:16px; margin-bottom:12px; cursor:pointer; transition:all .15s; }
.role-btn:active { transform:scale(.98); opacity:.9; }
.role-icon { font-size:28px; flex-shrink:0; }
.role-info { flex:1; text-align:left; }
.role-nom { font-size:17px; font-weight:800; }
.role-desc { font-size:11px; color:var(--muted); margin-top:2px; }

/* ── Écran PIN ──────────────────────────────────────────────────────────────── */
.pin-wrap { flex:1; display:flex; flex-direction:column; justify-content:center; align-items:center; padding:32px 20px; background:var(--bg0); }
.pin-clavier { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; width:100%; max-width:280px; }
.pin-key { padding:18px; background:var(--bg2); border:1.5px solid var(--border); border-radius:14px; font-size:22px; font-weight:700; color:var(--text); cursor:pointer; transition:all .1s; }
.pin-key:active { background:var(--bg3); transform:scale(.95); }
.pin-key-annuler { font-size:12px; font-weight:600; color:var(--muted); }
.pin-key-effacer { font-size:18px; color:var(--muted); }

/* ── Toggle Switch ──────────────────────────────────────────────────────────── */
.toggle-switch { position:relative; display:inline-block; width:48px; height:26px; flex-shrink:0; }
.toggle-switch input { opacity:0; width:0; height:0; }
.toggle-slider { position:absolute; cursor:pointer; inset:0; background:var(--border); border-radius:26px; transition:.3s; }
.toggle-slider:before { position:absolute; content:''; height:20px; width:20px; left:3px; bottom:3px; background:white; border-radius:50%; transition:.3s; }
input:checked + .toggle-slider { background:var(--green); }
input:checked + .toggle-slider:before { transform:translateX(22px); }
