:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --bg: #eef1f8;
  --surface: #ffffff;
  --text: #172033;
  --muted: #657087;
  --border: #dfe3ed;
  --danger: #c83549;
  --warn: #ba6200;
  --ok: #118458;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(23, 32, 51, .08);
}

* { box-sizing: border-box; }

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

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: .9em; }
.warn { color: var(--warn); }
.danger { color: var(--danger); }
.ok { color: var(--ok); }

/* ---------- Page d'authentification ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #2563eb 100%);
}

.auth-card {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
}

.auth-card .brand {
  font-size: 44px;
  text-align: center;
  margin-bottom: 8px;
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  text-align: center;
}

.auth-card > .muted {
  text-align: center;
  display: block;
  margin-bottom: 18px;
}

.auth-card label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin: 12px 0 4px;
}

.auth-card .switch {
  text-align: center;
  margin-top: 20px;
  font-size: .9rem;
  color: var(--muted);
}

.auth-card .switch a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.auth-card .switch a:hover { text-decoration: underline; }

.alert {
  background: #fde8ec;
  color: var(--danger);
  border: 1px solid #f5c2cc;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: .9rem;
  margin-bottom: 6px;
}

/* ---------- Formulaires ---------- */
input, select {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  width: 100%;
  font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}

.btn {
  padding: 10px 16px;
  border: 0;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}

.btn:hover { background: var(--primary-dark); }
.btn.alt { background: #edf0f6; color: var(--text); }
.btn.alt:hover { background: #e0e4ef; }
.btn.block { width: 100%; margin-top: 18px; padding: 12px; }

/* ---------- Barre supérieure ---------- */
.topbar {
  background: var(--surface);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.logo { font-weight: 800; font-size: 1.1rem; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }

.tab {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 9px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.tab:hover { background: #f0f2fa; }
.tab.active { background: var(--primary); color: #fff; }

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

/* ---------- Contenu ---------- */
.box { max-width: 1100px; margin: 26px auto; padding: 0 18px; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin: 15px 0;
  box-shadow: var(--shadow);
}

.card h2 { margin-top: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.grid .card { margin: 0; }

table { width: 100%; border-collapse: collapse; }
td, th { padding: 10px; border-bottom: 1px solid #edf0f6; text-align: left; }

.bar { height: 12px; background: #eceff5; border-radius: 12px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--primary); }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .auth-card { padding: 28px 20px; }
  .topbar-inner { gap: 10px; }
  .tab { padding: 7px 10px; font-size: .9rem; }
}