/* ============================================================
   GovEvent Platform — Feuille de style principale
   Charte graphique : République du Bénin
   Version : 1.0.0
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================================
   TOKENS & VARIABLES
   ============================================================ */
:root {
  /* Palette Bénin */
  --vert:         #1A6B3C;
  --vert-hover:   #155c33;
  --vert-dark:    #0F3D22;
  --vert-light:   #e8f5ee;
  --vert-xlight:  #f2faf5;
  --jaune:        #C8960A;
  --jaune-hover:  #b08208;
  --jaune-light:  #fdf6e3;
  --rouge:        #C0392B;
  --rouge-hover:  #a93226;
  --rouge-light:  #fdf0ee;

  /* Surfaces */
  --bg:           #F7F9F7;
  --surface:      #ffffff;
  --surface-2:    #F0F4F0;
  --surface-3:    #EDF2F7;

  /* Texte */
  --txt:          #1A202C;
  --txt-2:        #4A5568;
  --txt-3:        #718096;
  --txt-4:        #A0AEC0;

  /* Bordures */
  --bord:         rgba(26,107,60,0.12);
  --bord-2:       rgba(26,107,60,0.22);
  --bord-3:       rgba(26,107,60,0.35);

  /* Sidebar */
  --sb-bg:        #0F3D22;
  --sb-hover:     rgba(255,255,255,0.06);
  --sb-active:    rgba(26,107,60,0.4);
  --sb-txt:       rgba(255,255,255,0.62);
  --sb-txt-act:   #FAFAFA;
  --sb-border:    rgba(255,255,255,0.08);

  /* Typographie */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* Rayons */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   20px;

  /* Ombres */
  --shadow-xs: 0 1px 2px rgba(26,107,60,0.06);
  --shadow-sm: 0 2px 6px rgba(26,107,60,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(26,107,60,0.1), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(26,107,60,0.12), 0 4px 8px rgba(0,0,0,0.08);

  /* Transitions */
  --tr-fast: 0.12s ease;
  --tr-base: 0.2s ease;
  --tr-slow: 0.35s ease;

  /* Sidebar width */
  --sb-w: 248px;
  --topbar-h: 58px;
}

/* ============================================================
   DARK MODE
   ============================================================ */
[data-theme="dark"] {
  --bg:           #0B1A12;
  --surface:      #132019;
  --surface-2:    #1A2E22;
  --surface-3:    #1e3629;

  --txt:          #E2E8F0;
  --txt-2:        #A0AEC0;
  --txt-3:        #718096;
  --txt-4:        #4A5568;

  --bord:         rgba(92,184,138,0.12);
  --bord-2:       rgba(92,184,138,0.2);
  --bord-3:       rgba(92,184,138,0.32);

  --sb-bg:        #080f0b;

  --vert-light:   #1a3326;
  --vert-xlight:  #142a1e;
  --jaune-light:  #2a1f00;
  --rouge-light:  #2a0f0c;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 14px;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--txt);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--tr-base), color var(--tr-base);
}

a { color: var(--vert); text-decoration: none; }
a:hover { color: var(--vert-hover); }

img { max-width: 100%; display: block; }

::selection { background: var(--vert-light); color: var(--vert-dark); }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bord-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--bord-3); }

/* ============================================================
   LAYOUT SHELL
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sb-w);
  min-width: var(--sb-w);
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow: hidden;
  transition: width var(--tr-slow);
}

/* Bande tricolore Bénin — signature identitaire */
.sidebar::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(
    to bottom,
    #1A6B3C  33.33%,
    #C8960A  33.33% 66.66%,
    #C0392B  66.66%
  );
  z-index: 2;
}

.sidebar-logo {
  padding: 18px 18px 14px 22px;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: rgba(200,150,10,0.18);
  border: 1px solid rgba(200,150,10,0.38);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.logo-title {
  font-family: var(--font-display);
  color: #FAFAFA;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
}

.logo-sub {
  color: rgba(255,255,255,0.38);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-top: 1px;
}

/* Organisations switcher */
.org-switcher {
  margin: 10px 14px 0;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--tr-fast);
}
.org-switcher:hover { background: rgba(255,255,255,0.09); }
.org-switcher-name { color: rgba(255,255,255,0.75); font-size: 12px; font-weight: 500; flex: 1; }
.org-switcher i { color: rgba(255,255,255,0.35); font-size: 14px; }

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: 10px 0;
  overflow-y: auto;
}

