/* ═══════════════════════════════════════════
   PayProm — Professional Design System
   Purple / Gradient Theme
═══════════════════════════════════════════ */

:root {
  --primary: #7c3aed;
  --primary-light: #a855f7;
  --primary-dark: #5b21b6;
  --primary-bg: #f5f3ff;
  --green: #10b981;
  --green-bg: #d1fae5;
  --orange: #f59e0b;
  --orange-bg: #fef3c7;
  --blue: #3b82f6;
  --blue-bg: #dbeafe;
  --red: #ef4444;
  --red-bg: #fee2e2;
  --wave-color: #0ea5e9;
  --wave-bg: #e0f2fe;
  --orange-money: #f97316;
  --orange-money-bg: #ffedd5;

  --bg: #f8f7ff;
  --card-bg: #ffffff;
  --sidebar-bg: #1e1b4b;
  --sidebar-active: rgba(124,58,237,0.25);
  --sidebar-hover: rgba(255,255,255,0.07);
  --text-primary: #1e1b4b;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --sidebar-w: 255px;
  --header-h: 64px;
  --transition: all 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ──────────────────── SIDEBAR ──────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  min-height: 100vh;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff;
  box-shadow: 0 4px 12px rgba(124,58,237,0.4);
}

.logo-text {
  font-size: 20px; font-weight: 800; color: #fff;
  letter-spacing: -0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 12px;
  overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.nav-section { margin-bottom: 20px; }

.nav-label {
  display: block;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
  padding: 0 10px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  transition: var(--transition);
  position: relative;
  margin-bottom: 2px;
}

.nav-item i { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }
.nav-item span:first-of-type { flex: 1; }

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--primary-light);
  border-radius: 2px;
}

.nav-badge {
  background: var(--primary-light);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}
.nav-badge.pending { background: var(--orange); }

.sidebar-footer {
  padding: 16px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 600; color: #fff; display: block; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.45); display: block; }

/* ──────────────────── MAIN CONTENT ──────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ──────────────────── HEADER ──────────────────── */
.top-header {
  height: var(--header-h);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-left { display: flex; align-items: center; gap: 14px; }
.header-right { display: flex; align-items: center; gap: 10px; }

.mobile-menu-btn {
  display: none;
  background: none; border: none;
  font-size: 18px; cursor: pointer;
  color: var(--text-secondary);
  padding: 6px;
}

.breadcrumb span {
  font-size: 16px; font-weight: 700;
  color: var(--text-primary);
}

.header-date {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-secondary);
  background: var(--bg);
  padding: 6px 12px;
  border-radius: 8px;
}

.icon-btn {
  width: 36px; height: 36px;
  background: var(--bg);
  border: none; border-radius: 8px;
  font-size: 14px; color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}

.icon-btn:hover { background: var(--primary-bg); color: var(--primary); }

.notif-wrap { position: relative; }
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid #fff;
}

/* ──────────────────── PAGES ──────────────────── */
.page-container { padding: 28px; max-width: 1400px; margin: 0 auto; width: 100%; }

.page { display: none; animation: fadeIn 0.25s ease; }
.page.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-intro { margin-bottom: 24px; }
.page-intro h1 { font-size: 26px; font-weight: 800; color: var(--text-primary); }
.page-intro p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }

.page-actions-bar {
  display: flex; align-items: center;
  justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
  margin-bottom: 22px;
}

.page-actions-bar h1 { font-size: 24px; font-weight: 800; }
.page-actions-bar p { color: var(--text-secondary); font-size: 13px; margin-top: 3px; }

