/* ============================================================
   THABIT ENGINEERING — FEUILLE DE STYLE PRINCIPALE
   Tailwind CDN + Variables CSS + Composants custom
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;500;600;700;800&family=Source+Sans+3:wght@300;400;500;600;700&display=swap');

/* ── Variables CSS THABIT ── */
:root {
  --t-navy:       #1B2E5E;
  --t-navy-dark:  #111E3F;
  --t-navy-light: #243772;
  --t-blue:       #2563EB;
  --t-blue-light: #3B82F6;
  --t-blue-pale:  #EFF6FF;
  --t-white:      #FFFFFF;
  --t-bg:         #F1F5F9;
  --t-bg-card:    #FFFFFF;
  --t-border:     #E2E8F0;
  --t-muted:      #64748B;
  --t-text:       #1E293B;
  --t-success:    #16A34A;
  --t-success-bg: #F0FDF4;
  --t-danger:     #DC2626;
  --t-danger-bg:  #FEF2F2;
  --t-warning:    #D97706;
  --t-warning-bg: #FFFBEB;
  --t-info:       #0891B2;
  --t-info-bg:    #ECFEFF;

  --sidebar-w:    260px;
  --header-h:     64px;
  --radius:       6px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:    0 4px 12px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.06);
  --shadow-lg:    0 10px 30px rgba(0,0,0,.12);
  --transition:   all .18s cubic-bezier(.4,0,.2,1);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Source Sans 3', sans-serif;
  background: var(--t-bg);
  color: var(--t-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--t-navy);
}

a { color: var(--t-blue); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--t-navy); }

/* ============================================================
   LAYOUT — SIDEBAR + MAIN
   ============================================================ */

.layout-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--t-navy-dark);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}

.sidebar-logo {
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.sidebar-logo img {
  width: 160px;
  height: auto;
  display: block;
  filter: brightness(0) invert(1);
}

.sidebar-logo-text,
.sidebar-logo-sub { display: none; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.sidebar-section {
  padding: 12px 16px 4px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  margin: 1px 8px;
  border-radius: var(--radius);
  color: rgba(255,255,255,.65);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  position: relative;
}

.sidebar-item:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
}

.sidebar-item.active {
  background: var(--t-blue);
  color: #fff;
  font-weight: 600;
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: #fff;
  border-radius: 0 2px 2px 0;
}

.sidebar-item svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: .8;
}

.sidebar-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.05);
}

.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--t-blue);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
  height: var(--header-h);
  background: var(--t-bg-card);
  border-bottom: 1px solid var(--t-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--t-navy);
  flex: 1;
}

.topbar-breadcrumb {
  font-size: 12px;
  color: var(--t-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-breadcrumb span { color: var(--t-muted); }
.topbar-breadcrumb strong { color: var(--t-navy); font-weight: 600; }

.page-body {
  flex: 1;
  padding: 24px;
}

/* ── Hamburger mobile ── */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--t-navy);
}

/* ============================================================
   COMPOSANTS — CARDS
   ============================================================ */

.card {
  background: var(--t-bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--t-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--t-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--t-navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 20px; }

.card-footer {
  padding: 12px 20px;
  background: var(--t-bg);
  border-top: 1px solid var(--t-border);
}

/* KPI Cards */
.kpi-card {
  background: var(--t-bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--t-border);
  border-left: 4px solid var(--accent, var(--t-blue));
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kpi-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius);
  background: var(--accent-bg, var(--t-blue-pale));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.kpi-icon svg { width: 22px; height: 22px; color: var(--accent, var(--t-blue)); }

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--t-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 2px;
}

.kpi-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--t-navy);
  line-height: 1;
}

.kpi-sub {
  font-size: 12px;
  color: var(--t-muted);
  margin-top: 2px;
}

/* ============================================================
   COMPOSANTS — BOUTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
  background: var(--t-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.btn-primary:hover { background: var(--t-navy); color: #fff; box-shadow: 0 4px 12px rgba(27,46,94,.35); }

.btn-navy {
  background: var(--t-navy);
  color: #fff;
}
.btn-navy:hover { background: var(--t-navy-dark); color: #fff; }

.btn-outline {
  background: transparent;
  color: var(--t-navy);
  border: 1.5px solid var(--t-border);
}
.btn-outline:hover { border-color: var(--t-navy); background: var(--t-navy); color: #fff; }

.btn-success { background: var(--t-success); color: #fff; }
.btn-success:hover { background: #15803D; color: #fff; }

.btn-danger { background: var(--t-danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; color: #fff; }

.btn-warning { background: var(--t-warning); color: #fff; }
.btn-warning:hover { background: #B45309; color: #fff; }

.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-icon { padding: 8px; }

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================================
   COMPOSANTS — FORMULAIRES
   ============================================================ */

.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--t-text);
  margin-bottom: 6px;
  letter-spacing: .2px;
}