.nav-section {
  padding: 10px 18px 4px 22px;
  font-size: 9.5px;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.28);
  font-weight: 600;
  margin-top: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px 8px 22px;
  color: var(--sb-txt);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all var(--tr-fast);
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  position: relative;
  border-radius: 0 8px 8px 0;
  margin: 1px 10px 1px 0;
}

.nav-item:hover {
  color: rgba(255,255,255,0.88);
  background: var(--sb-hover);
  border-left-color: rgba(200,150,10,0.4);
}

.nav-item.active {
  color: var(--sb-txt-act);
  background: var(--sb-active);
  border-left-color: var(--jaune);
  font-weight: 500;
}

.nav-item i { font-size: 17px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--rouge);
  color: white;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
}

.nav-badge.warn {
  background: var(--jaune);
  color: #2a1f00;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--sb-border);
  flex-shrink: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--tr-fast);
}
.user-card:hover { background: var(--sb-hover); }

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(200,150,10,0.25);
  border: 1.5px solid rgba(200,150,10,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--jaune);
  flex-shrink: 0;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.user-name  { color: rgba(255,255,255,0.82); font-size: 12.5px; font-weight: 500; }
.user-role  { color: rgba(255,255,255,0.38); font-size: 10.5px; }

.user-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.user-action-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.3);
  cursor: pointer;
  transition: all var(--tr-fast);
  font-size: 14px;
}
.user-action-btn:hover { background: var(--sb-hover); color: rgba(255,255,255,0.7); }

/* ============================================================
   MAIN AREA
   ============================================================ */
.main-area {
  margin-left: var(--sb-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 0.5px solid var(--bord);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background var(--tr-base), border-color var(--tr-base);
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.breadcrumb-item {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--vert-dark);
}
[data-theme="dark"] .breadcrumb-item { color: #5cb88a; }

.breadcrumb-sep { color: var(--txt-4); font-size: 13px; }
.breadcrumb-sub { font-size: 12px; color: var(--txt-3); font-family: var(--font-body); font-weight: 400; }

.topbar-search {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-3);
  border: 0.5px solid var(--bord);
  border-radius: 8px;
  padding: 0 12px;
  height: 34px;
  width: 220px;
  transition: all var(--tr-fast);
}
.topbar-search:focus-within {
  border-color: var(--vert);
  box-shadow: 0 0 0 3px rgba(26,107,60,0.1);
  width: 280px;
}
.topbar-search i { color: var(--txt-4); font-size: 15px; }
.topbar-search input {
  border: none;
  background: transparent;
  font-size: 12.5px;
  font-family: var(--font-body);
  color: var(--txt);
  outline: none;
  width: 100%;
}
.topbar-search input::placeholder { color: var(--txt-4); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 0.5px solid var(--bord);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--txt-3);
  font-size: 17px;
  position: relative;
  transition: all var(--tr-fast);
}
.icon-btn:hover {
  background: var(--surface-3);
  color: var(--vert);
  border-color: var(--bord-2);
}

.notif-dot {
  position: absolute;
  top: 6px; right: 7px;
  width: 7px; height: 7px;
  background: var(--rouge);
  border-radius: 50%;
  border: 1.5px solid var(--surface);
}

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
  flex: 1;
  padding: 22px 24px;
  overflow-y: auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--txt);
  margin-bottom: 3px;
}

