/* ═══════════════════════════════════════════════════════════════════════════
   EXADVIZE — Design System v1.0
   Fichier partagé par toutes les interfaces du prototype
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── RESET ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

/* ── TOKENS — MODE CLAIR ────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --orange:         #ff6600;
  --orange-dark:    #e55a00;
  --orange-light:   #fff3e0;
  --orange-subtle:  rgba(255, 102, 0, 0.08);

  /* Neutrals */
  --text:           #1a1a1a;
  --text-muted:     #6b7280;
  --text-light:     #9ca3af;
  --border:         #e5e7eb;
  --border-light:   #f3f4f6;
  --bg:             #f8fafc;
  --bg2:            #f1f5f9;
  --white:          #ffffff;

  /* Status */
  --success:        #16a34a;
  --success-light:  #dcfce7;
  --error:          #dc2626;
  --error-light:    #fee2e2;
  --warning:        #d97706;
  --warning-light:  #fef3c7;
  --info:           #2563eb;
  --info-light:     #dbeafe;
  --purple:         #7c3aed;
  --purple-light:   #ede9fe;

  /* Sidebar */
  --sidebar-bg:          #f1f5f9;
  --sidebar-hover:       rgba(0, 0, 0, 0.05);
  --sidebar-active:      var(--orange-subtle);
  --sidebar-txt:         var(--text-muted);
  --sidebar-txt-active:  var(--orange);
  --sidebar-width:       56px;
  --sidebar-width-open:  220px;

  /* Misc */
  --radius:     14px;
  --radius-sm:  8px;
  --radius-xs:  5px;
  --shadow:     0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:  0 10px 24px rgba(0,0,0,0.12);
  --transition: 0.18s ease;
}

/* ── TOKENS — MODE SOMBRE ───────────────────────────────────────────────────── */
body.dark {
  --bg:            #0f172a;
  --bg2:           #1e293b;
  --white:         #1e293b;
  --text:          #f1f5f9;
  --text-muted:    #94a3b8;
  --text-light:    #64748b;
  --border:        #334155;
  --border-light:  #1e293b;
  --orange-subtle: rgba(255, 102, 0, 0.12);
  --orange-light:  rgba(255, 102, 0, 0.18);
  --success-light: rgba(22, 163, 74, 0.15);
  --error-light:   rgba(220, 38, 38, 0.15);
  --warning-light: rgba(217, 119, 6, 0.15);
  --info-light:    rgba(37, 99, 235, 0.15);
  --purple-light:  rgba(124, 58, 237, 0.15);
  --shadow:        0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:     0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg:     0 10px 24px rgba(0,0,0,0.45);
  --sidebar-bg:         #1e293b;
  --sidebar-hover:      rgba(255, 255, 255, 0.07);
  --sidebar-active:     rgba(255, 102, 0, 0.14);
  --sidebar-txt:        rgba(255, 255, 255, 0.55);
  --sidebar-txt-active: #ff6600;
}

/* ── BASE ───────────────────────────────────────────────────────────────────── */
body {
  font-family: 'Inter', system-ui, -apple-system, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  transition: background var(--transition), color var(--transition);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ── LAYOUT ─────────────────────────────────────────────────────────────────── */
.app {
  display: flex;
  min-height: 100vh;
}
.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── SIDEBAR ────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 300;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 0 16px 16px 0;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar:hover { width: var(--sidebar-width-open); }

.sidebar-logo {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  flex-shrink: 0;
}
.sidebar-logo-dot {
  width: 28px; height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
  object-fit: contain;
}
.sidebar-logo-text {
  font-size: 16px; font-weight: 800; color: var(--text);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s ease 0.05s;
}
.sidebar:hover .sidebar-logo-text { opacity: 1; }
.sidebar-logo-text span { color: var(--orange); }

.sidebar-nav { flex: 1; padding: 10px 0; overflow: hidden; }
.sidebar-bottom { padding: 8px 0 12px; border-top: 1px solid var(--border); }
.sidebar-sep { height: 1px; background: var(--border); margin: 5px 12px; }

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 8px 16px 4px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s ease 0.05s;
}
.sidebar:hover .sidebar-section-label { opacity: 1; }

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
  cursor: pointer;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
  color: var(--sidebar-txt);
  white-space: nowrap;
  position: relative;
  border: none;
  background: transparent;
  width: calc(100% - 16px);
  font-family: inherit;
  font-size: 13px;
}
.sidebar-item:hover { background: var(--sidebar-hover); color: var(--text); }
.sidebar-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-txt-active);
  font-weight: 600;
}
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: -8px; top: 50%;
  transform: translateY(-50%);
  height: 18px; width: 3px;
  background: var(--orange);
  border-radius: 0 2px 2px 0;
}
.sidebar-icon {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.sidebar-label {
  font-size: 13px; font-weight: 500;
  opacity: 0;
  transition: opacity 0.15s ease 0.05s;
}
.sidebar:hover .sidebar-label { opacity: 1; }
.sidebar-badge {
  background: var(--orange); color: white;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 10px;
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.15s ease 0.05s;
}
.sidebar:hover .sidebar-badge { opacity: 1; }

/* ── TOP NAV ─────────────────────────────────────────────────────────────────── */
.nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: 56px;
  padding: 0 24px 0 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0;
  z-index: 200;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: background var(--transition), border-color var(--transition);
}
.nav-left  { display: flex; align-items: center; gap: 12px; }
.nav-right { display: flex; align-items: center; gap: 6px; }
.nav-center {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 20px;
  max-width: 360px;
}

