:root {
  --ng-blue-dark: #16217a;
  --ng-blue: #2244c7;
  --ng-teal: #159e8a;
  --ng-teal-light: #35c2ab;
  --ng-bg: #f4f7fb;
  --ng-surface: #ffffff;
  --ng-ink: #1b2340;
  --ng-ink-soft: #64708a;
  --ng-border: #e3e8f2;
  --ng-danger: #d1453b;
  --ng-warn: #e6a800;
  --ng-radius: 14px;
  --ng-shadow: 0 4px 18px rgba(22, 33, 122, 0.08);
  --ng-font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

body {
  font-family: var(--ng-font);
  background: var(--ng-bg);
  color: var(--ng-ink);
  margin: 0;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* ---------- Layout général ---------- */
.ng-shell { display: flex; min-height: 100vh; }

.ng-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--ng-blue-dark) 0%, #0f1958 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  transition: transform .25s ease;
}

.ng-sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.ng-sidebar .brand img { height: 34px; }
.ng-sidebar .brand span { font-weight: 800; font-size: 17px; letter-spacing: .3px; }

.ng-nav { padding: 14px 10px; overflow-y: auto; flex: 1; }
.ng-nav .grp-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: rgba(255,255,255,.45); padding: 14px 12px 6px;
}
.ng-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  color: rgba(255,255,255,.85); font-size: 14.5px; font-weight: 600;
  margin-bottom: 2px;
}
.ng-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.ng-nav a.active { background: linear-gradient(90deg, var(--ng-teal), var(--ng-teal-light)); color: #fff; }
.ng-nav a i { width: 18px; text-align: center; }

.ng-main { flex: 1; margin-left: 250px; min-width: 0; }

.ng-topbar {
  height: 66px; background: var(--ng-surface); border-bottom: 1px solid var(--ng-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; position: sticky; top: 0; z-index: 30;
}
.ng-topbar .burger { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--ng-blue-dark); }
.ng-topbar h1 { font-size: 18px; font-weight: 800; margin: 0; }
.ng-topbar .user-chip { display: flex; align-items: center; gap: 10px; }
.ng-topbar .user-chip .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--ng-blue), var(--ng-teal));
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}

.ng-content { padding: 24px; max-width: 1400px; }

/* ---------- Cartes ---------- */
.ng-card {
  background: var(--ng-surface);
  border-radius: var(--ng-radius);
  box-shadow: var(--ng-shadow);
  border: 1px solid var(--ng-border);
  padding: 20px;
}
.ng-card + .ng-card { margin-top: 18px; }
.ng-card .ng-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.ng-card .ng-card-head h2 { font-size: 16px; font-weight: 800; margin: 0; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 18px; }
.kpi {
  background: var(--ng-surface); border: 1px solid var(--ng-border); border-radius: var(--ng-radius);
  padding: 18px; box-shadow: var(--ng-shadow); position: relative; overflow: hidden;
}
.kpi .kpi-icon {
  width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; margin-bottom: 10px;
}
.kpi .kpi-value { font-size: 24px; font-weight: 800; }
.kpi .kpi-label { font-size: 12.5px; color: var(--ng-ink-soft); font-weight: 600; }
.kpi.blue .kpi-icon { background: linear-gradient(135deg, var(--ng-blue), var(--ng-blue-dark)); }
.kpi.teal .kpi-icon { background: linear-gradient(135deg, var(--ng-teal), var(--ng-teal-light)); }
.kpi.warn .kpi-icon { background: linear-gradient(135deg, #e6a800, #f2c94c); }
.kpi.red .kpi-icon { background: linear-gradient(135deg, #d1453b, #f07167); }

/* ---------- Formulaires ---------- */
.form-label { font-weight: 700; font-size: 13.5px; color: var(--ng-ink); margin-bottom: 4px; }
.form-control, .form-select {
  border-radius: 10px; border: 1.5px solid var(--ng-border); padding: 9px 12px; font-size: 14px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--ng-teal); box-shadow: 0 0 0 3px rgba(21,158,138,.15);
}

.btn { border-radius: 10px; font-weight: 700; font-size: 14px; padding: 9px 16px; }
.btn-primary { background: linear-gradient(90deg, var(--ng-blue), var(--ng-blue-dark)); border: none; }
.btn-primary:hover { background: linear-gradient(90deg, var(--ng-blue-dark), var(--ng-blue-dark)); }
.btn-success { background: linear-gradient(90deg, var(--ng-teal), var(--ng-teal-light)); border: none; }
.btn-outline-primary { border: 1.5px solid var(--ng-blue); color: var(--ng-blue); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

/* ---------- Tables ---------- */
.table { font-size: 14px; }
.table thead th {
  background: #eef2fb; color: var(--ng-blue-dark); font-weight: 800; font-size: 12.5px;
  text-transform: uppercase; letter-spacing: .03em; border: none; padding: 12px 14px;
}
.table tbody td { padding: 11px 14px; vertical-align: middle; border-color: var(--ng-border); }
.table-hover tbody tr:hover { background: #f6f9ff; }

.badge-role { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, #1a2f9a 0%, #0c1450 60%, #060a2e 100%);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 20px; padding: 40px 36px; width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-card img { height: 56px; display: block; margin: 0 auto 8px; }
.login-card .tagline { text-align: center; color: var(--ng-ink-soft); font-size: 13px; margin-bottom: 24px; font-weight: 600; }

/* ---------- Utilities ---------- */
.text-teal { color: var(--ng-teal); }
.text-blue { color: var(--ng-blue); }
.chip { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.chip-green { background: #e3f7ef; color: #0d8a5f; }
.chip-red { background: #fdeceb; color: var(--ng-danger); }
.chip-warn { background: #fff6df; color: #a6710a; }
.chip-blue { background: #e8edfd; color: var(--ng-blue); }
.empty-state { text-align: center; padding: 50px 20px; color: var(--ng-ink-soft); }
.empty-state i { font-size: 42px; opacity: .35; margin-bottom: 12px; display: block; }

.overlay-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(15,20,50,.55); z-index: 50;
  align-items: center; justify-content: center; padding: 16px;
}
.overlay-backdrop.show { display: flex; }

@media (max-width: 992px) {
  .ng-sidebar { transform: translateX(-100%); }
  .ng-sidebar.open { transform: translateX(0); }
  .ng-main { margin-left: 0; }
  .ng-topbar .burger { display: block; }
}

.toast-ng {
  position: fixed; top: 18px; right: 18px; z-index: 999; min-width: 260px;
  background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18);
  padding: 14px 16px; border-left: 5px solid var(--ng-teal); font-size: 14px; font-weight: 600;
  animation: slideIn .25s ease;
}
.toast-ng.error { border-color: var(--ng-danger); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.spin-loader {
  width: 20px; height: 20px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