.page-desc {
  font-size: 12.5px;
  color: var(--txt-3);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 36px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  transition: all var(--tr-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn i { font-size: 16px; }

.btn-primary {
  background: var(--vert);
  color: #fff;
}
.btn-primary:hover { background: var(--vert-hover); color: #fff; }

.btn-secondary {
  background: var(--surface);
  color: var(--txt-2);
  border: 0.5px solid var(--bord-2);
}
.btn-secondary:hover { background: var(--surface-3); color: var(--txt); border-color: var(--bord-3); }

.btn-danger {
  background: var(--rouge);
  color: #fff;
}
.btn-danger:hover { background: var(--rouge-hover); }

.btn-warning {
  background: var(--jaune);
  color: #fff;
}
.btn-warning:hover { background: var(--jaune-hover); }

.btn-ghost {
  background: transparent;
  color: var(--txt-3);
  border: 0.5px solid var(--bord);
}
.btn-ghost:hover { background: var(--surface-3); color: var(--txt); }

.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn-lg { height: 42px; padding: 0 22px; font-size: 14px; }

.btn:disabled, .btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 0.5px solid var(--bord);
  border-radius: var(--r-lg);
  transition: background var(--tr-base), border-color var(--tr-base);
}

.card-padded { padding: 20px; }
.card-sm { padding: 14px 16px; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 0.5px solid var(--bord);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--txt);
}

.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 0.5px solid var(--bord);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* Stat Cards */
.stat-card {
  background: var(--surface);
  border: 0.5px solid var(--bord);
  border-radius: var(--r-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: all var(--tr-base);
}
.stat-card:hover { border-color: var(--bord-2); }

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.vert::after  { background: var(--vert); }
.stat-card.jaune::after { background: var(--jaune); }
.stat-card.rouge::after { background: var(--rouge); }
.stat-card.gris::after  { background: var(--txt-3); }

.stat-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--txt-3);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 500;
  color: var(--txt);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-value.sm { font-size: 22px; }

.stat-delta {
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.stat-delta.up   { color: var(--vert); }
.stat-delta.down { color: var(--rouge); }
.stat-delta.warn { color: var(--jaune); }

.stat-icon {
  position: absolute;
  top: 16px; right: 16px;
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}
.stat-icon.vert  { background: var(--vert-light); color: var(--vert); }
.stat-icon.jaune { background: var(--jaune-light); color: var(--jaune); }
.stat-icon.rouge { background: var(--rouge-light); color: var(--rouge); }
.stat-icon.gris  { background: var(--surface-3); color: var(--txt-3); }

/* ============================================================
   GRIDS
   ============================================================ */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-3-1 { display: grid; grid-template-columns: 3fr 1fr; gap: 16px; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-lg);
  border: 0.5px solid var(--bord);
  background: var(--surface);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  padding: 10px 16px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--txt-3);
  background: var(--surface-2);
  text-align: left;
  border-bottom: 0.5px solid var(--bord);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 16px;
  border-bottom: 0.5px solid var(--bord);
  color: var(--txt);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--vert-xlight); }
[data-theme="dark"] .data-table tbody tr:hover td { background: var(--vert-light); }

.data-table .cell-mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.data-table .cell-muted { color: var(--txt-3); font-size: 12px; }

/* Sortable headers */
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--vert); }

/* ============================================================
   BADGES & STATUS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge-vert   { background: var(--vert-light); color: var(--vert-dark); }
.badge-jaune  { background: var(--jaune-light); color: #7a5c00; }
.badge-rouge  { background: var(--rouge-light); color: #7b1e15; }
.badge-gris   { background: var(--surface-3); color: var(--txt-3); }
.badge-bleu   { background: #e8f0fd; color: #1565a7; }
.badge-violet { background: #f0eafd; color: #5c2d91; }

[data-theme="dark"] .badge-vert   { background: #1a3326; color: #5cb88a; }
[data-theme="dark"] .badge-jaune  { background: #2a1f00; color: #e8b455; }
[data-theme="dark"] .badge-rouge  { background: #2a0f0c; color: #e88080; }
[data-theme="dark"] .badge-gris   { background: #1e2a24; color: var(--txt-3); }
[data-theme="dark"] .badge-bleu   { background: #0c1f38; color: #4d9de0; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--txt-2);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-required { color: var(--rouge); margin-left: 2px; }

.form-control {
  width: 100%;
  height: 38px;
  border: 0.5px solid var(--bord-2);
  border-radius: var(--r-md);
  padding: 0 12px;
  font-size: 13px;
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--txt);
  outline: none;
  transition: all var(--tr-fast);
  -webkit-appearance: none;
}

.form-control:hover { border-color: var(--bord-3); }
.form-control:focus {
  border-color: var(--vert);
  box-shadow: 0 0 0 3px rgba(26,107,60,0.1);
}

.form-control.is-invalid {
  border-color: var(--rouge);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.1);
}

textarea.form-control {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  min-height: 90px;
}

select.form-control { cursor: pointer; padding-right: 30px; }

.form-control[disabled], .form-control:disabled {
  background: var(--surface-2);
  color: var(--txt-3);
  cursor: not-allowed;
  opacity: 0.7;
}

.form-hint {
  font-size: 11px;
  color: var(--txt-3);
  margin-top: 4px;
  line-height: 1.4;
}

.form-error {
  font-size: 11px;
  color: var(--rouge);
  margin-top: 4px;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* Input with icon */
