/* ═══════════════════════════════════════════════════
   Ma Richesse Massife — Design System
   Thème : Luxe sombre + or / vert émeraude
   Police : Playfair Display + DM Sans
═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;700&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── Variables ─────────────────────────────── */
:root {
  --bg:        #0d1117;
  --bg2:       #161b22;
  --bg3:       #1c2130;
  --surface:   #1e2535;
  --surface2:  #252d3d;
  --border:    rgba(255,255,255,.07);
  --border2:   rgba(255,255,255,.12);

  --gold:      #c9933a;
  --gold2:     #e8b45a;
  --gold-bg:   rgba(201,147,58,.10);
  --gold-glow: rgba(201,147,58,.25);

  --emerald:   #10b981;
  --emerald2:  #34d399;
  --em-bg:     rgba(16,185,129,.10);
  --em-glow:   rgba(16,185,129,.20);

  --text:      #e8eaf0;
  --text2:     #8b93a7;
  --text3:     #5a6278;

  --red:       #ef4444;
  --red-bg:    rgba(239,68,68,.12);
  --blue:      #3b82f6;
  --blue-bg:   rgba(59,130,246,.12);
  --amber:     #f59e0b;
  --amber-bg:  rgba(245,158,11,.12);

  --radius:    14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,.6);

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  --sidebar-w: 260px;
  --topbar-h:  64px;
}

/* ── Reset & base ──────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }

/* ── Layout ─────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ══════════════════════════════════════════════
   SIDEBAR — règle unique, sans doublon
   Principe :
   - .sidebar          : conteneur fixe, flex colonne, overflow:hidden
   - .sidebar-brand,
     .sidebar-member,
     .sidebar-balance,
     .sidebar-footer   : flex-shrink:0 → hauteur fixe, jamais compressés
   - .sidebar-nav      : flex:1 + overflow-y:auto → absorbe l'espace
                         restant et active le scroll
══════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  inset-y: 0;
  left: 0;
  z-index: 50;
  width: var(--sidebar-w);
  height: 100vh;           /* hauteur contrainte indispensable */
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;        /* empêche le conteneur de déborder */
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.sidebar-brand {
  flex-shrink: 0;
  padding: 24px 20px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  object-fit: contain;
  border: 1px solid var(--gold-bg);
}
.brand-text { line-height: 1.2; }
.brand-name {
  font-family: var(--font-display);
  font-size: 15px; font-weight: 700;
  color: var(--gold);
  letter-spacing: .02em;
}
.brand-sub {
  font-size: 11px; color: var(--text3);
  font-weight: 300; letter-spacing: .08em;
  text-transform: uppercase;
}

.sidebar-member {
  flex-shrink: 0;
  margin: 14px 14px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex; align-items: center; gap: 10px;
}
.member-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold-bg);
  flex-shrink: 0;
}
.member-info { min-width: 0; }
.member-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.member-id { font-size: 11px; color: var(--text3); font-family: monospace; }

