/* Layout */
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.stack > * + * { margin-top: var(--gap, 16px); }
.row { display: flex; gap: 16px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.hide-mobile { }
.only-mobile { display: none; }

.muted { color: var(--text-muted); }
.soft  { color: var(--text-soft); }
.mono  { font-family: var(--font-mono); }
.num   { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.center { text-align: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-24 { gap: 24px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mt-48 { margin-top: 48px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--radius); font-weight: 600; font-size: .95rem;
  border: 1px solid transparent; transition: transform .06s ease, background .2s, border .2s, box-shadow .2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy-800); color: #fff; }
.btn-primary:hover { background: var(--navy-700); box-shadow: var(--shadow-md); }
.btn-success { background: var(--emerald-500); color: #052e21; }
.btn-success:hover { background: var(--emerald-600); color: #fff; }
.btn-ghost   { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-sunken); }
.btn-outline { border-color: var(--navy-800); color: var(--navy-800); }
.btn-link    { color: var(--electric-500); padding: 6px 4px; }
.btn-link:hover { text-decoration: underline; }
.btn-danger  { background: var(--red-500); color: #fff; }
.btn-block { width: 100%; }
.btn.sm { padding: 8px 12px; font-size: .85rem; border-radius: 10px; }
.btn.lg { padding: 16px 24px; font-size: 1rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow-sm);
}
.card.tight { padding: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card-title { font-size: .8rem; text-transform: uppercase; letter-spacing:.08em; color: var(--text-muted); font-weight: 600;}
.section-title { font-size: 1.05rem; font-weight: 700; }

/* Badges & pills */
.badge {
  display: inline-flex; align-items:center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: var(--bg-sunken); color: var(--text-muted); border: 1px solid var(--border);
}
.badge-success { background: color-mix(in oklab, var(--emerald-500) 15%, transparent); color: var(--emerald-600); border-color: transparent;}
.badge-warning { background: var(--amber-100); color: #92400E; border-color: transparent;}
.badge-danger  { background: var(--red-100); color: #991B1B; border-color: transparent;}
.badge-info    { background: var(--electric-100); color: var(--electric-600); border-color: transparent;}
.badge-pending { background: #E2E8F0; color: #334155; border-color: transparent;}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pending); display: inline-block; }
.dot.success { background: var(--emerald-500);} .dot.danger{background:var(--red-500);} .dot.warning{background:var(--amber-500);} .dot.info{background:var(--electric-500);}

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .82rem; color: var(--text-muted); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; padding: 12px 14px; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: var(--radius); color: var(--text);
  transition: border .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--electric-500); box-shadow: 0 0 0 4px var(--ring); }
.input.invalid { border-color: var(--red-500); }
.hint { font-size: .78rem; color: var(--text-soft); }
.error { font-size: .78rem; color: var(--red-500); }
.checkbox { display: inline-flex; gap: 8px; align-items: flex-start; font-size: .9rem; color: var(--text-muted); }
.checkbox input { margin-top: 3px; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing:.05em; color: var(--text-muted); background: var(--bg-sunken);}
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: color-mix(in oklab, var(--electric-500) 4%, transparent); }
.table td .amt { font-variant-numeric: tabular-nums; font-weight: 600; }
.amt.plus  { color: var(--emerald-600); }
.amt.minus { color: var(--red-500); }

/* Toasts */
.toast-host { position: fixed; z-index: 90; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
  padding: 12px 14px; background: var(--card); border: 1px solid var(--border);
  border-left: 4px solid var(--electric-500); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  animation: slideIn .3s ease;
}
.toast.success { border-left-color: var(--emerald-500); }
.toast.warning { border-left-color: var(--amber-500); }
.toast.error   { border-left-color: var(--red-500); }
.toast .t-title { font-weight: 600; font-size: .9rem; }
.toast .t-msg { font-size: .85rem; color: var(--text-muted); margin-top:2px; }
@keyframes slideIn { from{opacity:0; transform: translateY(10px);} to{opacity:1; transform:none;} }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(6,21,33,.55); backdrop-filter: blur(6px); z-index: 80; display:flex; align-items:center; justify-content:center; padding:20px;}
.modal { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 460px; overflow: hidden; animation: pop .2s ease;}
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--border); font-weight:700;}
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display:flex; gap:10px; justify-content:flex-end;}
@keyframes pop { from{opacity:0; transform: scale(.96);} to{opacity:1; transform:none;} }

/* Spinner — primitive partagée (client, onboarding et admin).
   Définie ici et plus dans admin.css : 22 pages non-admin l'utilisaient
   sans jamais charger admin.css, donc sans aucun rendu visible. */
.spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--emerald-500); border-radius: 50%; animation: admin-spin .8s linear infinite; margin: auto; }
@keyframes admin-spin { to { transform: rotate(360deg); } }