.input-wrap { position: relative; }
.input-wrap .input-icon-left  { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--txt-4); font-size: 16px; pointer-events: none; }
.input-wrap .input-icon-right { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--txt-4); font-size: 16px; cursor: pointer; }
.input-wrap .form-control.has-icon-left { padding-left: 36px; }
.input-wrap .form-control.has-icon-right { padding-right: 36px; }

/* Toggle Switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 0.5px solid var(--bord);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--tr-fast);
  user-select: none;
}
.toggle-wrap:hover { border-color: var(--bord-2); }

.toggle-info { flex: 1; }
.toggle-title { font-size: 13px; font-weight: 400; color: var(--txt); }
.toggle-sub   { font-size: 11px; color: var(--txt-3); margin-top: 2px; }

.toggle-switch {
  width: 40px;
  height: 23px;
  background: var(--txt-4);
  border-radius: 12px;
  position: relative;
  transition: background var(--tr-base);
  flex-shrink: 0;
}
.toggle-switch.on { background: var(--vert); }
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 17px; height: 17px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: left var(--tr-base);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch.on::after { left: 20px; }

/* Checkbox */
.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.checkbox-wrap input[type="checkbox"] { display: none; }
.checkbox-box {
  width: 18px; height: 18px;
  border: 1.5px solid var(--bord-3);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--tr-fast);
  flex-shrink: 0;
}
.checkbox-wrap input:checked + .checkbox-box {
  background: var(--vert);
  border-color: var(--vert);
  color: #fff;
}
.checkbox-label { font-size: 13px; color: var(--txt); }

/* File Upload */
.file-upload {
  border: 1.5px dashed var(--bord-2);
  border-radius: var(--r-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--tr-base);
}
.file-upload:hover {
  border-color: var(--vert);
  background: var(--vert-xlight);
}
.file-upload i { font-size: 28px; color: var(--txt-4); margin-bottom: 8px; }
.file-upload p { font-size: 13px; color: var(--txt-3); }
.file-upload span { font-size: 11px; color: var(--txt-4); }

/* Search */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 0.5px solid var(--bord);
  border-radius: var(--r-md);
  padding: 0 12px;
  height: 36px;
  transition: all var(--tr-fast);
}
.search-box:focus-within {
  background: var(--surface);
  border-color: var(--vert);
  box-shadow: 0 0 0 3px rgba(26,107,60,0.1);
}
.search-box i { color: var(--txt-4); font-size: 15px; }
.search-box input {
  border: none;
  background: transparent;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--txt);
  outline: none;
  width: 100%;
}
.search-box input::placeholder { color: var(--txt-4); }

/* ============================================================
   ALERTS & BANNERS
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  margin-bottom: 16px;
}

.alert i { font-size: 17px; flex-shrink: 0; margin-top: 1px; }

.alert-vert  { background: var(--vert-light); border: 0.5px solid rgba(26,107,60,0.2); border-left: 3px solid var(--vert); border-radius: 0 var(--r-md) var(--r-md) 0; color: var(--vert-dark); }
.alert-jaune { background: var(--jaune-light); border: 0.5px solid rgba(200,150,10,0.2); border-left: 3px solid var(--jaune); border-radius: 0 var(--r-md) var(--r-md) 0; color: #7a5c00; }
.alert-rouge { background: var(--rouge-light); border: 0.5px solid rgba(192,57,43,0.2); border-left: 3px solid var(--rouge); border-radius: 0 var(--r-md) var(--r-md) 0; color: #7b1e15; }
.alert-bleu  { background: #e8f0fd; border: 0.5px solid rgba(21,101,167,0.2); border-left: 3px solid #1565a7; border-radius: 0 var(--r-md) var(--r-md) 0; color: #1565a7; }

[data-theme="dark"] .alert-vert  { background: #1a3326; color: #5cb88a; }
[data-theme="dark"] .alert-jaune { background: #2a1f00; color: #e8b455; }
[data-theme="dark"] .alert-rouge { background: #2a0f0c; color: #e88080; }
[data-theme="dark"] .alert-bleu  { background: #0c1f38; color: #4d9de0; }

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 0.5px solid var(--bord);
  border-radius: var(--r-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  pointer-events: all;
  animation: slideInRight var(--tr-base) ease;
  max-width: 340px;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.toast-success i { color: var(--vert); }
.toast-error   i { color: var(--rouge); }
.toast-warning i { color: var(--jaune); }
.toast-info    i { color: #1565a7; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,61,34,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.2s ease;
}

.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 0.5px solid var(--bord);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--txt); }
.modal-body  { padding: 20px 24px; }
.modal-footer {
  padding: 14px 24px;
  border-top: 0.5px solid var(--bord);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--surface-2);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

.modal-close {
  width: 30px; height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--txt-3);
  font-size: 18px;
  transition: all var(--tr-fast);
  border: none;
  background: transparent;
}
.modal-close:hover { background: var(--surface-3); color: var(--txt); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 20px;
  border-top: 0.5px solid var(--bord);
}

.page-btn {
  width: 32px; height: 32px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 400;
  cursor: pointer;
  border: 0.5px solid transparent;
  color: var(--txt-2);
  transition: all var(--tr-fast);
  font-family: var(--font-body);
  background: transparent;
}
.page-btn:hover { background: var(--surface-3); border-color: var(--bord); }
.page-btn.active { background: var(--vert); color: #fff; border-color: var(--vert); }
.page-btn.nav { color: var(--txt-3); }

.pagination-info { font-size: 12px; color: var(--txt-3); margin-left: auto; }

/* ============================================================
   TABS
   ============================================================ */