.sidebar-balance {
  flex-shrink: 0;
  margin: 0 14px 8px;
  background: var(--gold-bg);
  border: 1px solid rgba(201,147,58,.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.balance-label {
  font-size: 10px; color: var(--gold);
  text-transform: uppercase; letter-spacing: .1em; font-weight: 500;
}
.balance-amount {
  font-family: var(--font-display);
  font-size: 18px; color: var(--gold2);
  font-weight: 700; line-height: 1.3;
}

/* ── Zone scrollable ── */
.sidebar-nav {
  flex: 1;                   /* prend tout l'espace vertical disponible */
  overflow-y: auto;          /* scroll vertical si contenu dépasse */
  overflow-x: hidden;
  padding: 8px 10px 16px;
  -webkit-overflow-scrolling: touch; /* scroll fluide iOS */
  /* Scrollbar fine et discrète */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}
.sidebar-nav::-webkit-scrollbar       { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 99px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }

.nav-section-title {
  font-size: 10px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: .12em;
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 400; color: var(--text2);
  transition: all .15s;
  cursor: pointer; border: none; background: none; width: 100%;
  text-decoration: none; position: relative;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active {
  background: var(--em-bg);
  color: var(--emerald2);
  font-weight: 500;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%; border-radius: 0 3px 3px 0;
  background: var(--emerald);
}
.nav-item .icon { width: 16px; text-align: center; font-size: 14px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 99px;
  min-width: 18px; text-align: center;
}

/* Section collapsible admin */
.nav-section-collapse { margin-top: 8px; }
.nav-section-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; background: none; border: none;
  font-size: 10px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: .12em;
  cursor: pointer; transition: color .15s, background .15s;
  border-radius: var(--radius-sm);
}
.nav-section-toggle:hover { color: var(--text); background: var(--surface); }
.nav-chevron { transition: transform .25s; font-size: 11px; }
.nav-section-collapse.collapsed .nav-chevron { transform: rotate(-90deg); }
.nav-section-body {
  /* Ouvert : on laisse le contenu s'afficher normalement.
     overflow visible = le contenu contribue au scroll de .sidebar-nav */
  overflow: visible;
  max-height: none;
  opacity: 1;
  transition: opacity .25s;
}
.nav-section-collapse.collapsed .nav-section-body {
  /* Fermé : on coupe le contenu avec max-height animée */
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height .3s ease, opacity .2s;
}

/* ── Pied de sidebar — toujours visible ── */
.sidebar-footer {
  flex-shrink: 0;
  padding: 10px;
  border-top: 1px solid var(--border);
}
.logout-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--red);
  cursor: pointer; border: none; background: none; width: 100%;
  transition: background .15s;
}
.logout-btn:hover { background: var(--red-bg); }

/* ── Topbar ─────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  background: rgba(13,17,23,.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text2); cursor: pointer;
  transition: all .15s; font-size: 14px;
}
.icon-btn:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); }
.hamburger { display: none; }

/* ── Main content ───────────────────────────── */
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-width: 0;
}
.page-content {
  flex: 1;
  padding: 28px 24px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ── Overlay mobile ─────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 49;
  background: rgba(0,0,0,.6); backdrop-filter: blur(2px);
  display: none;
}
.overlay.open { display: block; }

