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

:root {
  --primary: #1A3A6B;
  --primary-dark: #0f2548;
  --bg: #f4f6fa;
  --sidebar: #1a1a2e;
  --sidebar-hover: #16213e;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --green: #10b981;
  --orange: #f59e0b;
  --red: #ef4444;
  --blue: #3b82f6;
}

body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); }

.hidden { display: none !important; }

/* LOGIN */
.login-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}
.login-box {
  background: white; border-radius: 16px; padding: 48px 40px;
  width: 100%; max-width: 380px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.logo {
  font-size: 28px; font-weight: 800; color: var(--primary);
  letter-spacing: 2px; margin-bottom: 8px;
}
.login-sub { color: var(--text-muted); margin-bottom: 32px; font-size: 14px; }
.login-box input {
  width: 100%; padding: 14px 16px; border: 2px solid var(--border);
  border-radius: 10px; font-size: 15px; margin-bottom: 16px; outline: none;
  transition: border-color .2s;
}
.login-box input:focus { border-color: var(--primary); }
.login-box button {
  width: 100%; padding: 14px; background: var(--primary); color: white;
  border: none; border-radius: 10px; font-size: 16px; font-weight: 600;
  cursor: pointer; transition: background .2s;
}
.login-box button:hover { background: var(--primary-dark); }

/* LAYOUT */
#page-app { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: 230px; background: var(--sidebar); color: white;
  display: flex; flex-direction: column; position: fixed;
  top: 0; left: 0; height: 100vh; z-index: 10;
}
.sidebar-logo {
  font-size: 22px; font-weight: 800; color: var(--primary);
  padding: 28px 24px; letter-spacing: 2px; border-bottom: 1px solid rgba(255,255,255,.08);
}
nav { flex: 1; padding: 16px 0; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 24px; cursor: pointer; color: rgba(255,255,255,.7);
  font-size: 14px; font-weight: 500; transition: all .2s;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--sidebar-hover); color: white; }
.nav-item.active { background: var(--sidebar-hover); color: white; border-left-color: var(--primary); }
.icon { font-size: 18px; }
.logout-btn {
  margin: 16px; padding: 12px; background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.6); border: none; border-radius: 8px;
  cursor: pointer; font-size: 14px; transition: all .2s;
}
.logout-btn:hover { background: rgba(255,255,255,.15); color: white; }

/* MAIN */
.main { margin-left: 230px; flex: 1; padding: 32px; }
.page > h1 { font-size: 24px; font-weight: 700; margin-bottom: 24px; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border-radius: 12px; padding: 24px;
  border-left: 4px solid var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.stat-card.green { border-left-color: var(--green); }
.stat-card.orange { border-left-color: var(--orange); }
.stat-card.blue { border-left-color: var(--blue); }
.stat-value { font-size: 32px; font-weight: 700; margin-bottom: 4px; }
.stat-label { font-size: 13px; color: var(--text-muted); }

/* CARD */
.card {
  background: var(--card); border-radius: 12px; padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06); margin-bottom: 20px;
}
.card h2 { font-size: 16px; font-weight: 600; margin-bottom: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header h2 { margin-bottom: 0; }

/* TRANSACTIONS */
.tx-list { display: flex; flex-direction: column; gap: 12px; }
.tx-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 16px 20px;
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center;
  background: white;
}
.tx-info { display: flex; flex-direction: column; gap: 4px; }
.tx-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tx-client { font-weight: 600; font-size: 15px; }
.tx-amount { font-size: 18px; font-weight: 700; color: var(--primary); }
.tx-ariary { font-size: 13px; color: var(--text-muted); }
.tx-meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 16px; flex-wrap: wrap; margin-top: 4px; }
.tx-meta span { display: flex; align-items: center; gap: 4px; }
.tx-actions { display: flex; gap: 8px; flex-direction: column; align-items: flex-end; }