/* ──────────────────── STATS CARDS ──────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 20px;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card.c-purple::before { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.stat-card.c-green::before { background: var(--green); }
.stat-card.c-orange::before { background: var(--orange); }
.stat-card.c-blue::before { background: var(--blue); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}

.c-purple .stat-icon { background: var(--primary-bg); color: var(--primary); }
.c-green .stat-icon  { background: var(--green-bg);   color: var(--green); }
.c-orange .stat-icon { background: var(--orange-bg);  color: var(--orange); }
.c-blue .stat-icon   { background: var(--blue-bg);    color: var(--blue); }

.stat-val { font-size: 28px; font-weight: 800; color: var(--text-primary); display: block; line-height: 1; }
.stat-lbl { font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-top: 4px; display: block; }

/* ──────────────────── DASHBOARD GRID ──────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 0;
}

.mt-4 { margin-top: 16px; }

/* ──────────────────── CARD ──────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.card-head h3 {
  font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  color: var(--text-primary);
}

.card-head h3 i { color: var(--primary); }
.link-more { font-size: 12px; color: var(--primary); text-decoration: none; font-weight: 500; }
.link-more:hover { text-decoration: underline; }

/* Mobile Money Grid */
.mm-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; background: var(--border-light);
}

.mm-card {
  padding: 20px 16px;
  display: flex; align-items: center; gap: 14px;
  background: var(--card-bg);
}

.mm-badge {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
  flex-shrink: 0;
}

.mm-wave .mm-badge   { background: var(--wave-bg); color: var(--wave-color); }
.mm-orange .mm-badge { background: var(--orange-money-bg); color: var(--orange-money); }
.mm-cash .mm-badge   { background: var(--green-bg); color: var(--green); }

.mm-count { font-size: 24px; font-weight: 800; display: block; }
.mm-label { font-size: 12px; color: var(--text-secondary); }

/* ──────────────────── FILTERS ──────────────────── */
.filters-bar {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
}

.search-box {
  flex: 1; min-width: 200px;
  position: relative;
}

.search-box i {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted); font-size: 13px;
}

.search-box input {
  width: 100%; padding: 9px 12px 9px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  font-size: 13px; color: var(--text-primary);
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}

.filter-select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  font-size: 13px; color: var(--text-primary);
  cursor: pointer;
}

.filter-select:focus { outline: none; border-color: var(--primary); }

.month-selector { display: flex; gap: 6px; }
.month-selector select {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  font-size: 13px; color: var(--text-primary);
}

/* ──────────────────── TABLE ──────────────────── */
.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background: #fafafa;
  padding: 11px 16px;
  text-align: left;
  font-weight: 600; font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #fafafe; }

.promo-cell {
  display: flex; align-items: center; gap: 10px;
}

