/* ============================================================
   THEME PRO — cohérent avec "users"
============================================================ */
:root{
  --bg:#0b1220;
  --bg2:#0a1020;
  --text:#e5e7eb;
  --muted:#94a3b8;
  --line: rgba(148,163,184,.14);
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --shadow2: 0 6px 16px rgba(0,0,0,.25);
  --primary:#2563eb;
  --primary2:#1d4ed8;
  --green:#16a34a;
  --red:#ef4444;
  --amber:#f59e0b;
  --cyan:#06b6d4;
  --radius:16px;
}
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:var(--text);
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(37,99,235,.25), transparent 60%),
    radial-gradient(900px 500px at 90% 10%, rgba(6,182,212,.18), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}

body.light{
  --bg:#f5f7fb;
  --bg2:#eef2ff;
  --text:#0f172a;
  --muted:#6b7280;
  --line: rgba(15,23,42,.10);
  --shadow: 0 10px 24px rgba(15,23,42,.08);
  --shadow2: 0 6px 14px rgba(15,23,42,.08);
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(37,99,235,.16), transparent 60%),
    radial-gradient(900px 500px at 90% 10%, rgba(6,182,212,.10), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}

/* Topbar */
.topbar{
  position:sticky; top:0; z-index:900;
  backdrop-filter: blur(12px);
  background: rgba(15,23,42,.72);
  border-bottom:1px solid var(--line);
}
body.light .topbar{ background: rgba(255,255,255,.75); }

.topbar-inner{
 
  margin:0 auto;
  padding: 14px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}
.brand{ display:flex; align-items:center; gap:12px; }
.brand img{ height:38px; width:auto; display:block; filter: drop-shadow(0 4px 10px rgba(0,0,0,.25)); }
.brand .who{ display:flex; flex-direction:column; gap:2px; line-height:1.1; }
.brand .who strong{ font-size:14px; font-weight:800; letter-spacing:.2px; }
.brand .who span{ font-size:12px;  }

