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

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #16213a;
  --border: #334155;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --error: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
}

.topbar .brand .icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn.secondary { background: var(--surface-2); border: 1px solid var(--border); }
.btn.small { padding: 6px 12px; font-size: 0.8rem; }
.btn.danger { background: var(--error); }

.container { max-width: 1100px; margin: 0 auto; padding: 32px; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 { font-size: 1.4rem; font-weight: 700; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--surface-2); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge.pro { background: rgba(99,102,241,0.15); color: #a5b4fc; }
.badge.performance { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.badge.actif { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.badge.suspendu { background: rgba(239,68,68,0.15); color: #fca5a5; }
.badge.pending { background: rgba(245,158,11,0.15); color: #fcd34d; }

.form-group { margin-bottom: 18px; }
label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
input, select {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.2); }

.row { display: flex; gap: 16px; }
.row > * { flex: 1; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
}
.stat-card .stat-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 700; margin-top: 6px; }
.stat-card .stat-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.metier-list { display: flex; flex-direction: column; gap: 8px; }
.metier-row { display: flex; align-items: center; gap: 12px; }
.metier-row .metier-nom { flex: 0 0 160px; font-size: 0.85rem; color: var(--text-muted); }
.metier-row .metier-bar-wrap { flex: 1; background: var(--surface-2); border-radius: 6px; height: 8px; overflow: hidden; }
.metier-row .metier-bar { height: 100%; background: var(--accent); border-radius: 6px; }
.metier-row .metier-total { flex: 0 0 40px; text-align: right; font-size: 0.85rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 8px; }
.feature-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.85rem;
}
.feature-item input { width: auto; }
.feature-item.core { opacity: 0.65; }

.error-msg, .success-msg {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.85rem;
  margin-top: 16px;
  display: none;
}
.error-msg { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; }
.success-msg { background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.3); color: #6ee7b7; }
.error-msg.visible, .success-msg.visible { display: block; }

.empty-state { text-align: center; color: var(--text-muted); padding: 48px 0; }

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center; justify-content: center;
  z-index: 10;
}
.modal-overlay.visible { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
}
.modal h2 { font-size: 1.15rem; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