/* ── Flash messages ─────────────────────────── */
.flash-zone { padding: 16px 24px 0; max-width: 1280px; margin: 0 auto; }
.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; margin-bottom: 8px;
  animation: fadeIn .25s ease;
}
.flash-success { background: var(--em-bg); border: 1px solid rgba(16,185,129,.2); color: var(--emerald2); }
.flash-error   { background: var(--red-bg); border: 1px solid rgba(239,68,68,.2); color: #fca5a5; }
.flash-warning { background: var(--amber-bg); border: 1px solid rgba(245,158,11,.2); color: #fcd34d; }
.flash-info    { background: var(--blue-bg); border: 1px solid rgba(59,130,246,.2); color: #93c5fd; }

/* ── Cards ──────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card-sm { padding: 16px; border-radius: var(--radius-sm); }
.card-title {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 600; color: var(--text);
  margin-bottom: 16px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}

/* ── Stat cards ─────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative; overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card::after {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%; filter: blur(30px); opacity: .3;
}
.stat-card.gold::after  { background: var(--gold); }
.stat-card.green::after { background: var(--emerald); }
.stat-card.red::after   { background: var(--red); }
.stat-card.blue::after  { background: var(--blue); }
.stat-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; margin-bottom: 14px;
}
.stat-icon.gold  { background: var(--gold-bg); color: var(--gold2); }
.stat-icon.green { background: var(--em-bg); color: var(--emerald2); }
.stat-icon.red   { background: var(--red-bg); color: #fca5a5; }
.stat-icon.blue  { background: var(--blue-bg); color: #93c5fd; }
.stat-label { font-size: 11px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.stat-value { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-sub { font-size: 12px; color: var(--text3); margin-top: 4px; }

/* ── Buttons ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; font-family: var(--font-body);
  cursor: pointer; border: none; transition: all .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--emerald); color: #fff; }
.btn-primary:hover { background: #0ea271; box-shadow: 0 0 20px var(--em-glow); }
.btn-gold    { background: var(--gold); color: #fff; }
.btn-gold:hover    { background: #b8832d; box-shadow: 0 0 20px var(--gold-glow); }
.btn-danger  { background: var(--red); color: #fff; }
.btn-danger:hover  { background: #dc2626; }
.btn-ghost   { background: var(--surface); color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover   { background: var(--surface2); color: var(--text); border-color: var(--border2); }
.btn-outline { background: transparent; color: var(--emerald); border: 1px solid var(--emerald); }
.btn-outline:hover { background: var(--em-bg); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 7px; }
.btn-lg { padding: 13px 28px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }

/* ── Form inputs ─────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 12.5px; font-weight: 500;
  color: var(--text2); margin-bottom: 7px; letter-spacing: .02em;
}
.form-input {
  width: 100%; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 14px; font-family: var(--font-body);
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.form-input:focus { border-color: var(--emerald); box-shadow: 0 0 0 3px var(--em-glow); }
.form-input::placeholder { color: var(--text3); }
.form-input:disabled { opacity: .5; cursor: not-allowed; }
.form-hint  { font-size: 11.5px; color: var(--text3); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 5px; }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 13px; pointer-events: none; }
.input-icon .form-input { padding-left: 38px; }
select.form-input option { background: var(--bg2); }

/* ── Tables ─────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table thead tr { background: var(--surface); }
.data-table th {
  padding: 11px 16px; text-align: left;
  font-size: 11px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: .08em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover { background: var(--surface); }

/* ── Badges ─────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
}
.badge-success { background: var(--em-bg); color: var(--emerald2); border: 1px solid rgba(16,185,129,.2); }
.badge-danger  { background: var(--red-bg); color: #fca5a5; border: 1px solid rgba(239,68,68,.2); }
.badge-warning { background: var(--amber-bg); color: #fcd34d; border: 1px solid rgba(245,158,11,.2); }
.badge-info    { background: var(--blue-bg); color: #93c5fd; border: 1px solid rgba(59,130,246,.2); }
.badge-gold    { background: var(--gold-bg); color: var(--gold2); border: 1px solid rgba(201,147,58,.2); }
.badge-gray    { background: rgba(255,255,255,.05); color: var(--text2); border: 1px solid var(--border2); }
.badge-super   { background: linear-gradient(135deg,#7c3aed,#ec4899); color: #fff; border: none; }

/* ── Pagination ─────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 34px; height: 34px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-size: 13px; color: var(--text2);
  border: 1px solid var(--border); transition: all .15s; text-decoration: none;
}
.pagination a:hover { background: var(--surface2); color: var(--text); }
.pagination .cur { background: var(--emerald); color: #fff; border-color: var(--emerald); font-weight: 600; }

/* ── Modals ──────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal-bg.open { display: flex; animation: fadeIn .2s; }
.modal-box {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); padding: 28px;
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  animation: slideUp .25s ease;
}
.modal-title { font-family: var(--font-display); font-size: 18px; margin-bottom: 20px; color: var(--text); }

/* ── Progress bar ───────────────────────────── */
.progress { height: 6px; background: var(--surface2); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--emerald), var(--emerald2)); transition: width .5s ease; }

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

/* ── Animations ─────────────────────────────── */
@keyframes fadeIn  { from{opacity:0} to{opacity:1} }
@keyframes slideUp { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }
@keyframes pulse   { 0%,100%{opacity:1} 50%{opacity:.5} }
.animate-in { animation: slideUp .3s ease both; }
.pulse { animation: pulse 2s ease infinite; }

/* ── Auth pages ─────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: grid; grid-template-columns: 1fr 1fr;
}
.auth-left {
  background: linear-gradient(135deg, var(--bg2) 0%, var(--bg3) 100%);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 60px 48px; position: relative; overflow: hidden;
  border-right: 1px solid var(--border);
}
.auth-left::before {
  content: '';
  position: absolute; top: -50%; left: -20%;
  width: 120%; height: 200%;
  background: radial-gradient(ellipse at 60% 40%, rgba(201,147,58,.08) 0%, transparent 60%),
              radial-gradient(ellipse at 20% 80%, rgba(16,185,129,.06) 0%, transparent 50%);
  pointer-events: none;
}
.auth-right {
  display: flex; align-items: center; justify-content: center;
  padding: 48px 40px; overflow-y: auto;
}
.auth-card { width: 100%; max-width: 420px; }
.auth-logo-wrap { text-align: center; margin-bottom: 32px; }
.auth-logo { width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 16px; object-fit: contain; border: 1px solid var(--border2); }
.auth-title { font-family: var(--font-display); font-size: 28px; color: var(--text); }
.auth-sub { font-size: 14px; color: var(--text2); margin-top: 4px; }

/* ── Hero dashboard card ────────────────────── */
.hero-card {
  background: linear-gradient(135deg, #0f2027 0%, #1a2e1a 40%, #0f2027 100%);
  border: 1px solid rgba(16,185,129,.15);
  border-radius: var(--radius-lg);
  padding: 28px; position: relative; overflow: hidden;
}
.hero-card::before {
  content: '';
  position: absolute; top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, var(--em-glow) 0%, transparent 70%);
  pointer-events: none;
}
.hero-card::after {
  content: '';
  position: absolute; bottom: -30px; left: 40%;
  width: 180px; height: 180px;
  background: radial-gradient(circle, var(--gold-glow) 0%, transparent 70%);
  pointer-events: none;
}

/* ── Action grid ─────────────────────────────── */
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.action-tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  cursor: pointer; text-decoration: none; color: var(--text2);
  transition: all .2s; text-align: center; font-size: 13px; font-weight: 500;
}
.action-tile:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); transform: translateY(-2px); }
.action-tile .tile-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}