.tabs-bar {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--bord);
  margin-bottom: 20px;
}

.tab-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 400;
  color: var(--txt-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--tr-fast);
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab-item:hover { color: var(--vert); background: var(--vert-xlight); border-radius: 6px 6px 0 0; }
.tab-item.active { color: var(--vert); border-bottom-color: var(--vert); font-weight: 500; }
.tab-badge { background: var(--rouge); color: #fff; border-radius: 10px; padding: 0 5px; font-size: 10px; }

/* ============================================================
   AVATAR
   ============================================================ */
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--vert-light);
  color: var(--vert);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.avatar-xl { width: 72px; height: 72px; font-size: 22px; border-radius: 16px; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress {
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--vert);
  transition: width 0.5s ease;
}
.progress-bar.jaune { background: var(--jaune); }
.progress-bar.rouge { background: var(--rouge); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-state i { font-size: 44px; color: var(--txt-4); margin-bottom: 14px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--txt); margin-bottom: 6px; }
.empty-state p { font-size: 13px; color: var(--txt-3); margin-bottom: 18px; }

/* ============================================================
   DROPDOWN MENU
   ============================================================ */
.dropdown { position: relative; }

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 0.5px solid var(--bord);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  z-index: 300;
  overflow: hidden;
  animation: scaleIn 0.1s ease;
}

/* Variante pour les menus ancrés en bas d'écran (ex: menu utilisateur
   dans le pied de la sidebar) : s'ouvre vers le haut au lieu du bas,
   sinon il sort de la fenêtre et devient invisible/inatteignable. */
.dropdown-menu-up {
  top: auto;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--txt);
  cursor: pointer;
  transition: background var(--tr-fast);
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.danger { color: var(--rouge); }
.dropdown-item.danger:hover { background: var(--rouge-light); }
.dropdown-item i { font-size: 15px; color: var(--txt-3); }
.dropdown-divider { height: 0.5px; background: var(--bord); margin: 4px 0; }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 0.5px solid var(--bord);
  background: var(--surface-2);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  flex-wrap: wrap;
}

.filter-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border: 0.5px solid var(--bord-2);
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  background: var(--surface);
  color: var(--txt-2);
  transition: all var(--tr-fast);
  white-space: nowrap;
}
.filter-chip:hover { border-color: var(--vert); color: var(--vert); background: var(--vert-xlight); }
.filter-chip.active { border-color: var(--vert); color: var(--vert-dark); background: var(--vert-light); }

/* ============================================================
   QR CODE CARD
   ============================================================ */
.qr-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-2);
  border: 0.5px solid var(--bord);
  border-radius: var(--r-md);
  padding: 12px 16px;
}

