/* Pulse (by Nmilat.COM) — design system du PoC Flask. Chargé après le CSS Acelle. */
:root{
  --pulse:#4f46e5; --pulse-dark:#4338ca; --pulse-soft:#eef2ff;
  --ink:#0f172a; --muted:#64748b; --line:#e8edf3; --bg:#f4f6fb;
  --side:#0f172a; --side-2:#1e293b; --side-muted:#94a3b8;
  --ok:#16a34a; --warn:#d97706; --err:#dc2626;
  --radius:14px; --shadow:0 1px 3px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.05);
}
*{ box-sizing:border-box; }
body{ font-family:"Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color:var(--ink); margin:0; padding:0; }
a{ color:var(--pulse); text-decoration:none; }
.material-symbols-rounded{ font-size:20px; line-height:1; vertical-align:middle; }

/* ---------- Brand ---------- */
.brand-word{ font-weight:800; letter-spacing:-.5px; }
.brand-word::before{ content:"●"; color:var(--pulse); margin-right:7px; font-size:.7em; vertical-align:middle; }
.brand-tag{ font-size:11px; color:var(--muted); font-weight:600; text-transform:uppercase; letter-spacing:1.5px; }

/* ===================== LOGIN ===================== */
body.login-page{ min-height:100vh; background:linear-gradient(135deg,#eef2ff 0%,#f8fafc 60%); display:flex; align-items:center; justify-content:center; }
.auth-wrap{ width:100%; max-width:410px; padding:24px; }
.auth-card{ background:#fff; border-radius:18px; box-shadow:0 12px 44px rgba(2,6,23,.13); padding:36px 32px; }
.auth-brand{ display:flex; align-items:baseline; gap:10px; margin-bottom:26px; }
.auth-brand .brand-word{ font-size:30px; color:var(--ink); }
.auth-title{ font-size:18px; font-weight:700; margin:0 0 22px; }
.auth-sub{ font-size:13.5px; color:var(--muted); margin:-12px 0 22px; line-height:1.5; }
.auth-alt{ text-align:center; margin:14px 0 0; font-size:13.5px; }
.auth-alt a{ color:var(--pulse); font-weight:600; }
.fld{ display:block; margin-bottom:16px; }
.fld span{ display:block; font-size:13px; color:var(--muted); margin-bottom:6px; font-weight:600; }
.fld input{ width:100%; padding:11px 13px; border:1px solid #cbd5e1; border-radius:10px; font-size:14px; outline:none; transition:border-color .15s, box-shadow .15s; }
.fld input:focus{ border-color:var(--pulse); box-shadow:0 0 0 3px rgba(79,70,229,.15); }
.rem{ display:flex; align-items:center; gap:8px; font-size:13px; color:var(--muted); margin-bottom:22px; }
.btn-pulse{ width:100%; background:var(--pulse); color:#fff; border:0; padding:12px; border-radius:10px; font-size:15px; font-weight:600; cursor:pointer; transition:background .15s; }
.btn-pulse:hover{ background:var(--pulse-dark); }
.auth-foot{ text-align:center; color:var(--muted); font-size:12px; margin-top:18px; }

/* ===================== APP SHELL ===================== */
.layout{ display:flex; min-height:100vh; }
.sidebar{ width:236px; flex-shrink:0; background:var(--side); color:#fff; display:flex; flex-direction:column; position:sticky; top:0; height:100vh; overflow-y:auto; }
/* Scrollbar discrete sur la sidebar sombre */
.sidebar::-webkit-scrollbar{ width:8px; }
.sidebar::-webkit-scrollbar-thumb{ background:rgba(255,255,255,.14); border-radius:8px; }
.sidebar .brand{ padding:20px 20px 16px; }
.sidebar .brand .brand-word{ font-size:21px; color:#fff; }
.sidebar .brand .brand-tag{ display:block; color:var(--side-muted); margin-top:3px; }
.nav{ display:flex; flex-direction:column; padding:8px; gap:2px; }
.nav-item{ display:flex; align-items:center; gap:12px; padding:11px 14px; border-radius:10px; color:var(--side-muted); font-size:14.5px; font-weight:500; transition:background .12s, color .12s; }
.nav-item:hover{ background:rgba(255,255,255,.06); color:#fff; }
.nav-item.active{ background:var(--pulse); color:#fff; box-shadow:0 4px 14px rgba(79,70,229,.45); }
.nav-item .material-symbols-rounded{ font-size:21px; }
.nav-sep{ height:1px; background:rgba(255,255,255,.08); margin:10px 12px; }
/* Groupe avec sous-menus */
.nav-group{ display:flex; align-items:center; gap:12px; padding:11px 14px 5px; color:var(--side-muted);
  font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:1px; }
.nav-group .material-symbols-rounded{ font-size:19px; }
.nav-sub{ display:flex; align-items:center; gap:9px; padding:9px 14px 9px 26px; border-radius:10px;
  color:var(--side-muted); font-size:14px; font-weight:500; transition:background .12s, color .12s; }
.nav-sub::before{ content:"•"; opacity:.6; }
.nav-sub:hover{ background:rgba(255,255,255,.06); color:#fff; }
.nav-sub.active{ background:var(--pulse); color:#fff; box-shadow:0 4px 14px rgba(79,70,229,.45); }
.nav-sub.active::before{ opacity:1; }
.nav-item.nav-admin{ color:#fcd34d; }
.nav-item.nav-admin:hover{ background:rgba(251,191,36,.12); color:#fde68a; }
.nav-item.nav-admin.active{ background:#b45309; color:#fff; box-shadow:none; }
.nav-item.nav-back{ color:var(--side-muted); }

.main{ flex:1; min-width:0; background:var(--bg); display:flex; flex-direction:column; }
.topbar{ background:#fff; border-bottom:1px solid var(--line); padding:0 28px; height:62px; display:flex; align-items:center; gap:16px; }
.topbar .spacer{ flex:1; }
.topbar .user{ display:flex; align-items:center; gap:10px; color:var(--ink); font-weight:600; font-size:14px; }
.avatar{ width:34px; height:34px; border-radius:50%; background:var(--pulse); color:#fff; display:inline-flex; align-items:center; justify-content:center; font-weight:700; font-size:14px; }
.topbar-logout{ color:var(--muted); font-weight:600; font-size:14px; display:inline-flex; align-items:center; gap:6px; }
.topbar-logout:hover{ color:var(--err); }
/* Menu deroulant compte (avatar) — sans JS via <details> */
.user-menu{ position:relative; }
.user-menu > summary{ list-style:none; cursor:pointer; display:flex; align-items:center; gap:9px;
  padding:6px 10px; border-radius:10px; color:var(--ink); font-weight:600; font-size:14px; }
.user-menu > summary::-webkit-details-marker{ display:none; }
.user-menu > summary:hover{ background:#f1f5f9; }
.user-menu > summary .chev{ font-size:18px; color:var(--muted); transition:transform .15s; }
.user-menu[open] > summary .chev{ transform:rotate(180deg); }
.user-menu-pop{ position:absolute; right:0; top:calc(100% + 6px); background:#fff;
  border:1px solid var(--line); border-radius:11px; box-shadow:0 12px 32px rgba(2,6,23,.16);
  min-width:210px; padding:6px; z-index:60; }
.user-menu-pop a{ display:flex; align-items:center; gap:10px; padding:9px 12px; border-radius:8px;
  color:var(--ink); font-size:14px; font-weight:500; }
.user-menu-pop a:hover{ background:#f1f5f9; }
.user-menu-pop a.danger:hover{ background:#fef2f2; color:var(--err); }
.user-menu-pop .material-symbols-rounded{ font-size:19px; color:var(--muted); }
.user-menu-pop .sep{ height:1px; background:var(--line); margin:5px 4px; }
.content-area{ padding:28px; max-width:1120px; width:100%; }
.content-area h4{ font-size:22px; font-weight:700; margin:0 0 4px; }
.page-head{ display:flex; align-items:center; gap:12px; margin-bottom:18px; }
.text-muted{ color:var(--muted); }

/* ---------- Cards ---------- */
.card{ background:#fff; border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); }
.stats{ display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:18px; margin:8px 0 18px; }
.stat-card{ background:#fff; border:1px solid var(--line); border-radius:var(--radius); padding:22px; box-shadow:var(--shadow); position:relative; overflow:hidden; transition:transform .12s, box-shadow .12s; }
.stat-card:hover{ transform:translateY(-2px); box-shadow:0 10px 30px rgba(15,23,42,.10); }
.stat-card::before{ content:""; position:absolute; left:0; top:0; bottom:0; width:4px; background:var(--pulse); }
.stat-num{ font-size:32px; font-weight:800; color:var(--ink); line-height:1; }
.stat-label{ color:var(--muted); font-weight:600; font-size:13px; margin-top:8px; text-transform:uppercase; letter-spacing:.4px; }

/* ---------- Tables (override Acelle .table) ---------- */
.table{ width:100%; background:#fff; border-collapse:separate; border-spacing:0; border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow); }
.table thead th{ background:#f8fafc; color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.5px; font-weight:700; padding:12px 16px; border-bottom:1px solid var(--line); text-align:left; }
.table tbody td{ padding:13px 16px; border-bottom:1px solid var(--line); font-size:14px; vertical-align:middle; }
.table tbody tr:last-child td{ border-bottom:0; }
.table tbody tr:hover{ background:#fafbff; }
.table code{ background:#f1f5f9; padding:2px 6px; border-radius:6px; font-size:12px; color:var(--muted); }
/* Table imbriquee dans une .card : pas de double cadre */
.card > .table, .card > #contact-table > .table{ border:0; border-radius:0; box-shadow:none; }
.card > .table thead th:first-child, .card > #contact-table > .table thead th:first-child{ padding-left:16px; }

/* ---------- Buttons (override Acelle .btn*) ---------- */
.btn{ display:inline-flex; align-items:center; gap:6px; font-weight:600; font-size:14px; padding:9px 16px; border-radius:9px; border:1px solid transparent; cursor:pointer; line-height:1.2; transition:background .12s, border-color .12s, color .12s; text-decoration:none; }
.btn-primary{ background:var(--pulse); color:#fff; border-color:var(--pulse); }
.btn-primary:hover{ background:var(--pulse-dark); border-color:var(--pulse-dark); color:#fff; }
.btn-secondary{ background:#fff; color:var(--ink); border-color:#cbd5e1; }
.btn-secondary:hover{ background:#f8fafc; color:var(--ink); }
.btn-danger{ background:#fff; color:var(--err); border-color:#fecaca; }
.btn-danger:hover{ background:#fef2f2; color:var(--err); }
.btn-link{ background:transparent; color:var(--muted); padding:9px 10px; }
.btn-link:hover{ color:var(--ink); }
.btn-sm, .btn-xs{ padding:6px 11px; font-size:12.5px; border-radius:8px; }

/* ---------- Forms (override Acelle .form-control) ---------- */
.form-control{ width:100%; padding:10px 12px; border:1px solid #cbd5e1; border-radius:9px; font-size:14px; background:#fff; outline:none; transition:border-color .15s, box-shadow .15s; }
.form-control:focus{ border-color:var(--pulse); box-shadow:0 0 0 3px rgba(79,70,229,.13); }
.form-group{ margin-bottom:16px; }
.form-group label{ font-size:13px; font-weight:600; color:var(--muted); display:block; margin-bottom:6px; }
fieldset{ border:1px solid var(--line) !important; border-radius:10px; }
legend{ color:var(--muted); }

/* ---------- Labels / badges (override Acelle .label) ---------- */
.label{ display:inline-block; padding:3px 10px; border-radius:999px; font-size:12px; font-weight:600; }
.label-success{ background:#dcfce7; color:#166534; }
.label-danger{ background:#fee2e2; color:#991b1b; }
.label-default{ background:#e2e8f0; color:#475569; }
.label-info{ background:#dbeafe; color:#1e40af; }

input[type="search"].form-control{ max-width:340px; }

/* ---------- Mini bar charts (dashboard) ---------- */
.bars{ display:flex; align-items:flex-end; gap:10px; height:130px; padding-top:6px; }
.bar-col{ flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:5px; height:100%; }
.bar{ width:100%; max-width:46px; background:var(--pulse); border-radius:6px 6px 0 0; min-height:3px; transition:height .2s; }
.bar-col:hover .bar{ background:var(--pulse-dark); }
.bar-val{ font-size:11px; font-weight:700; color:var(--ink); }
.bar-lbl{ font-size:11px; color:var(--muted); }

/* ---------- Quota (barres de progression) ---------- */
.quota{ margin-bottom:12px; }
.quota-head{ display:flex; justify-content:space-between; font-size:13px; margin-bottom:5px; }
.quota-bar{ height:8px; background:#e2e8f0; border-radius:999px; overflow:hidden; }
.quota-fill{ height:100%; background:var(--pulse); border-radius:999px; }
.quota-fill.warn{ background:#f59e0b; }
.quota-fill.over{ background:var(--err); }

/* ---------- Pagination ---------- */
.pager{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:14px; }
.pager-info{ color:var(--muted); font-size:13px; }
.pager-nav{ display:flex; gap:8px; }

/* ---------- Bandeau impersonation (mode support) ---------- */
.impersonation-bar{ display:flex; align-items:center; gap:14px; justify-content:space-between;
  background:#b45309; color:#fff; padding:9px 18px; font-size:13.5px; font-weight:500; }
.impersonation-bar a{ color:#fff; font-weight:700; text-decoration:underline; white-space:nowrap; }

/* ---------- KPI (rapports) ---------- */
.kpi-row{ display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:14px; }
.kpi-row-6{ grid-template-columns:repeat(6,1fr); }
@media (max-width:1000px){ .kpi-row, .kpi-row-6{ grid-template-columns:repeat(3,1fr); } }
@media (max-width:640px){ .kpi-row, .kpi-row-6{ grid-template-columns:repeat(2,1fr); } }
.kpi{ padding:16px 18px; }
.kpi-val{ font-size:26px; font-weight:800; line-height:1.1; color:var(--ink); }
.kpi.sm .kpi-val{ font-size:20px; }
.kpi-lbl{ color:var(--muted); font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:.3px; margin-top:6px; }
.kpi-sub{ color:var(--muted); font-size:12px; margin-top:4px; }
.kpi.accent{ border-color:var(--pulse); box-shadow:0 4px 16px rgba(79,70,229,.12); }
.kpi.accent .kpi-val{ color:var(--pulse); }

/* ---------- Cards & layout helpers ---------- */
.card-body{ padding:18px 20px; }
.card-title{ display:flex; align-items:center; gap:8px; font-size:13px; font-weight:700;
  text-transform:uppercase; letter-spacing:.4px; color:var(--muted); margin:0 0 14px; }
.card-title .material-symbols-rounded{ font-size:18px; color:var(--pulse); }
.card-hint{ color:var(--muted); font-size:12.5px; margin:8px 0 0; }
.grid-2{ display:grid; grid-template-columns:1fr 1fr; gap:16px; align-items:start; margin-bottom:18px; }
@media (max-width:900px){ .grid-2{ grid-template-columns:1fr; } }
.field-row{ display:flex; gap:12px; }
.field-row > *{ flex:1; }
.toolbar{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.toolbar .spacer{ flex:1; }
/* Input fichier un peu plus soigne */
input[type="file"].form-control{ padding:8px 12px; }
input[type="file"].form-control::file-selector-button{ margin-right:12px; padding:7px 12px;
  border:1px solid #cbd5e1; border-radius:8px; background:#f8fafc; color:var(--ink);
  font-weight:600; font-size:13px; cursor:pointer; }
input[type="file"].form-control::file-selector-button:hover{ background:#eef2ff; border-color:var(--pulse); }

/* ---------- Flash toasts ---------- */
.alert{ position:fixed; top:18px; left:50%; transform:translateX(-50%); z-index:1000;
  padding:12px 20px; border-radius:10px; box-shadow:0 8px 28px rgba(2,6,23,.18);
  font-size:14px; min-width:280px; max-width:90vw; text-align:center; border:0;
  transition:opacity .4s; }
/* Acelle injecte une icône (content:"check_circle"...) sur les .alert -> on la retire. */
.alert::before, .alert::after{ content:none !important; display:none !important; }
.alert-success{ background:#dcfce7; color:#166534; }
.alert-danger{ background:#fee2e2; color:#991b1b; }
.alert-warning{ background:#fef9c3; color:#854d0e; }
.alert-info{ background:#dbeafe; color:#1e40af; }

/* ---------- Admin variant ---------- */
.layout.admin .sidebar{ background:#1c1917; }
.layout.admin .nav-item.active{ background:#b45309; box-shadow:0 4px 14px rgba(180,83,9,.4); }
.layout.admin .stat-card::before{ background:#d97706; }
.layout.admin .stat-num{ color:#92400e; }