/* BADGES */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-paid { background: #d1fae5; color: #065f46; }
.badge-failed { background: #fee2e2; color: #991b1b; }
.badge-mvola { background: #ede9fe; color: #5b21b6; }
.badge-orange { background: #fff7ed; color: #9a3412; }

/* BUTTONS */
.btn-primary {
  background: var(--primary); color: white; border: none; padding: 10px 18px;
  border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .2s; white-space: nowrap;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: white; color: var(--text); border: 1.5px solid var(--border);
  padding: 10px 18px; border-radius: 8px; font-size: 13px; cursor: pointer; transition: all .2s;
}
.btn-secondary:hover { border-color: var(--text-muted); }
.btn-danger {
  background: var(--red); color: white; border: none; padding: 10px 18px;
  border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-confirm { background: var(--green); color: white; border: none; padding: 8px 14px; border-radius: 6px; font-size: 12px; cursor: pointer; font-weight: 600; }
.btn-fail { background: #fee2e2; color: var(--red); border: none; padding: 8px 14px; border-radius: 6px; font-size: 12px; cursor: pointer; font-weight: 600; }
.btn-refresh { background: none; border: 1.5px solid var(--border); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; transition: all .2s; }
.btn-refresh:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }

/* CLIENTS */
.clients-list { display: flex; flex-direction: column; gap: 12px; }
.client-card {
  background: white; border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 20px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px;
}
.client-name { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.client-meta { font-size: 13px; color: var(--text-muted); display: flex; gap: 16px; flex-wrap: wrap; }
.client-actions { display: flex; gap: 8px; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #f3f4f6; color: #6b7280; }
.badge-pending { background: #fef3c7; color: #92400e; }
.client-pending { border-left: 4px solid var(--orange); }
.stat-card.red { background: linear-gradient(135deg, #ef4444, #dc2626); }

/* FILTER BAR */
.filter-bar { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-btn {
  padding: 8px 16px; border-radius: 20px; border: 1.5px solid var(--border);
  background: white; cursor: pointer; font-size: 13px; font-weight: 500; transition: all .2s;
}
.filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.filter-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary); }

/* SETTINGS */
.rate-display { display: flex; align-items: center; gap: 12px; font-size: 16px; margin-bottom: 20px; }
.rate-display strong { font-size: 28px; color: var(--primary); }
.form-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.form-row input {
  flex: 1; padding: 11px 14px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 14px; outline: none; min-width: 160px;
}
.form-row input:focus { border-color: var(--primary); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.toggle-wrapper { display: flex; align-items: center; gap: 10px; }
.sub-text { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* TOGGLE SWITCH */
.toggle { position: relative; display: inline-block; width: 48px; height: 26px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background: #d1d5db; transition: .3s; border-radius: 26px;
}
.slider:before {
  position: absolute; content: ''; height: 20px; width: 20px;
  left: 3px; bottom: 3px; background: white; transition: .3s; border-radius: 50%;
}
input:checked + .slider { background: var(--primary); }
input:checked + .slider:before { transform: translateX(22px); }

/* MODAL */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-box {
  background: white; border-radius: 16px; padding: 32px; width: 100%;
  max-width: 440px; display: flex; flex-direction: column; gap: 16px;
}
.modal-box h3 { font-size: 18px; font-weight: 700; }
.modal-box input, .modal-box select {
  padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; width: 100%;
}
.modal-box input:focus, .modal-box select:focus { border-color: var(--primary); }
.modal-info { background: #f8fafc; border-radius: 8px; padding: 16px; font-size: 14px; line-height: 1.8; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* TOAST */
.toast {
  position: fixed; bottom: 24px; right: 24px; background: #1a1a2e;
  color: white; padding: 14px 20px; border-radius: 10px; font-size: 14px;
  font-weight: 500; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  transition: opacity .3s; max-width: 320px;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

.error { color: var(--red); font-size: 13px; margin-top: 8px; }
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); font-size: 14px; }
.tx-hash { font-family: monospace; font-size: 11px; }

/* TYPE RETRAIT / DÉPÔT */
.tx-withdrawal { border-left: 4px solid #f59e0b; }
.tx-deposit { border-left: 4px solid #10b981; }
.tx-type-badge {
  display: inline-block; padding: 2px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 700; margin-right: 4px;
}
.tx-withdrawal .tx-type-badge { background: #fef3c7; color: #92400e; }
.tx-deposit .tx-type-badge { background: #d1fae5; color: #065f46; }
.tx-meta strong { color: var(--text); font-weight: 600; }