.form-label .required {
  color: var(--t-danger);
  margin-left: 3px;
}

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--t-border);
  border-radius: var(--radius);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 14px;
  color: var(--t-text);
  background: #fff;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--t-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.form-control::placeholder { color: #CBD5E1; }

.form-control.is-invalid { border-color: var(--t-danger); }
.form-control.is-valid   { border-color: var(--t-success); }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748B'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 36px;
}

.form-hint {
  font-size: 12px;
  color: var(--t-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 12px;
  color: var(--t-danger);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* ============================================================
   COMPOSANTS — TABLEAUX
   ============================================================ */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--t-border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table thead th {
  background: var(--t-navy);
  color: rgba(255,255,255,.9);
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 11px 14px;
  text-align: left;
  white-space: nowrap;
  border: none;
}

.table thead th:first-child { border-radius: 6px 0 0 0; }
.table thead th:last-child  { border-radius: 0 6px 0 0; }

.table tbody tr {
  border-bottom: 1px solid var(--t-border);
  transition: background .12s;
}

.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: #F8FAFC; }

.table tbody td {
  padding: 10px 14px;
  color: var(--t-text);
  vertical-align: middle;
}

.table tbody tr:nth-child(even) { background: #FAFBFC; }
.table tbody tr:nth-child(even):hover { background: #F1F5F9; }

/* ============================================================
   COMPOSANTS — BADGES & STATUTS
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .3px;
  white-space: nowrap;
}

.badge-success  { background: var(--t-success-bg); color: var(--t-success); }
.badge-danger   { background: var(--t-danger-bg);  color: var(--t-danger); }
.badge-warning  { background: var(--t-warning-bg); color: var(--t-warning); }
.badge-info     { background: var(--t-info-bg);    color: var(--t-info); }
.badge-navy     { background: rgba(27,46,94,.1);   color: var(--t-navy); }
.badge-muted    { background: #F1F5F9;             color: var(--t-muted); }

.badge-dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ============================================================
   COMPOSANTS — ALERTES
   ============================================================ */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  border-left: 4px solid;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  margin-bottom: 16px;
}

.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.alert-success { background: var(--t-success-bg); border-color: var(--t-success); color: #14532D; }
.alert-danger  { background: var(--t-danger-bg);  border-color: var(--t-danger);  color: #7F1D1D; }
.alert-warning { background: var(--t-warning-bg); border-color: var(--t-warning); color: #78350F; }
.alert-info    { background: var(--t-info-bg);    border-color: var(--t-info);    color: #164E63; }

/* ============================================================
   COMPOSANTS — MODALS
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .15s ease;
}

.modal {
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .2s cubic-bezier(.34,1.56,.64,1);
}

.modal-lg { max-width: 720px; }
.modal-sm { max-width: 400px; }

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--t-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--t-navy);
}

.modal-body    { padding: 22px; }
.modal-footer  {
  padding: 14px 22px;
  border-top: 1px solid var(--t-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--t-muted);
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
  display: flex;
  align-items: center;
}
.btn-close:hover { background: var(--t-danger-bg); color: var(--t-danger); }

/* ============================================================
   COMPOSANTS — PAGINATION
   ============================================================ */

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--t-border);
  background: #fff;
  color: var(--t-text);
  transition: var(--transition);
  text-decoration: none;
  padding: 0 10px;
}

.page-btn:hover { border-color: var(--t-blue); color: var(--t-blue); }
.page-btn.active { background: var(--t-navy); border-color: var(--t-navy); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ============================================================
   COMPOSANTS — TOGGLES
   ============================================================ */

.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle {
  position: relative;
  width: 42px; height: 24px;
  background: var(--t-border);
  border-radius: 12px;
  transition: background .2s;
  flex-shrink: 0;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .2s;
}

input:checked + .toggle {
  background: var(--t-success);
}
input:checked + .toggle::after {
  transform: translateX(18px);
}

.toggle-label {
  font-size: 14px;
  font-weight: 500;
}

/* ============================================================
   COMPOSANTS — FILTRES / SEARCH BAR
   ============================================================ */

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input-wrap svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--t-muted);
  pointer-events: none;
}

.search-input-wrap input {
  padding-left: 36px;
}

/* ============================================================
   PAGE SCAN QR — STYLES DÉDIÉS
   ============================================================ */

.scan-page {
  min-height: 100vh;
  background: var(--t-navy-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.scan-logo {
  margin-bottom: 28px;
  text-align: center;
}

.scan-logo img {
  width: 180px;
  height: auto;
  display: block;
  margin: 0 auto;
  filter: brightness(0) invert(1);
}

.scan-card {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 32px 28px;
  width: 100%;
  max-width: 400px;
  backdrop-filter: blur(10px);
  text-align: center;
}

.scan-viewfinder {
  position: relative;
  width: 240px; height: 240px;
  margin: 0 auto 24px;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 3px rgba(255,255,255,.1);
}

.scan-viewfinder video {
  width: 100%; height: 100%;
  object-fit: cover;
}

/* Coins du viseur */
.scan-viewfinder::before,
.scan-viewfinder::after {
  content: '';
  position: absolute;
  width: 24px; height: 24px;
  border-color: var(--t-blue-light);
  border-style: solid;
  z-index: 2;
}
.scan-viewfinder::before {
  top: 10px; left: 10px;
  border-width: 3px 0 0 3px;
  border-radius: 4px 0 0 0;
}
.scan-viewfinder::after {
  bottom: 10px; right: 10px;
  border-width: 0 3px 3px 0;
  border-radius: 0 0 4px 0;
}

.scan-line {
  position: absolute;
  left: 12px; right: 12px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--t-blue-light), transparent);
  animation: scanMove 2s linear infinite;
  z-index: 3;
}

@keyframes scanMove {
  0%   { top: 12px; }
  50%  { top: calc(100% - 14px); }
  100% { top: 12px; }
}

.scan-status {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
}

.scan-status.scanning {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.7);
}

.scan-status.success {
  background: rgba(22,163,74,.15);
  color: #4ADE80;
  border: 1px solid rgba(22,163,74,.3);
  animation: pulseSuccess .6s ease;
}

.scan-status.error {
  background: rgba(220,38,38,.15);
  color: #FCA5A5;
  border: 1px solid rgba(220,38,38,.3);
}

.scan-status.warning {
  background: rgba(217,119,6,.15);
  color: #FCD34D;
  border: 1px solid rgba(217,119,6,.3);
}

@keyframes pulseSuccess {
  0%  { transform: scale(1); }
  40% { transform: scale(1.02); }
  100%{ transform: scale(1); }
}

.scan-agent-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}

.scan-agent-type {
  font-size: 13px;
  color: rgba(255,255,255,.5);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.scan-time {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  color: var(--t-blue-light);
  font-weight: 600;
}

/* ============================================================
   PAGE LOGIN
   ============================================================ */

.login-page {
  min-height: 100vh;
  background: var(--t-navy-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

/* Grille de fond */
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(37,99,235,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37,99,235,.07) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo img {
  width: 200px;
  height: auto;
  margin-bottom: 12px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.login-logo h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--t-navy);
  margin: 0 0 4px;
}

.login-logo p {
  font-size: 13px;
  color: var(--t-muted);
}

/* ============================================================
   ANIMATIONS GLOBALES
   ============================================================ */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-fade-in    { animation: fadeIn .3s ease forwards; }
.animate-slide-up   { animation: fadeInUp .35s ease forwards; }

.stagger-1 { animation-delay: .05s; }
.stagger-2 { animation-delay: .10s; }
.stagger-3 { animation-delay: .15s; }
.stagger-4 { animation-delay: .20s; }
.stagger-5 { animation-delay: .25s; }

.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.spinner-dark {
  border-color: rgba(27,46,94,.2);
  border-top-color: var(--t-navy);
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */

#toast-container {
  position: fixed;
  top: 80px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 280px;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  pointer-events: all;
  animation: slideInRight .25s cubic-bezier(.34,1.56,.64,1);
}

.toast svg { width: 18px; height: 18px; flex-shrink: 0; }

.toast-success { background: var(--t-success); color: #fff; }
.toast-error   { background: var(--t-danger);  color: #fff; }
.toast-warning { background: var(--t-warning); color: #fff; }
.toast-info    { background: var(--t-navy);    color: #fff; }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   RESPONSIVE MOBILE
   ============================================================ */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 99;
  }

  .sidebar-overlay.open { display: block; }

  .main-content { margin-left: 0; }

  .sidebar-toggle { display: flex; }

  .form-grid-2,
  .form-grid-3 { grid-template-columns: 1fr; }

  .filter-bar { flex-direction: column; align-items: stretch; }

  .page-body { padding: 16px; }
}

@media (max-width: 480px) {
  .scan-viewfinder { width: 200px; height: 200px; }
  .login-card { padding: 28px 22px; }
  .kpi-card { flex-direction: column; text-align: center; }
}

/* ============================================================
   UTILITAIRES
   ============================================================ */

.text-navy   { color: var(--t-navy); }
.text-muted  { color: var(--t-muted); }
.text-success{ color: var(--t-success); }
.text-danger { color: var(--t-danger); }
.text-warning{ color: var(--t-warning); }
.text-blue   { color: var(--t-blue); }

.bg-navy     { background: var(--t-navy); }
.bg-light    { background: var(--t-bg); }

.fw-display  { font-family: 'Barlow Condensed', sans-serif; }

.divider {
  border: none;
  border-top: 1px solid var(--t-border);
  margin: 20px 0;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--t-muted);
}

.empty-state svg { width: 48px; height: 48px; margin: 0 auto 12px; opacity: .4; }
.empty-state h3  { font-size: 16px; color: var(--t-text); margin-bottom: 6px; }
.empty-state p   { font-size: 13px; }

.section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--t-navy);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--t-border);
}

/* Masquer les checkbox natifs des toggles */
.toggle-wrap input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}