.promo-initial {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.promo-name { font-weight: 600; }
.promo-sub  { font-size: 11px; color: var(--text-muted); }

/* ──────────────────── BADGES ──────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}

.badge-active   { background: var(--green-bg); color: var(--green); }
.badge-inactive { background: var(--border-light); color: var(--text-muted); }
.badge-paye     { background: var(--green-bg); color: var(--green); }
.badge-attente  { background: var(--orange-bg); color: var(--orange); }
.badge-wave     { background: var(--wave-bg); color: var(--wave-color); }
.badge-orange   { background: var(--orange-money-bg); color: var(--orange-money); }
.badge-especes  { background: var(--green-bg); color: var(--green); }
.badge-virement { background: var(--blue-bg); color: var(--blue); }

.emarg-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px;
}
.emarg-done { background: var(--green-bg); color: var(--green); }
.emarg-pending { background: var(--orange-bg); color: var(--orange); cursor: pointer; }
.emarg-pending:hover { opacity: 0.8; }

/* ──────────────────── BUTTONS ──────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(124,58,237,0.3);
}
.btn-primary:hover { box-shadow: 0 6px 18px rgba(124,58,237,0.4); transform: translateY(-1px); }

.btn-success {
  background: var(--green);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}
.btn-success:hover { opacity: 0.9; }

.btn-outline {
  background: var(--card-bg);
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-bg); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: 0.9; }

.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ──────────────────── PAYMENT STATS ROW ──────────────────── */
.pay-stats-row {
  display: flex; gap: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 16px;
}

.pay-stat {
  flex: 1; padding: 16px 20px;
  border-right: 1px solid var(--border-light);
  text-align: center;
}

.pay-stat:last-child { border-right: none; }

.ps-val { font-size: 20px; font-weight: 800; display: block; color: var(--text-primary); }
.ps-lbl { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-top: 3px; }

.pay-stat.success .ps-val { color: var(--green); }
.pay-stat.warning .ps-val { color: var(--orange); }
.pay-stat.info .ps-val    { color: var(--primary); }

/* ──────────────────── EMARGEMENT LIST ──────────────────── */
.emargement-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.emarg-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.emarg-item:hover { box-shadow: var(--shadow-md); }

.emarg-item.signed { border-left: 3px solid var(--green); }
.emarg-item.unsigned { border-left: 3px solid var(--orange); }

.ei-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.ei-info { flex: 1; min-width: 0; }
.ei-name { font-weight: 600; font-size: 14px; }
.ei-amount { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.ei-date { font-size: 11px; color: var(--text-muted); }

.emarg-filters { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }

/* ──────────────────── RAPPORTS ──────────────────── */
.rapport-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.rapport-card {
  padding: 24px;
  display: flex; flex-direction: column; gap: 10px;
  transition: var(--transition);
}
.rapport-card:hover { box-shadow: var(--shadow-md); }

.rapport-ico {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.ico-purple { background: var(--primary-bg); color: var(--primary); }
.ico-blue   { background: var(--blue-bg);    color: var(--blue); }
.ico-green  { background: var(--green-bg);   color: var(--green); }

.rapport-card h3 { font-size: 15px; font-weight: 700; }
.rapport-card p  { font-size: 13px; color: var(--text-secondary); flex: 1; }

/* ──────────────────── CONFIG ──────────────────── */
.config-sections { display: flex; flex-direction: column; gap: 16px; }

.config-card { padding: 24px; }
.config-card h3 {
  font-size: 15px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.config-card h3 i { color: var(--primary); }
.config-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }

.conn-status {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
}
.conn-status.ok  { background: var(--green-bg); color: var(--green); }
.conn-status.err { background: var(--red-bg); color: var(--red); }

/* ──────────────────── FORMS ──────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }

.form-group label {
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.04em;
}

.form-control {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--text-primary);
  background: var(--card-bg);
  transition: var(--transition);
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}

textarea.form-control { resize: vertical; min-height: 70px; }
select.form-control { cursor: pointer; }

.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.section-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--primary);
  padding: 14px 0 10px;
  border-top: 1px solid var(--border-light);
  margin-top: 4px;
}

.input-prefixed { position: relative; display: flex; align-items: center; }

.input-prefix {
  position: absolute; left: 12px;
  font-size: 11px; font-weight: 800;
  z-index: 1;
}

.wave-prefix   { color: var(--wave-color); }
.orange-prefix { color: var(--orange-money); }

.input-prefixed .form-control { padding-left: 36px; }

.mt-2 { margin-top: 10px; }

/* ──────────────────── MODALS ──────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 10, 40, 0.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1; pointer-events: all;
}

.modal {
  background: var(--card-bg);
  border-radius: 18px;
  width: 100%; max-width: 560px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
  overflow: hidden;
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-lg { max-width: 680px; }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-head h2 {
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.modal-head h2 i { color: var(--primary); }

.modal-close {
  width: 32px; height: 32px;
  background: var(--bg);
  border: none; border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--text-secondary);
  transition: var(--transition);
}
.modal-close:hover { background: var(--red-bg); color: var(--red); }

.modal-body { padding: 22px; overflow-y: auto; flex: 1; }

.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ──────────────────── EMARGEMENT MODAL ──────────────────── */
.emarg-promo-card {
  display: flex; align-items: center; gap: 16px;
  padding: 16px;
  background: var(--primary-bg);
  border-radius: var(--radius);
  margin-bottom: 16px;
  border: 1px solid rgba(124,58,237,0.15);
}

.emarg-avatar {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.emarg-details h3 { font-size: 16px; font-weight: 700; }
.emarg-details p  { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.emarg-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.etag {
  display: inline-block;
  padding: 3px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.etag-amount { background: var(--primary-bg); color: var(--primary); border: 1px solid rgba(124,58,237,0.2); }
.etag-period { background: var(--blue-bg); color: var(--blue); }
.etag-moyen  { background: var(--wave-bg); color: var(--wave-color); }

.confirm-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  background: var(--blue-bg);
  color: var(--blue);
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  margin-bottom: 18px;
}

/* ──────────────────── SIGNATURE ──────────────────── */
.sig-section { margin-bottom: 16px; }
.sig-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; display: block; margin-bottom: 8px; }

.sig-wrap {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: #fafafa;
  position: relative;
  height: 140px;
  transition: var(--transition);
}

.sig-wrap:hover { border-color: var(--primary); }

.sig-canvas {
  width: 100%; height: 100%;
  border-radius: var(--radius-sm);
  cursor: crosshair;
  display: block;
  touch-action: none;
}

.sig-hint {
  position: absolute;
  top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 13px; color: var(--text-muted);
  pointer-events: none;
  transition: opacity 0.2s;
}

.sig-actions { display: flex; justify-content: flex-end; margin-top: 6px; }

/* ──────────────────── EMPTY STATE ──────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center;
  padding: 36px 20px;
  color: var(--text-muted);
  gap: 10px;
  text-align: center;
}

.empty-state i { font-size: 28px; opacity: 0.4; }
.empty-state p { font-size: 13px; }

.empty-state.large { padding: 80px 20px; }
.empty-state.large i { font-size: 40px; }

/* ──────────────────── PENDING LIST (dashboard) ──────────────────── */
.pending-item, .signing-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
}
.pending-item:last-child, .signing-item:last-child { border-bottom: none; }

.pi-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}

.pi-name { font-weight: 600; font-size: 13px; }
.pi-sub  { font-size: 11px; color: var(--text-muted); }
.pi-amount { font-weight: 700; font-size: 14px; color: var(--orange); margin-left: auto; white-space: nowrap; }
.si-amount { font-weight: 700; font-size: 13px; color: var(--green); margin-left: auto; white-space: nowrap; }

/* ──────────────────── VIEW PROMO ──────────────────── */
.view-promo {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.view-field { display: flex; flex-direction: column; gap: 4px; }
.vf-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.vf-val   { font-size: 14px; font-weight: 500; color: var(--text-primary); }

.view-promo-header {
  display: flex; align-items: center; gap: 16px;
  padding-bottom: 18px; margin-bottom: 18px;
  border-bottom: 1px solid var(--border-light);
  grid-column: 1 / -1;
}

.vp-avatar {
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: #fff; flex-shrink: 0;
}

.vp-name { font-size: 20px; font-weight: 800; }
.vp-sub  { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ──────────────────── TOAST ──────────────────── */
#toastWrap {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 500;
  display: flex; flex-direction: column; gap: 8px;
}

.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px;
  background: var(--text-primary);
  color: #fff;
  border-radius: 12px;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
  min-width: 260px; max-width: 360px;
}

@keyframes toastIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.warning { background: var(--orange); }
.toast i { font-size: 16px; flex-shrink: 0; }

/* ──────────────────── LOADING ──────────────────── */
.loading-veil {
  position: fixed; inset: 0;
  background: rgba(15,10,40,0.45);
  backdrop-filter: blur(3px);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
}

.spinner-box {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 28px 36px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.spinner-box p { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

/* ──────────────────── ACTION BUTTONS IN TABLE ──────────────────── */
.tbl-actions { display: flex; gap: 5px; }

.tbl-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--card-bg);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-secondary);
  transition: var(--transition);
}

.tbl-btn:hover          { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.tbl-btn.del:hover      { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.tbl-btn.pay:hover      { border-color: var(--green); color: var(--green); background: var(--green-bg); }
.tbl-btn.sign:hover     { border-color: var(--orange); color: var(--orange); background: var(--orange-bg); }

/* ══════════════════════════════════════════════
   RESPONSIVE — Tablet & Mobile
══════════════════════════════════════════════ */

/* ── Tablet (≤ 1100px) ── */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .rapport-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Tablet portrait / large phone (≤ 900px) ── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }

  /* Sidebar slide-in overlay */
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
    z-index: 300;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }

  /* Backdrop when sidebar is open */
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,10,40,0.45);
    z-index: 299;
  }
  .sidebar-backdrop.show { display: block; }

  .main-content { margin-left: 0; }
  .mobile-menu-btn { display: flex; align-items: center; justify-content: center; }

  /* Layouts */
  .dash-grid       { grid-template-columns: 1fr; }
  .form-grid       { grid-template-columns: 1fr; }
  .view-promo      { grid-template-columns: 1fr; }
  .mm-grid         { grid-template-columns: repeat(3,1fr); }
  .rapport-grid    { grid-template-columns: repeat(2,1fr); }

  /* Page header */
  .page-actions-bar { gap: 10px; }

  /* Stats row */
  .pay-stats-row { flex-wrap: wrap; }
  .pay-stat { flex: 1 1 50%; border-right: none; border-bottom: 1px solid var(--border-light); }
  .pay-stat:last-child, .pay-stat:nth-child(2) { border-bottom: none; }

  /* Table: make scrollable horizontally */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 700px; }

  /* Modals: near-full screen */
  .modal { max-width: 95vw; max-height: 92vh; }
  .modal-lg { max-width: 95vw; }
}