/* ── Tx list ─────────────────────────────────── */
.tx-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.tx-item:last-child { border-bottom: none; }
.tx-dot {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.tx-dot.sent     { background: var(--red-bg); color: #fca5a5; }
.tx-dot.received { background: var(--em-bg); color: var(--emerald2); }
.tx-info { flex: 1; min-width: 0; }
.tx-name { font-size: 13.5px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-date { font-size: 11.5px; color: var(--text3); }
.tx-amount { font-family: var(--font-display); font-size: 15px; font-weight: 700; white-space: nowrap; }
.tx-amount.sent     { color: var(--red); }
.tx-amount.received { color: var(--emerald2); }

/* ── Responsive ──────────────────────────────── */

/* Tablette & mobile : sidebar cachée par défaut */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0,0,0,.6);
  }
  .main-wrap { margin-left: 0; }
  .hamburger { display: flex; }
  .topbar { padding: 0 14px; height: 56px; }
  .topbar-title { font-size: 15px; }
  .page-content { padding: 16px 14px; max-width: 100%; }
  .hero-card { padding: 18px; }
  .stat-grid { gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 20px; }
  .card { padding: 16px; }
  .data-table th, .data-table td { padding: 10px 12px; font-size: 12.5px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-left { display: none; }
  .auth-right { padding: 24px 16px; }
  .auth-card { max-width: 100%; }
  .modal-box { padding: 20px; }
}

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .action-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .action-tile { padding: 12px 8px; font-size: 11px; }
  .action-tile .tile-icon { width: 36px; height: 36px; font-size: 15px; }
  .hero-card { padding: 16px; }
  .topbar-title { font-size: 14px; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .icon-btn { width: 32px; height: 32px; }
  .btn-lg { padding: 11px 18px; font-size: 14px; }
  .btn { padding: 8px 14px; font-size: 13px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 600px; }
  .flash-zone { padding: 12px 16px 0; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .action-grid { grid-template-columns: 1fr 1fr; }
  .pagination a, .pagination span { min-width: 30px; height: 30px; padding: 0 6px; font-size: 12px; }
  .hero-card > div:first-child { flex-direction: column !important; align-items: flex-start !important; }
  .hero-card > div:first-child > div:last-child { text-align: left !important; width: 100%; }
  .g2 { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
}

/* Écrans peu hauts : compresser les blocs fixes de la sidebar */
@media (max-height: 680px) {
  .sidebar-brand  { padding: 12px 16px; }
  .sidebar-member { margin: 6px 12px; padding: 8px; }
  .sidebar-balance{ margin: 0 12px 6px; padding: 8px 12px; }
  .balance-amount { font-size: 16px; }
  .nav-item       { padding: 7px 12px; font-size: 13px; }
  .nav-section-title { padding: 10px 10px 4px; }
}