.nav-search {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 11px;
  height: 34px;
  width: 100%;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.nav-search:focus-within {
  border-color: var(--orange);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(255,102,0,0.08);
}
.nav-search-icon { color: var(--text-light); font-size: 13px; flex-shrink: 0; }
.nav-search-input {
  border: none; background: transparent;
  font-size: 13px; color: var(--text);
  outline: none; flex: 1;
  font-family: inherit;
}
.nav-search-input::placeholder { color: var(--text-light); }

.page-breadcrumb { font-size: 13px; color: var(--text-muted); }
.page-breadcrumb strong { color: var(--text); }

.nav-icon-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; cursor: pointer;
  color: var(--text-muted); font-size: 16px;
  position: relative;
  transition: all var(--transition);
}
.nav-icon-btn:hover { background: var(--bg); color: var(--text); }
.nav-icon-btn .dot-badge {
  position: absolute; top: 4px; right: 4px;
  width: 7px; height: 7px;
  background: var(--orange); border-radius: 50%;
  border: 1.5px solid var(--white);
}
.nav-icon-btn .count-badge {
  position: absolute; top: 3px; right: 3px;
  background: var(--error); color: white;
  font-size: 9px; font-weight: 700;
  min-width: 15px; height: 15px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  border: 1.5px solid var(--white);
}
.nav-sep { width: 1px; height: 22px; background: var(--border); margin: 0 3px; }

.avatar-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  border: none; background: transparent;
}
.avatar-btn:hover { background: var(--bg); }

/* ── AVATARS ─────────────────────────────────────────────────────────────────── */
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white;
  flex-shrink: 0;
}
.avatar-sm { width: 24px; height: 24px; font-size: 9px; }
.avatar-md { width: 34px; height: 34px; font-size: 13px; }
.avatar-lg { width: 42px; height: 42px; font-size: 15px; }
.avatar-xl { width: 52px; height: 52px; font-size: 18px; }