/* Skeleton */
.skeleton { background: linear-gradient(90deg, var(--bg-sunken), var(--border), var(--bg-sunken)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; height: 14px; }
@keyframes shimmer { from{background-position: 200% 0;} to{background-position: -200% 0;} }

/* Empty */
.empty { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%; background: var(--bg-sunken); display:grid; place-items:center; color: var(--text-soft);}

/* Progress */
.progress { height: 8px; background: var(--bg-sunken); border-radius: 999px; overflow: hidden;}
.progress > span { display:block; height:100%; background: linear-gradient(90deg, var(--electric-500), var(--emerald-500)); border-radius: 999px; }

/* Steps */
.steps { display: flex; gap: 8px; }
.steps .step { flex: 1; height: 4px; background: var(--bg-sunken); border-radius: 4px; }
.steps .step.done { background: var(--emerald-500); }
.steps .step.current { background: var(--electric-500); }

/* PIN */
.pin { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; max-width: 320px; margin: 0 auto;}
.pin input { width: 100%; min-width: 0; text-align:center; font-size: 1.6rem; padding: 18px 0; letter-spacing: 0.2em;}
.keypad { display:grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 340px; margin: 24px auto 0;}
.keypad button { padding: 16px; font-size: 1.25rem; font-weight:600; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); }
.keypad button:hover { background: var(--bg-sunken);}
.keypad button.wide { grid-column: span 1; }

/* Balance card */
.balance-card {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--navy-800), var(--navy-700) 60%, #0D7B45);
  color: #fff; border-radius: var(--radius-xl); padding: 28px; box-shadow: var(--shadow-lg);
}
.balance-card::before {
  content:""; position:absolute; right: -60px; top: -60px; width:220px; height:220px;
  background: radial-gradient(circle, rgba(16,185,129,.35), transparent 60%);
  pointer-events:none;
}
.balance-card::after {
  content:""; position:absolute; left: -40px; bottom: -60px; width:200px; height:200px;
  background: radial-gradient(circle, rgba(13,146,80,.35), transparent 60%);
  pointer-events:none;
}
.balance-card .lbl { text-transform: uppercase; letter-spacing:.1em; font-size:.75rem; color: rgba(255,255,255,.7);}
.balance-card .amt { font-family: var(--font-display); font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 6px;}
.balance-card .meta { display:flex; gap:24px; margin-top: 18px; flex-wrap: wrap;}
.balance-card .meta .m { display:flex; flex-direction:column;}
.balance-card .meta .m span:first-child { font-size:.7rem; color: rgba(255,255,255,.6); text-transform:uppercase; letter-spacing:.1em;}
.balance-card .meta .m span:last-child { font-weight:600; font-variant-numeric: tabular-nums;}

/* Quick actions */
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.qa {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 12px; display:flex; flex-direction:column; align-items:center; gap:8px; transition: transform .1s, border-color .2s;
  color: var(--text); font-weight: 600; font-size: .9rem;
}
.qa:hover { border-color: var(--electric-500); transform: translateY(-2px);}
.qa .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in oklab, var(--electric-500) 12%, transparent); color: var(--electric-500);}
.qa .ic.g { background: color-mix(in oklab, var(--emerald-500) 15%, transparent); color: var(--emerald-600);}
.qa .ic.n { background: color-mix(in oklab, var(--navy-800) 12%, transparent); color: var(--navy-800);}

/* Tag list */
.chip { display:inline-flex; align-items:center; gap:6px; padding: 6px 12px; border-radius:999px; background: var(--bg-sunken); font-size:.8rem; color: var(--text-muted); border: 1px solid var(--border);}
.chip.active { background: var(--navy-800); color:#fff; border-color: var(--navy-800);}

/* Divider */
.divider { height:1px; background: var(--border); border:0; margin: 20px 0;}

/* Utility  */
.text-success { color: var(--emerald-600);} 
.text-danger  { color: var(--red-500);}
.text-info    { color: var(--electric-500);}
.bg-sunken    { background: var(--bg-sunken);}

/* FAQ */
.acc-item { border-bottom: 1px solid var(--border); padding: 14px 0;}
.acc-item summary { cursor: pointer; font-weight:600; display:flex; justify-content:space-between; align-items:center; list-style:none; }
.acc-item summary::-webkit-details-marker{ display:none; }
.acc-item summary::after { content:"+"; font-size: 1.2rem; color: var(--text-muted);}
.acc-item[open] summary::after { content:"−"; }
.acc-item p { margin-top: 10px; }

/* Icon */
.i { width: 20px; height: 20px; flex-shrink: 0; }
.i-lg { width: 28px; height: 28px; }
i[data-lucide] { display: inline-flex; vertical-align: middle; }

/* Tranche 1 — lecture financière claire */
.amt.neutral { color: var(--text-muted); }
.activity-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.activity-stat {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft, rgba(148, 163, 184, .08));
}
.activity-stat span { display: block; color: var(--text-muted); font-size: .76rem; }
.activity-stat strong { display: block; margin-top: 4px; font-size: .9rem; }
.notification-preview,
.notification-row { border-radius: 10px; transition: background .15s ease; }
.notification-preview:hover,
.notification-row:hover { background: rgba(37, 99, 235, .06); }
.notification-preview:focus-visible,
.notification-row:focus-visible { outline: 2px solid var(--primary-500, #0D9250); outline-offset: 2px; }
@media (max-width: 560px) {
  .activity-summary { grid-template-columns: 1fr; }
}
