/* Fidelis — design system (bloc néon)
   Jaune + rose, palette overridable via CSS variables. */

:root {
  --acc: #ffd23a;
  --acc2: #ff5cc8;
  --accRgb: 255, 210, 58;
  --acc2Rgb: 255, 92, 200;
  --bg: #0a0a0a;
  --bg-sidebar: #0c0c0e;
  --line: rgba(255, 255, 255, .08);
  --line-soft: rgba(255, 255, 255, .06);
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, .55);
  --text-faint: rgba(255, 255, 255, .4);
  --danger: #e0532f;
  --danger-text: #ff7a5c;
  --ok: #1e7a5e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100%;
}

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; margin: 0; letter-spacing: -.02em; }

a { text-decoration: none; color: inherit; }

img { max-width: 100%; display: block; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 44px; }

@media (max-width: 720px) {
  .container { padding: 0 18px; }
}

/* ---------- Logo ---------- */
.logo { display: flex; align-items: center; gap: 9px; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: var(--acc); color: #000;
  display: flex; align-items: center; justify-content: center;
  font: 800 16px 'Space Grotesk';
}
.logo-mark.sm { width: 26px; height: 26px; font-size: 14px; }
.logo-word { font: 700 18px 'Space Grotesk'; letter-spacing: -.02em; }