.pills{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.pill{
  font-size:12px;
  padding: 6px 10px;
  border-radius:999px;
  background: rgba(148,163,184,.12);
  border: 1px solid rgba(148,163,184,.18);
}
body.light .pill{ background: rgba(15,23,42,.04); border-color: rgba(15,23,42,.10); }

.actions{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.btn{
  border:1px solid rgba(148,163,184,.18);
  background: rgba(15,23,42,.6);
  color: rgba(229,231,235,.92);
  padding: 9px 12px;
  border-radius: 12px;
  cursor:pointer;
  font-size: 13px;
  display:inline-flex;
  align-items:center;
  gap:8px;
  transition: transform .12s ease, background .12s ease, border-color .12s ease, opacity .12s ease;
  user-select:none;
}
body.light .btn{ background: rgba(15,23,42,.04); color:#0f172a; }
.btn:hover{ transform: translateY(-1px); border-color: rgba(148,163,184,.30); background: rgba(15,23,42,.75); }
body.light .btn:hover{ background: rgba(15,23,42,.06); }
.btn:active{ transform: translateY(0px); opacity:.95; }
.btn-primary{
  background: linear-gradient(135deg, rgba(37,99,235,.95), rgba(29,78,216,.95));
  border-color: rgba(37,99,235,.55);
  color:#fff;
}
.btn-primary:hover{ background: linear-gradient(135deg, rgba(29,78,216,.98), rgba(37,99,235,.92)); }
.btn-danger{
  background: rgba(239,68,68,.18);
  border-color: rgba(239,68,68,.35);
  color: #fecaca;
}
.btn-danger:hover{ background: rgba(239,68,68,.25); }
.btn-ghost{ background:transparent; }

/* Layout */
.container{
  max-width: 1220px;
  margin: 18px auto 28px;
  padding: 0 18px;
}
.card{
  background: rgba(15,23,42,.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
body.light .card{ background: rgba(255,255,255,.88); }

.card-head{
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
  display:flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.card-head .title{ display:flex; flex-direction:column; gap:3px; }
.card-head h1{ margin:0; font-size: 16px; letter-spacing:.2px; }
.card-head p{ margin:0; font-size: 12px; color: var(--muted); }

/* Toolbar */
.toolbar{
  padding: 12px 16px 14px;
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items:center;
  justify-content: space-between;
}
.toolbar-left{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.toolbar-right{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }

.field{ position:relative; min-width: 260px; }
.field input{
  width:100%;
  padding: 10px 12px 10px 38px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.20);
  background: rgba(2,6,23,.35);
  color: rgba(229,231,235,.92);
  outline:none;
  font-size: 13px;
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
body.light .field input{ background: rgba(15,23,42,.04); color:#0f172a; }
.field input::placeholder{ color: rgba(148,163,184,.75); }
.field input:focus{
  border-color: rgba(37,99,235,.60);
  box-shadow: 0 0 0 3px rgba(37,99,235,.18);
  background: rgba(2,6,23,.48);
}
body.light .field input:focus{ background: rgba(15,23,42,.06); }
.field .ico{
  position:absolute; left: 12px; top:50%;
  transform: translateY(-50%);
  opacity:.9;
}

.chips{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.chip{
  font-size:12px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(148,163,184,.08);
  cursor:pointer;
  user-select:none;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
body.light .chip{ background: rgba(15,23,42,.04); border-color: rgba(15,23,42,.10); }
.chip:hover{ transform: translateY(-1px); border-color: rgba(148,163,184,.30); background: rgba(148,163,184,.12); }
.chip.active{
  background: rgba(37,99,235,.18);
  border-color: rgba(37,99,235,.40);
}
body.light .chip.active{ background: rgba(37,99,235,.10); border-color: rgba(37,99,235,.22); }

.table-wrap{ width:100%; overflow:auto; }
.table{
  width:100%;
  border-collapse: collapse;
  min-width: 980px;
}
th, td{
  padding: 12px 12px;
  border-bottom: 1px solid rgba(148,163,184,.10);
  font-size: 13px;
  vertical-align: middle;
}
th{
  position: sticky;
  top: 0;
  background: rgba(2,6,23,.55);
  color: rgba(229,231,235,.85);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
  font-weight: 900;
  cursor:pointer;
  user-select:none;
}
body.light th{ background: rgba(255,255,255,.8); color:#0f172a; }

th .sort{ margin-left:6px; opacity:.55; font-size:10px; }

tbody tr{
  transition: background .12s ease, transform .10s ease;
  cursor:pointer;
}
tbody tr:hover{ background: rgba(148,163,184,.08); }
tbody tr.active{
  background: rgba(37,99,235,.14);
  box-shadow: inset 0 0 0 1px rgba(37,99,235,.22);
}
td.muted{  }


.badge .dot{
  width:8px; height:8px; border-radius:999px;
  background: rgba(148,163,184,.8);
  box-shadow: 0 0 0 3px rgba(148,163,184,.16);
}
.badge.warn{ background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.26); color:#fde68a; }
.badge.warn .dot{ background: rgba(245,158,11,.95); box-shadow: 0 0 0 3px rgba(245,158,11,.18); }
body.light .badge.warn{ color:#7c2d12; }

.badge.ok{ background: rgba(22,163,74,.12); border-color: rgba(22,163,74,.22); color:#bbf7d0; }
.badge.ok .dot{ background: rgba(22,163,74,.95); box-shadow: 0 0 0 3px rgba(22,163,74,.16); }
body.light .badge.ok{ color:#14532d; }

.actions-cell{ display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.action-btn{
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(2,6,23,.35);
  color: rgba(229,231,235,.92);
  font-size: 12px;
  cursor:pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
body.light .action-btn{ background: rgba(15,23,42,.04); color:#0f172a; }
.action-btn:hover{ transform: translateY(-1px); border-color: rgba(148,163,184,.30); background: rgba(2,6,23,.48); }
body.light .action-btn:hover{ background: rgba(15,23,42,.06); }
.action-btn.danger{
  background: rgba(239,68,68,.14);
  border-color: rgba(239,68,68,.30);
  color:#fecaca;
}
body.light .action-btn.danger{ color:#7f1d1d; }

/* Overlay + panel */
#overlay{
  position:fixed; inset:0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
  display:none;
  z-index: 998;
}
#overlay.visible{ display:block; }

#panel{
  position: fixed;
  right: -760px;
  top: 0;
  width: 660px;
  max-width: 92vw;
  height: 100%;
  background: rgba(15,23,42,.92);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 999;
  transition: right .28s ease;
  overflow:auto;
}
body.light #panel{ background: rgba(255,255,255,.92); }

#panel.open{ right:0; }
.panel-inner{ padding:16px; }
.panel-head{
  display:flex; align-items:flex-start; justify-content:space-between; gap:10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.panel-head h2{ margin:0; font-size: 15px; }
.panel-sub{ margin-top:4px; font-size:12px; color: var(--muted); }

label{
  display:block;
  font-size: 12px;
  color: rgba(148,163,184,.92);
  margin-bottom: 6px;
  font-weight: 800;
}
body.light label{ color: rgba(15,23,42,.72); }

input, select{
  
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.20);
  background: rgba(2,6,23,.35);
  color: rgba(229,231,235,.92);
  outline:none;
  font-size: 13px;
}
body.light input, body.light select{
  background: rgba(15,23,42,.04);
  color:#0f172a;
}
input:focus, select:focus{
  border-color: rgba(37,99,235,.60);
  box-shadow: 0 0 0 3px rgba(37,99,235,.18);
  background: rgba(2,6,23,.48);
}
body.light input:focus, body.light select:focus{ background: rgba(15,23,42,.06); }

.grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.grid .full{ grid-column: 1 / 3; }

.inline{
  display:flex;
  gap:8px;
  align-items:center;
}
.icon-btn{
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(148,163,184,.08);
  cursor:pointer;
}
body.light .icon-btn{ background: rgba(15,23,42,.04); border-color: rgba(15,23,42,.10); }
.icon-btn:hover{ transform: translateY(-1px); }

.panel-actions{
  display:flex;
  gap:10px;
  margin-top: 12px;
}
.panel-actions .btn{ width:100%; justify-content:center; }

.dirty{
  display:none;
  align-items:center;
  gap:8px;
  font-size:12px;
  color: rgba(245,158,11,.95);
  margin-top: 10px;
}
.dirty .dot{
  width:8px; height:8px; border-radius:999px;
  background: rgba(245,158,11,.95);
  box-shadow: 0 0 0 3px rgba(245,158,11,.18);
}
.dirty.show{ display:flex; }

/* Modal */
.modal-overlay{
  position:fixed; inset:0;
  background: rgba(0,0,0,.62);
  backdrop-filter: blur(2px);
  display:none;
  z-index: 2000;
}
.modal-overlay.visible{ display:block; }
.modal-box{
  position:fixed;
  top:50%; left:50%;
  transform: translate(-50%,-50%) scale(.96);
  width: 420px; max-width: 92vw;
  background: rgba(15,23,42,.95);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 14px 14px 12px;
  display:none;
  z-index: 2001;
  opacity: 0;
  transition: transform .18s ease, opacity .18s ease;
}
body.light .modal-box{ background: rgba(255,255,255,.95); }
.modal-box.visible{ display:block; opacity:1; transform: translate(-50%,-50%) scale(1); }
.modal-title{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.modal-title h3{ margin:0; font-size:15px; }
.modal-content{ padding:10px 2px 6px; font-size:13px; }
.modal-footer{
  display:flex; gap:10px; justify-content:flex-end;
  padding-top:10px;
  border-top: 1px solid var(--line);
}
.role-tag {
       background: #374151;
    padding: 4px 8px;
    border-radius: 6px;
    margin-left: 8px;
    font-size: 12px;
   
    color: #FFF;
    float: left;
}
/* Toasts */
#toastWrap{
  position: fixed;
  bottom: 18px; right: 18px;
  z-index: 3000;
  display:flex; flex-direction:column; gap:10px;
}
.toast{
  min-width: 260px;
  max-width: 420px;
  background: rgba(2,6,23,.85);
  border: 1px solid rgba(148,163,184,.18);
  border-left-width: 4px;
  border-radius: 14px;
  box-shadow: var(--shadow2);
  padding: 10px 12px;
  color: rgba(229,231,235,.94);
  animation: pop .16s ease;
  display:flex; align-items:flex-start; gap:10px;
}
body.light .toast{ background: rgba(255,255,255,.92); color:#0f172a; }
.toast.success{ border-left-color: rgba(22,163,74,.85); }
.toast.error{ border-left-color: rgba(239,68,68,.85); }
.toast.info{ border-left-color: rgba(37,99,235,.85); }
.toast small{ display:block; color: rgba(148,163,184,.85); margin-top:2px; }
body.light .toast small{ color: rgba(15,23,42,.55); }
.toast .x{
  margin-left:auto;
  opacity:.8;
  cursor:pointer;
  padding: 2px 6px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.15);
  background: rgba(148,163,184,.08);
}
.toast .x:hover{ opacity:1; }

@keyframes pop{
  from{ transform: translateY(6px); opacity:.0; }
  to{ transform: translateY(0px); opacity:1; }
}

@media (max-width: 820px){
  .pills{ display:none; }
  .field{ min-width: 220px; }
  .grid{ grid-template-columns: 1fr; }
  .grid .full{ grid-column: 1 / 2; }
  .table{ min-width: 860px; }
}

/* ================================
   FIX INFO-BULLE / TOOLTIP
   ================================ */

.tooltip,
.tooltip-content,
.info-bulle,
[data-tooltip]::after,
[data-tooltip]::before {
  background: #0f172a !important;   /* bleu nuit lisible */
  color: #f8fafc !important;        /* texte clair */
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}