/* ── Mobile (≤ 640px) ── */
@media (max-width: 640px) {
  :root { --header-h: 56px; }

  /* Page container padding */
  .page-container { padding: 14px 12px; }

  /* Header */
  .top-header { padding: 0 14px; }
  .header-date { display: none; } /* hide date on small screens */
  .breadcrumb span { font-size: 15px; }

  /* Stats 2-col on mobile */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card  { padding: 14px 12px; gap: 10px; }
  .stat-val   { font-size: 22px; }
  .stat-icon  { width: 40px; height: 40px; font-size: 16px; }

  /* MM grid stacks */
  .mm-grid { grid-template-columns: 1fr; }
  .mm-card { padding: 14px; }

  /* Dash grid */
  .dash-grid { gap: 12px; }

  /* Page titles */
  .page-intro h1       { font-size: 20px; }
  .page-actions-bar h1 { font-size: 20px; }

  /* Buttons */
  .btn      { padding: 8px 14px; font-size: 13px; }
  .btn-group { flex-wrap: wrap; gap: 6px; }

  /* Month selector */
  .month-selector select { font-size: 12px; padding: 7px 8px; }

  /* Filters */
  .filters-bar { gap: 8px; }
  .filter-select { flex: 1; min-width: 120px; font-size: 12px; }

  /* Pay stats — 2 per row */
  .pay-stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
  .pay-stat { border: none; padding: 12px; }
  .pay-stat:nth-child(1), .pay-stat:nth-child(2) { border-bottom: 1px solid var(--border-light); }
  .pay-stat:nth-child(odd) { border-right: 1px solid var(--border-light); }
  .ps-val { font-size: 16px; }

  /* Table min-width for scroll */
  .data-table { min-width: 600px; font-size: 12px; }
  .data-table th, .data-table td { padding: 10px 12px; }
  .promo-initial { width: 28px; height: 28px; font-size: 11px; }

  /* Emargement grid: 1 col */
  .emargement-list-grid { grid-template-columns: 1fr; gap: 10px; }
  .emarg-item { padding: 14px; gap: 10px; }

  /* Rapport grid: 1 col */
  .rapport-grid { grid-template-columns: 1fr; }
  .rapport-card { padding: 18px; }

  /* Config */
  .config-card { padding: 18px; }

  /* Modals: full screen */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal, .modal-lg {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 20px 20px 0 0;
    width: 100%;
  }
  .modal-body { padding: 16px; }
  .modal-head { padding: 14px 16px; }
  .modal-foot { padding: 12px 16px; flex-direction: column; }
  .modal-foot .btn { width: 100%; justify-content: center; }

  /* Emargement modal */
  .emarg-promo-card { flex-direction: column; text-align: center; }
  .emarg-tags { justify-content: center; }

  /* Signature pad */
  .sig-wrap { height: 160px; }

  /* Toast */
  #toastWrap { bottom: 16px; right: 12px; left: 12px; }
  .toast { min-width: unset; width: 100%; }

  /* View promo */
  .view-promo-header { flex-direction: column; text-align: center; }
}

/* ── Very small (≤ 380px) ── */
@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card  { padding: 12px; }
  .page-container { padding: 10px; }
  .logo-text  { font-size: 17px; }
}