/* ---------- Buttons ---------- */
.btn {
  border: none; cursor: pointer; font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .04em;
  border-radius: 12px; padding: 15px; transition: transform .12s, box-shadow .12s, filter .12s, background .12s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn:active { transform: translateY(0); }
.btn:disabled { cursor: not-allowed; transform: none; filter: none; background: rgba(255,255,255,.12); color: rgba(255,255,255,.35); }
.btn-block { width: 100%; }
.btn-auto { width: auto; }

/* Compat : nos vues utilisent `.btn` seul par défaut -> même rendu que btn-accent */
.btn { background: var(--acc); color: #000; width: auto; padding: 13px 22px; margin-top: 10px; }
.btn-white { background: #fff; color: #000; }
.btn-accent { background: var(--acc); color: #000; }
.btn-outline {
  background: transparent; color: #fff; border: 2px solid rgba(255, 255, 255, .15);
  padding: 13px 24px;
}
.btn-ghost {
  background: rgba(255, 255, 255, .08); color: #fff; border-radius: 8px;
  padding: 7px 11px; font-size: 11px;
}
.btn-danger, .btn.danger { background: rgba(224, 83, 47, .15); color: var(--danger-text); border-radius: 8px; padding: 7px 11px; font-size: 11px; margin-top: 0; }
.btn-sm { padding: 9px 14px; font-size: 11px; border-radius: 10px; }
td .btn, .actions-cell .btn { margin-top: 0; padding: 9px 14px; font-size: 11px; border-radius: 10px; }

.pill {
  background: var(--acc); color: #000; border-radius: 11px; padding: 9px 14px;
  font: 700 12px 'Space Grotesk'; letter-spacing: .02em; border: none; cursor: pointer;
}

/* ---------- Forms ---------- */
label, .label { font: 600 12px Inter; color: var(--text-dim); margin-bottom: 6px; display: block; }
.field, input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), textarea, select {
  width: 100%; background: rgba(255, 255, 255, .05); border: 2px solid rgba(255, 255, 255, .13);
  border-radius: 12px; padding: 13px 14px; font: 500 14px Inter; color: #fff;
  margin-top: 4px; margin-bottom: 14px; font-family: Inter, sans-serif;
}
.field::placeholder, input::placeholder, textarea::placeholder { color: rgba(255, 255, 255, .4); }
.field:focus, input:focus, textarea:focus, select:focus { outline: none; border-color: var(--acc); }
textarea.field, textarea { resize: vertical; line-height: 1.5; }
.field-row { display: flex; gap: 14px; }
.field-row-sm { display: flex; gap: 8px; }
.form-group { margin-bottom: 14px; }
.checkbox-row, .consent-row {
  display: flex; gap: 9px; align-items: center; font: 500 12px Inter; color: var(--text-dim); cursor: pointer;
  margin-bottom: 10px;
}
.checkbox-row input, .consent-row input { width: 18px; height: 18px; flex: none; accent-color: var(--acc); }
input[type=color] { -webkit-appearance: none; width: 46px; height: 38px; border: 2px solid rgba(255,255,255,.13); border-radius: 10px; padding: 2px; background: transparent; cursor: pointer; }
input[type=file] { color: var(--text-dim); font: 500 12px Inter; margin-bottom: 10px; }
fieldset.fieldset, fieldset { border: 1px solid rgba(255,255,255,.09); border-radius: 16px; padding: 18px; margin: 0 0 18px; }
legend, fieldset > legend { font: 700 13px 'Space Grotesk'; padding: 0 8px; }
.check-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.hint { font: 400 12px/1.5 Inter; color: var(--text-faint); margin: 6px 0; }

/* ---------- Cards / surfaces ---------- */
.card, .panel {
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 16px; padding: 22px; margin-bottom: 20px;
}
.card-tight { padding: 18px; }
.card-title { font: 700 13px 'Space Grotesk'; margin-bottom: 16px; }
.panel h2 { font-size: 16px; margin-bottom: 14px; }

.badge {
  display: inline-block; font: 700 10px 'Space Grotesk'; padding: 4px 9px; border-radius: 20px; letter-spacing: .02em;
}
.badge-accent { background: rgba(var(--accRgb), .16); color: var(--acc); }
.badge-muted { background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .5); }
.eyebrow {
  display: inline-block; background: rgba(var(--accRgb), .14); color: var(--acc);
  font: 700 11px 'Space Grotesk'; letter-spacing: .06em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 20px;
}

/* ---------- Alerts (compat vues réelles) ---------- */
.alert { border-radius: 12px; padding: 12px 16px; font: 500 13px Inter; margin-bottom: 16px; }
.alert.error { background: rgba(224, 83, 47, .12); color: var(--danger-text); border: 1px solid rgba(224, 83, 47, .3); }
.alert.ok { background: rgba(var(--accRgb), .12); color: var(--acc); border: 1px solid rgba(var(--accRgb), .3); }

/* ---------- Loyalty card ---------- */
.loy-card { background: var(--acc2); border-radius: 18px; padding: 22px; color: #000; }
.loy-card .loy-name { font: 700 19px 'Space Grotesk'; }
.loy-card .loy-sub { font: 600 11px 'Space Grotesk'; color: rgba(0, 0, 0, .6); margin-top: 2px; }
.loy-card .loy-reward { font: 700 12px 'Space Grotesk'; margin-top: 10px; }
.loy-stamps { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 10px; }
.loy-stamp { width: 22px; height: 22px; background: #000; }
.loy-stamp.empty { background: rgba(0, 0, 0, .2); }
.loy-banner {
  height: 70px; border-radius: 10px; margin-bottom: 16px;
  background: repeating-linear-gradient(45deg, rgba(0, 0, 0, .12) 0 8px, rgba(0, 0, 0, .05) 8px 16px);
  display: flex; align-items: center; justify-content: center;
  font: 600 10px ui-monospace, monospace; color: rgba(0, 0, 0, .4);
}
.loy-banner img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.card-strip { width: 100%; border-radius: 10px; object-fit: cover; max-height: 140px; margin-bottom: 10px; }

/* ---------- QR (vraies images générées serveur) ---------- */
.qr { background: #fff; border-radius: 12px; padding: 12px; display: inline-block; }
.qr img { width: 100%; height: auto; border-radius: 4px; }

/* ---------- Public nav (marketing) ---------- */
.pubnav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0; border-bottom: 1px solid var(--line-soft);
}
.pubnav-links { display: flex; align-items: center; gap: 30px; font: 600 13px Inter; color: rgba(255, 255, 255, .65); }
.pubnav-links a:hover { color: #fff; }
@media (max-width: 640px) {
  .pubnav-links { gap: 14px; }
  .pubnav-links .nav-only { display: none; }
}

/* ---------- Auth layout ---------- */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 56px 20px; }
main.page { padding: 0 20px; }
.auth-card, .panel.auth { width: 100%; max-width: 400px; background: none; border: none; padding: 0; margin: 60px auto 40px; }
.auth-title, .panel.auth h1 { font: 700 30px 'Space Grotesk'; margin: 0 0 6px; }
.auth-sub, .panel.auth > p { font: 400 14px Inter; color: var(--text-dim); margin: 0 0 26px; }
.auth-footnote, .panel.auth .qr-link { text-align: center; font: 500 13px Inter; color: var(--text-dim); margin-top: 18px; }
.auth-footnote a, .panel.auth .qr-link a { color: var(--acc); font-weight: 600; }
.auth-icon {
  width: 52px; height: 52px; border-radius: 14px; background: rgba(var(--accRgb), .14);
  display: flex; align-items: center; justify-content: center; font: 800 22px 'Space Grotesk'; color: var(--acc);
  margin-bottom: 18px;
}

/* ---------- App shell (sidebar + topbar) ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 238px; flex: none; height: 100vh; position: sticky; top: 0;
  background: var(--bg-sidebar); border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column; padding: 22px 16px;
}
.sidebar-logo { padding: 0 8px 24px; }
.sidebar-groups { display: flex; flex-direction: column; gap: 20px; flex: 1; min-height: 0; overflow-y: auto; }
.sidebar-group-title {
  font: 700 10px 'Space Grotesk'; letter-spacing: .16em; color: rgba(255, 255, 255, .32); padding: 0 8px 8px;
}
.sidebar-items { display: flex; flex-direction: column; gap: 3px; }
.sidebar-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  font: 600 13.5px 'Space Grotesk'; cursor: pointer; border-radius: 4px;
  color: rgba(255, 255, 255, .62); background: transparent;
}
.sidebar-item .dot { width: 7px; height: 7px; flex: none; background: rgba(255, 255, 255, .25); border-radius: 50%; }
.sidebar-item.active { background: var(--acc); color: #000; }
.sidebar-item.active .dot { background: #000; }
.sidebar-item:hover:not(.active) { color: #fff; }
.sidebar-logout {
  display: flex; align-items: center; gap: 10px; padding: 12px 10px; margin-top: 14px;
  border-top: 1px solid var(--line-soft); color: var(--text-dim); font: 600 13px 'Space Grotesk'; cursor: pointer;
  background: none; border-left: none; border-right: none; border-bottom: none; width: 100%; text-align: left;
}
.sidebar-logout .dot { width: 8px; height: 8px; background: rgba(255, 255, 255, .3); display: inline-block; border-radius: 50%; }

.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.app-topbar {
  height: 60px; flex: none; border-bottom: 1px solid var(--line); display: flex;
  align-items: center; justify-content: space-between; padding: 0 30px;
}
.app-topbar h1 { font: 700 18px 'Space Grotesk'; }
.app-topbar-actions { display: flex; align-items: center; gap: 14px; }
.merchant-switch {
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); color: #fff;
  border-radius: 11px; padding: 9px 13px; font: 600 12px 'Space Grotesk'; cursor: pointer;
}
.avatar {
  width: 34px; height: 34px; border-radius: 10px; background: var(--acc2); color: #000;
  display: flex; align-items: center; justify-content: center; font: 700 13px 'Space Grotesk';
}
.app-content { flex: 1; padding: 26px 30px; overflow-y: auto; }

/* Mobile bottom tab bar (remplace la sidebar sous 900px) */
.mobile-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: #0c0c0e; border-top: 1px solid var(--line); justify-content: space-around;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
}
.mobile-nav a {
  display: flex; align-items: center; justify-content: center; width: 44px; height: 34px;
  font: 700 16px 'Space Grotesk'; color: rgba(255, 255, 255, .4); border-radius: 8px;
}
.mobile-nav a.active { background: var(--acc); color: #000; font-size: 11px; }

.mobile-nav .more { position: relative; }
.mobile-nav .more summary {
  display: flex; align-items: center; justify-content: center; width: 44px; height: 34px;
  font: 700 16px 'Space Grotesk'; color: rgba(255, 255, 255, .4); border-radius: 8px;
  cursor: pointer; list-style: none;
}
.mobile-nav .more summary::-webkit-details-marker { display: none; }
.mobile-nav .more.active summary { background: var(--acc); color: #000; font-size: 11px; }
.mobile-nav .more[open] summary { background: rgba(255, 255, 255, .1); color: #fff; }
.more-sheet {
  position: absolute; bottom: 50px; right: 0; background: #161618; border: 1px solid var(--line);
  border-radius: 14px; padding: 8px; min-width: 190px; box-shadow: 0 -10px 30px rgba(0, 0, 0, .4);
  display: flex; flex-direction: column; gap: 2px;
}
.more-sheet a, .more-sheet button {
  display: flex; align-items: center; justify-content: flex-start; padding: 11px 12px; font: 600 13px 'Space Grotesk'; color: #fff;
  border-radius: 8px; background: none; border: none; width: 100%; text-align: left; cursor: pointer;
}
.more-sheet a:hover, .more-sheet button:hover { background: rgba(255, 255, 255, .08); }
.more-sheet form { margin: 0; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .app-content { padding: 16px 18px 90px; }
  .app-topbar { padding: 0 18px; }
  .mobile-nav { display: flex; }
}

/* ---------- Grids ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2-uneven { display: grid; grid-template-columns: 1.1fr .9fr; gap: 24px; align-items: start; }
.grid-2-uneven-rev { display: grid; grid-template-columns: .9fr 1.1fr; gap: 24px; align-items: start; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; }
.stats-band { display: grid; grid-template-columns: repeat(4, 1fr); padding: 0; }
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2-uneven, .grid-2-uneven-rev, .hero-grid { grid-template-columns: 1fr; }
  .stats-band { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.stat-tile { border-radius: 16px; padding: 22px; }
.stat-tile.accent { background: var(--acc); color: #000; }
.stat-tile.plain { background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .09); }
.stat-tile .stat-label { font: 700 11px 'Space Grotesk'; letter-spacing: .08em; text-transform: uppercase; }
.stat-tile.accent .stat-label { color: rgba(0, 0, 0, .55); }
.stat-tile.plain .stat-label { color: rgba(255, 255, 255, .45); }
.stat-tile .stat-value { font: 700 40px 'Space Grotesk'; margin-top: 8px; }
.stat-tile .stat-delta { font: 600 12px Inter; }
.stat-tile.accent .stat-delta { color: rgba(0, 0, 0, .6); }
.stat-tile.plain .stat-delta { color: rgba(255, 255, 255, .4); }

/* Compat ancien nom de classe (.stats/.stat/.num/.lbl) utilisé par dashboard.ejs */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .09); border-radius: 16px; padding: 22px; }
.stat .num { font: 700 40px 'Space Grotesk'; }
.stat .lbl { font: 700 11px 'Space Grotesk'; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .45); margin-top: 4px; }
@media (max-width: 900px) { .stats { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .stats { grid-template-columns: 1fr; } }

/* ---------- Activity feed ---------- */
.activity-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft);
}
.activity-row:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; }
.activity-text { font: 500 13px Inter; flex: 1; }
.activity-time { font: 500 12px Inter; color: rgba(255, 255, 255, .35); }

/* ---------- Tables ---------- */
.table-card { background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .09); border-radius: 16px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
.table-card table { border: none; }
table th, table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid rgba(255, 255, 255, .05); font: 500 13px Inter; }
table thead th { font: 700 10px 'Space Grotesk'; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .4); border-bottom: 1px solid var(--line); }
table tbody tr:last-child td { border-bottom: none; }
.table-row { display: grid; grid-template-columns: 1.4fr 1.6fr 1.4fr .8fr 1.2fr; padding: 16px 20px; align-items: center; border-bottom: 1px solid rgba(255, 255, 255, .05); font: 500 13px Inter; }
.table-row:last-child { border-bottom: none; }
.table-row.revoked { opacity: .6; }
.table-actions, .actions-cell { display: flex; gap: 8px; }
@media (max-width: 720px) {
  table thead { display: none; }
  table, table tbody, table tr, table td { display: block; width: 100%; }
  table tr { padding: 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
  table td { padding: 4px 0; border: none; }
}

/* ---------- Scanner (page réelle, caméra html5-qrcode) ---------- */
#reader {
  border-radius: 16px; overflow: hidden; background: #000; border: 1px solid var(--line);
  min-height: 320px; position: relative;
}
#reader video { border-radius: 16px; }
.scan-result { text-align: center; font: 600 15px 'Space Grotesk'; margin-top: 16px; min-height: 1.5em; }
.scan-result.big {
  background: var(--acc); color: #000; border-radius: 18px; padding: 20px; font-size: 22px;
}
#reward-action .btn { width: 100%; }

/* ---------- Pages légales ---------- */
.legal-page { max-width: 720px; margin: 0 auto; padding: 60px 20px; }
.legal-page h1 { font-size: 32px; margin-bottom: 8px; }
.legal-updated { color: var(--text-faint); font-size: 13px; margin-bottom: 24px; }
.legal-page h2 { font-size: 18px; margin: 28px 0 10px; }
.legal-page p, .legal-page li { font: 400 15px/1.7 Inter; color: var(--text-dim); }
.legal-page ul { padding-left: 20px; }
.legal-hint { color: var(--text-faint); font-size: 12px; }
.legal-back { margin-top: 30px; }
.legal-back a { color: var(--acc); font-weight: 600; }

/* ---------- Footer légal (pages internes) ---------- */
.site-footer { text-align: center; padding: 24px 16px; font-size: 12px; color: var(--text-faint); border-top: 1px solid var(--line-soft); }
.site-footer a { color: var(--text-dim); }

/* ---------- Utility ---------- */
.text-dim { color: var(--text-dim); }
.text-faint { color: var(--text-faint); }
.mt-0 { margin-top: 0; }
.center { text-align: center; }
.opt { color: var(--text-faint); font-weight: 400; }
