:root {
  --bg: #0f172a;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(160deg, #eef2ff 0%, #f4f6f9 40%, #f8fafc 100%);
  color: var(--text);
  min-height: 100vh;
  padding: 20px;
}

/* ── Header ── */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  color: white;
  padding: 18px 28px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
header h1 { font-size: 22px; font-weight: 700; letter-spacing: -.3px; }
header h1 span { opacity: .6; font-weight: 400; font-size: 14px; margin-left: 10px; }
.header-actions { display: flex; gap: 8px; }
.btn {
  border: none; padding: 9px 16px; border-radius: 8px;
  font-weight: 600; font-size: 13px; cursor: pointer; transition: .15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { background: #93c5fd; cursor: not-allowed; }
.btn-ghost { background: #334155; color: white; }
.btn-ghost:hover { background: #475569; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }

/* ── Navigation entre pages ── */
.admin-nav {
  display: flex; gap: 6px; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px; box-shadow: var(--shadow);
}
.admin-nav a {
  flex: 1; text-align: center; text-decoration: none;
  padding: 10px 16px; border-radius: 8px; font-size: 14px; font-weight: 700;
  color: var(--muted); transition: .15s; cursor: pointer;
}
.admin-nav a:hover { background: var(--surface-2); color: var(--text); }
.admin-nav a.active { background: var(--accent); color: white; }

/* ── Cartes / conteneurs ── */
.user-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 20px;
}

/* ── Table ── */
.table-wrap { overflow-x: auto; margin-top: 14px; border-radius: 8px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
  padding: 10px 12px; background: var(--surface-2); white-space: nowrap;
}
td { padding: 11px 12px; font-size: 13px; border-top: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #fafbff; }
tr.row-highlight td { background: #fef9c3 !important; }

.status-select {
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border);
  font-size: 13px; background: white; font-weight: 500;
}
select.status-select, input.status-select { cursor: pointer; }
input.status-select { cursor: text; }

.btn-refresh {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 12px;
  cursor: pointer; transition: .15s;
}
.btn-refresh:hover { background: #eef2ff; border-color: var(--accent); color: var(--accent-hover); }

.btn-delete {
  background: #fee2e2; color: var(--danger); border: none;
  padding: 6px 12px; border-radius: 6px; font-weight: 600; font-size: 12px;
  cursor: pointer; transition: .15s;
}
.btn-delete:hover { background: #fca5a5; }

.badge {
  display: inline-block; padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge.badge-en_attente { background: #fef9c3; color: #854d0e; border-color: #fde68a; }
.badge.badge-paye { background: #dcfce7; color: #166534; border-color: #bbf7d0; }

.history-box {
  margin-top: 14px; padding: 12px 14px;
  background: #fffbeb; border-left: 4px solid var(--warning);
  border-radius: 6px; font-size: 12px; color: #92400e;
}
.history-box ul { margin-top: 8px; margin-left: 18px; }
.history-box li { margin-bottom: 4px; line-height: 1.5; }

/* ── Login ── */
.login-overlay {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.login-box {
  background: white; padding: 40px; border-radius: 16px;
  width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-box h2 { margin-bottom: 6px; color: var(--text); font-size: 22px; }
.login-box .login-sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-box label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; margin-top: 16px; }
.login-box input {
  width: 100%; padding: 11px 13px; border-radius: 8px;
  border: 1px solid var(--border); font-size: 14px; outline: none;
}
.login-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.login-box button {
  width: 100%; margin-top: 24px; background: var(--accent); color: white; border: none;
  padding: 13px; border-radius: 8px; font-weight: 700; cursor: pointer; font-size: 15px;
}
.login-box button:hover { background: var(--accent-hover); }
.login-error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 16px; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--bg); color: white;
  padding: 12px 18px; border-radius: 8px; font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); opacity: 0; transform: translateY(10px);
  transition: .25s; pointer-events: none; z-index: 2000;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── Loading ── */
.loading-state {
  text-align: center; padding: 60px 20px; color: var(--muted);
}
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite; margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.section-title { margin-bottom: 15px; color: var(--text); font-size: 20px; }
.card-title { margin-bottom: 14px; font-size: 16px; }
.field-label { display:block; font-size:12px; color: var(--muted); margin-bottom:6px; font-weight: 600; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

@media (max-width: 640px) {
  body { padding: 12px; }
  header { flex-direction: column; gap: 12px; align-items: flex-start; }
  .admin-nav { flex-direction: column; }
}