.avatar-marc     { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.avatar-sophie   { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.avatar-philippe { background: linear-gradient(135deg, #f59e0b, #d97706); }
.avatar-florian  { background: linear-gradient(135deg, #ff6600, #e55a00); }
.avatar-generic  { background: linear-gradient(135deg, #6b7280, #4b5563); }

.avatar-name { font-size: 13px; font-weight: 500; color: var(--text); }
.avatar-role { font-size: 11px; color: var(--text-muted); }

/* ── PROFILE DROPDOWN ───────────────────────────────────────────────────────── */
.profile-menu-wrap { position: relative; }
.profile-menu {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  width: 230px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 400;
  display: none;
  overflow: hidden;
}
.profile-menu.open { display: block; }
.profile-menu-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.profile-menu-name { font-size: 14px; font-weight: 700; }
.profile-menu-role { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.profile-menu-company { font-size: 11px; color: var(--orange); font-weight: 600; margin-top: 2px; }
.profile-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  font-size: 13px; color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
  border: none; background: none;
  width: 100%; text-align: left;
  font-family: inherit;
  text-decoration: none;
}
.profile-menu-item:hover { background: var(--bg); }
.profile-menu-item.danger { color: var(--error); }
.profile-menu-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ── PAGE HEADER ─────────────────────────────────────────────────────────────── */
.page-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 20px 32px;
}
.page-header-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 800; color: var(--text); }
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 2px; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── MAIN LAYOUT ─────────────────────────────────────────────────────────────── */
.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px 48px;
}
.layout-full { padding: 24px 32px 48px; }

/* ── BUTTONS ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  border: none;
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-primary   { background: var(--orange); color: white; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-secondary { background: var(--bg2); color: var(--text); }
.btn-secondary:hover { background: var(--border); }
.btn-outline   { background: transparent; border: 1.5px solid var(--border); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--orange); color: var(--orange); background: var(--orange-subtle); }
.btn-ghost     { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger    { background: var(--error); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-success   { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }
.btn-icon-sm { padding: 5px; width: 28px; height: 28px; justify-content: center; border-radius: var(--radius-xs); }

/* ── BADGES / STATUTS ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.badge-orange  { background: var(--orange-light); color: var(--orange-dark); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-error   { background: var(--error-light); color: var(--error); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: var(--info-light); color: var(--info); }
.badge-purple  { background: var(--purple-light); color: var(--purple); }
.badge-neutral { background: var(--bg2); color: var(--text-muted); }
.badge-dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* Statuts tickets Exadvize */
.status-en-attente   { background: var(--warning-light); color: var(--warning); }
.status-en-cours     { background: var(--info-light); color: var(--info); }
.status-traite       { background: var(--success-light); color: var(--success); }
.status-escalade     { background: var(--orange-light); color: var(--orange-dark); }
.status-cloture      { background: var(--bg2); color: var(--text-muted); }
.status-precontentieux { background: var(--error-light); color: var(--error); }
.status-redirige     { background: var(--purple-light); color: var(--purple); }

/* ── CARDS ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-sm { padding: 14px 18px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  gap: 10px;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text); }
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Metric cards */
.metric-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: visible;
}
.metric-card-label { font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.metric-card-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.metric-card-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.metric-card-trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 600;
  margin-top: 6px;
}
.metric-card-trend.up   { color: var(--success); }
.metric-card-trend.down { color: var(--error); }
.metric-card-icon {
  position: absolute; right: 16px; top: 16px;
  font-size: 24px; opacity: 0.12;
}

/* ── TABLES ──────────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--white);
  box-shadow: var(--shadow);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  background: var(--bg);
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0;
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--text); }
tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg); }
tbody tr.selected { background: var(--orange-subtle); }
tbody tr.urgent { border-left: 3px solid var(--error); }
tbody tr.precontentieux { border-left: 3px solid var(--error); }
td {
  padding: 12px 16px;
  color: var(--text);
  vertical-align: middle;
}
td.text-muted { color: var(--text-muted); }
.td-ref { font-size: 11px; font-weight: 700; color: var(--orange); font-family: 'Courier New', monospace; }
.td-title { font-weight: 500; }
.td-actions { display: flex; align-items: center; gap: 6px; }

/* ── FORMS ───────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
label, .label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.input, input[type="text"], input[type="email"],
input[type="password"], input[type="search"],
input[type="number"], input[type="date"], textarea, select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 400;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
  appearance: none;
}
.input:focus, input[type="text"]:focus, input[type="email"]:focus,
input[type="password"]:focus, input[type="search"]:focus,
input[type="number"]:focus, input[type="date"]:focus, textarea:focus, select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255,102,0,0.10);
}
textarea { resize: vertical; min-height: 80px; }
select { padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.input-error { border-color: var(--error) !important; box-shadow: 0 0 0 3px rgba(220,38,38,0.08) !important; }
.form-error { font-size: 11px; color: var(--error); margin-top: 4px; font-weight: 500; }

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--border); border-radius: 10px;
  transition: background var(--transition);
  cursor: pointer;
}
.toggle input:checked + .toggle-track { background: var(--orange); }
.toggle-track::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: white;
  left: 3px; top: 3px;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-track::before { transform: translateX(16px); }

/* Checkbox */
.checkbox-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.checkbox-wrap input[type="checkbox"] {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  appearance: none;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--white);
  flex-shrink: 0;
}
.checkbox-wrap input[type="checkbox"]:checked {
  background: var(--orange);
  border-color: var(--orange);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M10 3L5 8.5 2 5.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* Search input */
.search-input-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  height: 36px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.search-input-wrap:focus-within {
  border-color: var(--orange);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(255,102,0,0.08);
}
.search-input-wrap input {
  border: none; background: transparent;
  padding: 0; height: auto;
  font-size: 13px; box-shadow: none;
}
.search-input-wrap input:focus { box-shadow: none; }
.search-icon { color: var(--text-light); font-size: 14px; flex-shrink: 0; }

/* ── MODALS ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1000;
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: modal-in 0.2s ease;
}
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 900px; }
.modal-sm { max-width: 380px; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  flex-shrink: 0;
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--text); }
.modal-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-xs);
  border: none; background: transparent;
  cursor: pointer; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  flex-shrink: 0;
}

/* ── TOASTS ──────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  /* max-width: 360px; */
  font-size: 13px;
  pointer-events: all;
  animation: toast-in 0.25s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.toast-text { flex: 1; }
.toast-title { font-weight: 600; color: var(--text); }
.toast-body  { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--error); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info    { border-left: 3px solid var(--info); }

/* ── TABS ────────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  gap: 2px;
  overflow-x: auto;
}
.tab-item {
  padding: 10px 16px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
  border: none; background: transparent; font-family: inherit;
}
.tab-item:hover { color: var(--text); }
.tab-item.active { color: var(--orange); border-bottom-color: var(--orange); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── ALERTS / BANNERS ───────────────────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-content { flex: 1; }
.alert-title { font-weight: 600; margin-bottom: 2px; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #bbf7d0; }
.alert-error   { background: var(--error-light); color: var(--error); border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fde68a; }
.alert-info    { background: var(--info-light); color: var(--info); border: 1px solid #bfdbfe; }
.alert-orange  { background: var(--orange-light); color: var(--orange-dark); border: 1px solid rgba(255,102,0,0.3); }

/* ── PROGRESS BAR ───────────────────────────────────────────────────────────── */
.progress-wrap { width: 100%; height: 6px; background: var(--border-light); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 3px; transition: width 0.4s ease; background: var(--orange); }
.progress-bar.success { background: var(--success); }
.progress-bar.error   { background: var(--error); }
.progress-bar.info    { background: var(--info); }

/* ── CLEM COMPONENTS ─────────────────────────────────────────────────────────── */
.clem-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 700;
  background: linear-gradient(135deg, var(--orange-light), #fde68a);
  color: var(--orange-dark);
  border: 1px solid rgba(255,102,0,0.2);
}
.clem-confidence {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
}
.clem-confidence.high   { background: var(--success-light); color: var(--success); }
.clem-confidence.medium { background: var(--warning-light); color: var(--warning); }
.clem-confidence.low    { background: var(--error-light); color: var(--error); }

.clem-response-block {
  background: linear-gradient(135deg, #fffbf5 0%, #fff8f0 100%);
  border: 1px solid rgba(255,102,0,0.2);
  border-left: 4px solid var(--orange);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 18px;
  font-size: 13px; line-height: 1.65;
  color: var(--text);
  position: relative;
}
body.dark .clem-response-block {
  background: rgba(255,102,0,0.05);
}
.clem-response-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
  font-size: 12px; font-weight: 700;
  color: var(--orange);
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* ── EMPTY STATE ─────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.6; }
.empty-state-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state-body  { font-size: 13px; line-height: 1.6; }

/* ── LOADING SKELETON ───────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-xs);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── SPINNER ─────────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.spinner-sm { width: 14px; height: 14px; }
.spinner-lg { width: 26px; height: 26px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── DIVIDERS ─────────────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.divider-label {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 12px; font-weight: 500;
  margin: 20px 0;
}
.divider-label::before, .divider-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── GRID HELPERS ────────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px)  { .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px)  { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ── FLEX HELPERS ────────────────────────────────────────────────────────────── */
.flex          { display: flex; }
.flex-col      { display: flex; flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

/* ── SPACING ─────────────────────────────────────────────────────────────────── */
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-auto { margin-top: auto; }

/* ── TYPOGRAPHY HELPERS ──────────────────────────────────────────────────────── */
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.text-muted  { color: var(--text-muted); }
.text-light  { color: var(--text-light); }
.text-orange { color: var(--orange); }
.text-success{ color: var(--success); }
.text-error  { color: var(--error); }
.text-warning{ color: var(--warning); }
.font-bold   { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-center { text-align: center; }
.truncate    { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── NOTIFICATION / DROPDOWN PANELS ─────────────────────────────────────────── */
.notif-wrap { position: relative; }
.notif-panel {
  display: none;
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 320px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  overflow: hidden;
}
.notif-panel.open { display: block; }
.notif-panel-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.notif-panel-title { font-size: 13px; font-weight: 700; }
.notif-panel-action { font-size: 11px; color: var(--orange); cursor: pointer; font-weight: 600; background: none; border: none; font-family: inherit; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-light); cursor: pointer; transition: background var(--transition); }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }
.notif-item-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); flex-shrink: 0; margin-top: 5px; }
.notif-item-dot.urgent { background: var(--error); }
.notif-item-dot.read { background: var(--border); }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.notif-item-sub   { font-size: 11px; color: var(--text-muted); }

/* ── HIDE SIDEBAR-BOTTOM & NAV SETTINGS ──────────────────────────────────────── */
.sidebar-bottom { display: none !important; }
.nav-icon-btn[title="Paramètres"] { display: none !important; }

/* ── SETTINGS MODAL ──────────────────────────────────────────────────────────── */
.settings-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 9000; display: none; align-items: flex-start; justify-content: center;
  padding-top: 60px; overflow-y: auto;
}
.settings-modal-overlay.open { display: flex; }
.settings-modal {
  background: var(--white); border-radius: var(--radius); width: 100%; max-width: 700px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.22); animation: modal-in 0.2s ease;
  margin-bottom: 40px; overflow: hidden;
}
.settings-modal-header { padding: 24px 28px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.settings-modal-title { font-size: 22px; font-weight: 800; }
.settings-modal-close { background: none; border: none; cursor: pointer; font-size: 24px; color: var(--text-muted); }
.settings-tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--bg); }
.settings-tab { flex: 1; padding: 16px; text-align: center; font-weight: 600; cursor: pointer; border: none; background: transparent; color: var(--text-muted); }
.settings-tab.active { color: var(--orange); border-bottom: 2px solid var(--orange); background: var(--white); }
.settings-tab-content { padding: 24px 28px; display: none; }
.settings-tab-content.active { display: block; }
.settings-row { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border-light); }
.settings-row:last-child { border-bottom: none; }
.settings-label { flex: 1; }
.settings-label-name { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.settings-label-desc { font-size: 12px; color: var(--text-muted); }
.settings-value { width: 200px; text-align: right; }
.settings-input { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; width: 100%; }
.settings-input:focus { outline: none; border-color: var(--orange); }
.settings-checkbox { width: 48px; height: 28px; border-radius: 14px; border: 2px solid var(--border); background: var(--bg); cursor: pointer; position: relative; }
.settings-checkbox.checked { background: var(--success); border-color: var(--success); }
.settings-checkbox::after { content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: white; top: 2px; left: 2px; transition: all 0.15s; }
.settings-checkbox.checked::after { left: 24px; }
.settings-modal-footer { padding: 16px 28px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--bg); }