.qr-box {
  width: 64px; height: 64px;
  background: white;
  border: 1px solid var(--bord-2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.qr-box i { font-size: 36px; color: var(--vert-dark); }

/* ============================================================
   STEPS INDICATOR
   ============================================================ */
.steps-indicator {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.step-circle {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  border: 1.5px solid var(--bord-2);
  color: var(--txt-3);
  flex-shrink: 0;
  transition: all var(--tr-base);
}
.step-item.active .step-circle { border-color: var(--vert); background: var(--vert); color: #fff; }
.step-item.done   .step-circle { border-color: var(--vert); background: var(--vert-light); color: var(--vert); }

.step-text  { font-size: 12px; color: var(--txt-3); }
.step-item.active .step-text { color: var(--vert); font-weight: 500; }
.step-item.done   .step-text { color: var(--vert); }

.step-connector {
  flex: 1;
  height: 1px;
  background: var(--bord-2);
  margin: 0 8px;
}

/* ============================================================
   SKELETON LOADING
   ============================================================ */
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% auto;
  animation: shimmer 1.5s linear infinite;
  border-radius: 6px;
}

.skel-text { height: 14px; margin-bottom: 8px; }
.skel-text.sm { height: 11px; width: 60%; }
.skel-title { height: 20px; width: 40%; margin-bottom: 12px; }
.skel-avatar { width: 38px; height: 38px; border-radius: 50%; }
.skel-card { height: 100px; border-radius: var(--r-lg); }
.skel-btn { height: 36px; width: 120px; border-radius: 8px; }

/* ============================================================
   PAYSLIP PREVIEW
   ============================================================ */
.payslip-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--vert);
}

.payslip-org-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--vert-dark);
}

.payslip-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 16px 0;
}

.payslip-table th {
  background: var(--vert-dark);
  color: #fff;
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.payslip-table td {
  padding: 8px 12px;
  border-bottom: 0.5px solid var(--bord);
}

.payslip-total {
  background: var(--vert);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

/* ============================================================
   CALENDAR
   ============================================================ */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all var(--tr-fast);
  color: var(--txt);
  position: relative;
}
.cal-day:hover { background: var(--vert-light); color: var(--vert); }
.cal-day.today { background: var(--vert); color: #fff; font-weight: 600; }
.cal-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--jaune);
}
.cal-day.other-month { color: var(--txt-4); }

/* ============================================================
   PRINT UTILITIES
   ============================================================ */
@media print {
  .sidebar, .topbar, .page-actions, .btn { display: none !important; }
  .main-area { margin-left: 0; }
  .page-content { padding: 0; }
  .card { border: 1px solid #ddd; box-shadow: none; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  :root { --sb-w: 0px; }
  .sidebar { transform: translateX(-248px); width: 248px; }
  .sidebar.open { transform: translateX(0); width: 248px; }
  .main-area { margin-left: 0; }
  .grid-2-1 { grid-template-columns: 1fr; }
  .grid-3-1 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}

@media (max-width: 640px) {
  .topbar-search { display: none; }
  .filter-bar { gap: 6px; }
}

/* ============================================================
   THEME TRANSITION
   ============================================================ */
body, .sidebar, .topbar, .card, .stat-card, .modal, .dropdown-menu,
.form-control, .badge, .alert, .table-wrap {
  transition:
    background-color var(--tr-base),
    border-color var(--tr-base),
    color var(--tr-base);
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-vert   { color: var(--vert); }
.text-jaune  { color: var(--jaune); }
.text-rouge  { color: var(--rouge); }
.text-muted  { color: var(--txt-3); }
.text-strong { font-weight: 600; }
.text-mono   { font-family: var(--font-mono); }
.text-display { font-family: var(--font-display); }

.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; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }

.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.divider {
  border: none;
  border-top: 0.5px solid var(--bord);
  margin: 16px 0;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rounded-full { border-radius: 9999px; }

.w-full { width: 100%; }

/* ============================================================
   NOTIFICATION CENTER
   ============================================================ */
.notif-panel {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  width: 360px;
  height: calc(100vh - var(--topbar-h));
  background: var(--surface);
  border-left: 0.5px solid var(--bord);
  z-index: 150;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform var(--tr-slow);
}
.notif-panel.open { transform: translateX(0); }

.notif-item {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--bord);
  cursor: pointer;
  transition: background var(--tr-fast);
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--vert-xlight); }
[data-theme="dark"] .notif-item.unread { background: #142a1e; }
.notif-dot-indicator {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--vert);
  margin-top: 4px;
  flex-shrink: 0;
}