/* ── DARK MODE NAV ───────────────────────────────────────────────────────────── */
body.dark .nav         { background: var(--white); border-bottom-color: var(--border); }
body.dark .page-header { background: var(--white); border-bottom-color: var(--border); }
body.dark .card        { background: var(--white); border-color: var(--border); }
body.dark .table-wrap  { background: var(--white); border-color: var(--border); }
body.dark thead th     { background: var(--bg2); }
body.dark .modal       { background: var(--white); }
body.dark input, body.dark textarea, body.dark select { background: var(--bg2); color: var(--text); border-color: var(--border); }

.alerte-toggle{position:relative;display:inline-block;width:44px;height:24px;vertical-align:middle}
.alerte-toggle input{opacity:0;width:0;height:0;position:absolute}
.alerte-toggle-slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background:#d1d5db;border-radius:24px;transition:.25s}
.alerte-toggle input:checked~.alerte-toggle-slider{background:var(--orange,#ea580c)}
.alerte-toggle-slider:before{position:absolute;content:"";height:18px;width:18px;left:3px;bottom:3px;background:white;border-radius:50%;transition:.25s;box-shadow:0 1px 3px rgba(0,0,0,.2)}
.alerte-toggle input:checked~.alerte-toggle-slider:before{transform:translateX(20px)}
.alerte-type-row{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-radius:var(--radius-sm,6px);border:1px solid transparent;transition:.15s}
.alerte-type-row.active{border-color:#fed7aa;background:#fff7ed}
