/* ============================================================
   DCB Courrier — Feuille de styles principale
   Couleurs: Orange #F47920 | Gris #808080 | Vert #4CAF50
   ============================================================ */

:root {
  --primary:       #F47920;
  --primary-dark:  #d4631a;
  --primary-light: #fff3eb;
  --secondary:     #808080;
  --success:       #4CAF50;
  --danger:        #dc3545;
  --warning:       #ffc107;
  --info:          #0dcaf0;
  --dark:          #1e2a3a;
  --sidebar-bg:    #1e2a3a;
  --sidebar-width: 260px;
  --topbar-h:      64px;
  --border:        #e8ecf0;
  --bg:            #f4f6fa;
  --white:         #ffffff;
  --text:          #2c3e50;
  --text-muted:    #8898aa;
  --radius:        10px;
  --shadow:        0 2px 12px rgba(0,0,0,.08);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.12);
  --font:          'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

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

/* ============================================================
   LAYOUT
   ============================================================ */

.app-wrapper { display: flex; min-height: 100vh; }

/* --- SIDEBAR --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  transition: transform .3s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-header img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  padding: 4px;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.brand-sub {
  font-size: 10px;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-user .avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-user .user-info .name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.sidebar-user .user-info .role {
  font-size: 11px;
  color: rgba(255,255,255,.5);
}

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.3);
  padding: 12px 18px 4px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: rgba(255,255,255,.7);
  font-size: 13px;
  transition: all .2s;
  border-left: 3px solid transparent;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
  border-left-color: rgba(244,121,32,.4);
}

.nav-item.active {
  background: rgba(244,121,32,.15);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}

.nav-item .icon { width: 20px; text-align: center; font-size: 15px; }
.nav-item .label { flex: 1; }
.nav-item .badge {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 700;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,.5);
  font-size: 13px;
  padding: 8px;
  border-radius: 6px;
  transition: all .2s;
}

.btn-logout:hover { background: rgba(220,53,69,.15); color: #ef9a9a; }

/* --- TOPBAR --- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.topbar-left .page-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.topbar-left .breadcrumb {
  font-size: 11px;
  color: var(--text-muted);
}

.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-action {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  position: relative;
  transition: background .2s;
  color: var(--text);
}

.topbar-action:hover { background: var(--primary-light); }

.notif-count {
  position: absolute;
  top: -2px; right: -2px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 10px;
  font-weight: 700;
  min-width: 16px;
  text-align: center;
}

/* --- CONTENT AREA --- */
.content-area {
  flex: 1;
  padding: 28px;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */

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

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-header h1 i { color: var(--primary); }

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  overflow: hidden;
}

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

.card-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 20px; }
.card-body.p-0 { padding: 0; }

/* ============================================================
   STAT CARDS
   ============================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stats-grid-6 { grid-template-columns: repeat(6, 1fr); }

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border-left: 4px solid var(--primary);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: .06;
  background: currentColor;
}

.stat-card-primary { border-color: var(--primary); color: var(--primary); }
.stat-card-success  { border-color: var(--success); color: var(--success); }
.stat-card-warning  { border-color: var(--warning); color: var(--warning); }
.stat-card-danger   { border-color: var(--danger);  color: var(--danger);  }
.stat-card-info     { border-color: var(--info);    color: var(--info);    }
.stat-card-secondary{ border-color: var(--secondary); color: var(--secondary); }

.stat-card-icon { font-size: 24px; margin-bottom: 10px; }
.stat-card-value { font-size: 32px; font-weight: 800; color: var(--dark); }
.stat-card-label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

/* Mini stats */
.stats-mini {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.stat-mini-card {
  background: var(--white);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 160px;
}

.stat-mini-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
}

.bg-primary   { background: var(--primary); }
.bg-success   { background: var(--success); }
.bg-warning   { background: var(--warning); }
.bg-danger    { background: var(--danger);  }
.bg-info      { background: var(--info);    }
.bg-secondary { background: var(--secondary); }

.stat-mini-value { font-size: 22px; font-weight: 800; color: var(--dark); }
.stat-mini-label { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   BOUTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all .2s;
  white-space: nowrap;
}

.btn-primary   { background: var(--primary);   color: #fff; }
.btn-primary:hover   { background: var(--primary-dark); color: #fff; }
.btn-success   { background: var(--success);   color: #fff; }
.btn-success:hover   { background: #43a047; color: #fff; }
.btn-danger    { background: var(--danger);    color: #fff; }
.btn-danger:hover    { background: #c62828; color: #fff; }
.btn-warning   { background: var(--warning);   color: #000; }
.btn-warning:hover   { background: #e6ac00; color: #000; }
.btn-info      { background: var(--info);      color: #000; }
.btn-secondary { background: #6c757d;          color: #fff; }
.btn-secondary:hover { background: #5a6268; color: #fff; }
.btn-light     { background: #f8f9fa;          color: var(--text); border: 1px solid var(--border); }
.btn-dark      { background: var(--dark);      color: #fff; }
.btn-outline   { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }

.btn-sm  { padding: 5px 10px; font-size: 12px; }
.btn-lg  { padding: 12px 24px; font-size: 15px; }
.btn-xl  { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }

.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   FORMULAIRES
   ============================================================ */

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
  font-family: var(--font);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(244,121,32,.1);
}

.form-control:disabled { background: #f8f9fa; cursor: not-allowed; }

textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; padding-right: 32px; }

.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.required   { color: var(--danger); }

.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; }

.input-password-wrap { position: relative; }
.input-password-wrap .form-control { padding-right: 40px; }
.toggle-password {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
}

/* ============================================================
   TABLEAUX
   ============================================================ */

.table-responsive { overflow-x: auto; }

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

.table th {
  background: #f8f9fb;
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table-hover tr:hover td { background: #fafbff; }

.row-retard td { background: #fff5f5 !important; }
.row-retard:hover td { background: #ffe8e8 !important; }

/* ============================================================
   BADGES
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-primary   { background: var(--primary-light); color: var(--primary); }
.badge-success   { background: #e8f5e9; color: #2e7d32; }
.badge-danger    { background: #fdecea; color: #c62828; }
.badge-warning   { background: #fff8e1; color: #f57f17; }
.badge-info      { background: #e3f9fd; color: #006064; }
.badge-secondary { background: #f0f0f0; color: #555; }
.badge-dark      { background: #263238; color: #fff; }

/* Priorités */
.badge-priorite.badge-urgent { background: #fdecea; color: #b71c1c; border: 1px solid #ef9a9a; }
.badge-priorite.badge-eleve  { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.badge-priorite.badge-moyen  { background: #e8eaf6; color: #283593; border: 1px solid #9fa8da; }
.badge-priorite.badge-bas    { background: #f5f5f5; color: #424242; border: 1px solid #bdbdbd; }

/* Étapes */
.badge-statut.badge-en_attente  { background: #fff8e1; color: #f57f17; }
.badge-statut.badge-en_cours    { background: #e3f2fd; color: #1565c0; }
.badge-statut.badge-insuffisant { background: #fce4ec; color: #880e4f; }
.badge-statut.badge-archive     { background: #e8f5e9; color: #2e7d32; }

/* ============================================================
   ALERTES
   ============================================================ */

.alert {
  padding: 12px 18px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-left: 4px solid;
}

.alert i { flex-shrink: 0; margin-top: 1px; }
.alert ul { margin: 8px 0 0 16px; }

.alert-success { background: #f0fdf4; border-color: var(--success); color: #166534; }
.alert-danger  { background: #fef2f2; border-color: var(--danger);  color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: var(--warning); color: #92400e; }
.alert-info    { background: #eff6ff; border-color: var(--info);    color: #1e40af; }

/* ============================================================
   FILTRES
   ============================================================ */

.filter-bar { margin-bottom: 20px; }

.filter-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-group { flex: 1; min-width: 150px; max-width: 250px; }
.filter-group .form-control { margin: 0; }

.filter-form-grid .filter-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.filter-group.flex-2 { flex: 2; }
.filter-group.filter-actions { display: flex; align-items: flex-end; }

/* ============================================================
   DOSSIER NUMÉRO & COUNTDOWN
   ============================================================ */

.dossier-numero {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: monospace;
  font-size: 13px;
}

.dossier-objet {
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.retard-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 1.4s infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .5; transform: scale(1.3); }
}

.countdown { font-size: 12px; font-weight: 600; }
.countdown-retard { color: var(--danger); }
.retard-text { color: var(--danger); }

/* ============================================================
   TIMELINE (historique dossier)
   ============================================================ */

.timeline { position: relative; padding-left: 30px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 10px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 24px;
}

.timeline-dot {
  position: absolute;
  left: -26px; top: 4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--primary);
}

.timeline-dot.dot-success  { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.timeline-dot.dot-danger   { background: var(--danger);  box-shadow: 0 0 0 2px var(--danger);  }
.timeline-dot.dot-warning  { background: var(--warning); box-shadow: 0 0 0 2px var(--warning); }
.timeline-dot.dot-info     { background: var(--info);    box-shadow: 0 0 0 2px var(--info);    }

.timeline-content {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline-user { font-weight: 700; font-size: 13px; }
.timeline-date { font-size: 11px; color: var(--text-muted); }
.timeline-action { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.timeline-obs { font-size: 13px; color: var(--text); background: #fff; border-radius: 6px; padding: 8px 12px; border-left: 3px solid var(--primary); margin-top: 8px; }

/* ============================================================
   NOTIFICATIONS PANEL
   ============================================================ */

.notif-panel {
  position: absolute;
  top: calc(100% + 8px); right: -10px;
  width: 340px;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: none;
  z-index: 9999;
  max-height: 500px;
  overflow: hidden;
  flex-direction: column;
}

.notif-panel.open { display: flex; }

.notif-panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notif-panel-header h5 { font-size: 14px; font-weight: 700; }

#notifList { overflow-y: auto; max-height: 340px; }

.notif-dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid #f5f5f5;
  transition: background .15s;
}

.notif-dropdown-item:hover { background: #fafbff; }
.notif-dropdown-item.unread { background: var(--primary-light); }

.notif-d-icon { width: 32px; flex-shrink: 0; text-align: center; font-size: 16px; padding-top: 2px; }
.notif-d-msg  { font-size: 12px; font-weight: 500; line-height: 1.4; color: var(--text); }
.notif-d-ref  { font-size: 11px; color: var(--primary); margin-top: 2px; }
.notif-d-time { font-size: 10px; color: var(--text-muted); margin-top: 3px; }
.notif-d-link { color: var(--primary); font-size: 14px; padding: 4px; flex-shrink: 0; }
.notif-empty  { text-align: center; padding: 30px; color: var(--text-muted); }

/* Notifications page */
.notif-filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.notif-tab {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
}

.notif-tab:hover { color: var(--primary); }
.notif-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.notif-list { }
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.notif-item:hover { background: #fafbff; }
.notif-item.notif-unread { background: var(--primary-light); }
.notif-icon { width: 36px; height: 36px; border-radius: 50%; background: #f0f0f0; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.notif-body { flex: 1; }
.notif-message { font-size: 13px; font-weight: 600; }
.notif-dossier { font-size: 12px; color: var(--primary); margin-top: 3px; }
.notif-from    { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.notif-time    { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.notif-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ============================================================
   UPLOAD ZONE
   ============================================================ */

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: #fafbfc;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-zone input[type=file] { display: none; }
.upload-zone .upload-icon { font-size: 32px; color: var(--text-muted); margin-bottom: 10px; }
.upload-zone p { font-size: 13px; color: var(--text-muted); }
.upload-zone .upload-hint { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

.upload-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f0fdf4;
  border-radius: 8px;
  border: 1px solid #86efac;
  margin-top: 10px;
}

.upload-preview .file-name { font-size: 13px; font-weight: 600; flex: 1; }
.upload-preview .file-size { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   PAGINATION
   ============================================================ */

.pagination-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.pagination { display: flex; gap: 4px; }

.page-btn {
  width: 32px; height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--border);
  transition: all .15s;
}

.page-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============================================================
   ONGLETS (tabs)
   ============================================================ */

.tabs { border-bottom: 2px solid var(--border); margin-bottom: 20px; display: flex; gap: 0; }
.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ============================================================
   MODALS
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(.96) translateY(10px);
  transition: transform .2s;
}

.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-header h4 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); padding: 4px 8px; border-radius: 4px; }
.modal-close:hover { background: var(--bg); color: var(--danger); }
.modal-body   { padding: 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ============================================================
   DIVERS
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i { margin-bottom: 16px; color: #d0d5dd; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text); }
.empty-state p  { font-size: 13px; }

.empty-state-sm { text-align: center; padding: 30px; color: var(--text-muted); font-size: 13px; }

.two-col-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.profil-layout  { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }

.action-buttons { display: flex; gap: 6px; flex-wrap: wrap; }

/* Profil */
.avatar-large {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.avatar-sm {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profil-nom     { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.profil-role    { margin-bottom: 10px; }
.profil-service,
.profil-email,
.profil-tel     { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }

.profil-stats { display: flex; justify-content: center; gap: 20px; }
.profil-stat-value { font-size: 24px; font-weight: 800; color: var(--primary); }
.profil-stat-label { font-size: 11px; color: var(--text-muted); }

.user-cell { display: flex; align-items: center; gap: 10px; }

/* Intérimaire actif */
.interimaire-actif {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Info items */
.info-item { margin-bottom: 8px; }
.info-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.info-value { font-size: 14px; font-weight: 600; }

/* Params */
.params-tabs { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 20px; }
.params-tab-nav { display: flex; border-bottom: 1px solid var(--border); background: #fafbfc; padding: 0 8px; }
.params-tab-btn {
  padding: 14px 18px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .2s;
}
.params-tab-btn:hover { color: var(--primary); }
.params-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.params-tab-content { display: none; padding: 20px; }
.params-tab-content.active { display: block; }
.params-footer { text-align: right; margin-top: 8px; }
.params-info-box { background: var(--primary-light); border-radius: 8px; padding: 12px 16px; display: flex; gap: 10px; align-items: center; font-size: 13px; margin-top: 12px; }

/* Étape bars stats */
.charts-row { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 20px; }
.chart-card-lg { margin-bottom: 0; }
.chart-card-sm { margin-bottom: 0; }
.chart-legend { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-danger { background: #dc3545; }
.dot-warning { background: #ffc107; }
.dot-info   { background: #0dcaf0; }
.dot-secondary { background: #6c757d; }

.etape-bars { display: flex; flex-direction: column; gap: 10px; }
.etape-bar-row { display: flex; align-items: center; gap: 8px; }
.etape-bar-label { font-size: 11px; width: 120px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.etape-bar-track { flex: 1; height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; }
.etape-bar-fill  { height: 100%; background: var(--primary); border-radius: 4px; transition: width .4s; }
.etape-bar-value { width: 28px; text-align: right; font-size: 12px; font-weight: 700; color: var(--text-muted); }

/* Activity list */
.activity-list {}
.activity-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.activity-icon { width: 32px; text-align: center; flex-shrink: 0; font-size: 16px; }
.activity-content { flex: 1; }
.activity-text { font-size: 13px; }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Password strength */
.password-strength { font-size: 11px; margin-top: 4px; font-weight: 600; }

/* Role badges */
.badge-role { font-size: 11px; }
.badge-role-admin           { background: #7c3aed20; color: #7c3aed; }
.badge-role-directeur       { background: #1565c020; color: #1565c0; }
.badge-role-assistante      { background: #e91e6320; color: #c2185b; }
.badge-role-sous_directeur  { background: #00838f20; color: #00838f; }
.badge-role-chef_service    { background: #f57c0020; color: #e65100; }
.badge-role-charge_etudes   { background: #43a04720; color: #2e7d32; }
.badge-role-service_courrier{ background: #01579b20; color: #01579b; }
.badge-role-epn             { background: #80808020; color: #555; }

/* Inline form */
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form .form-control { margin: 0; width: auto; }

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e2a3a 0%, #2d3d54 50%, #1a2332 100%);
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
}

.login-card-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 36px;
  text-align: center;
  color: #fff;
}

.login-card-header img {
  width: 80px; height: 80px;
  object-fit: contain;
  background: rgba(255,255,255,.15);
  padding: 12px;
  border-radius: 16px;
  margin-bottom: 14px;
}

.login-card-header h1 { font-size: 22px; margin-bottom: 4px; }
.login-card-header p  { font-size: 13px; opacity: .85; }

.login-card-body { padding: 32px; }

/* Fiche imprimable */
@media print {
  .sidebar, .topbar, .filter-bar, .btn, .action-buttons,
  .page-header .page-header-right { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .content-area { padding: 0 !important; }
  .fiche-print { display: block !important; }
}

.fiche-print { font-size: 12px; }
.fiche-entete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 2px solid var(--primary); padding-bottom: 12px; }
.fiche-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.fiche-table th, .fiche-table td { border: 1px solid #ccc; padding: 6px 10px; font-size: 11px; }
.fiche-table th { background: #f5f5f5; font-weight: 700; }

/* Toasts */
.toast-container { position: fixed; top: 80px; right: 20px; z-index: 99999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  animation: slideInRight .3s ease;
}
.toast-success { background: var(--success); color: #fff; }
.toast-error   { background: var(--danger);  color: #fff; }
.toast-warning { background: var(--warning); color: #000; }
.toast-info    { background: var(--info);    color: #000; }

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

/* mt / mb */
.mt-4 { margin-top: 16px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.ms-1 { margin-left: 4px; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-right  { text-align: right; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1200px) {
  .stats-grid-6 { grid-template-columns: repeat(3, 1fr); }
  .charts-row   { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  #sidebarToggle { display: flex !important; }
  .two-col-layout,
  .profil-layout { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .content-area { padding: 16px; }
  .stats-grid-6 { grid-template-columns: repeat(2, 1fr); }
  .form-grid-2,
  .form-grid-3  { grid-template-columns: 1fr; }
  .filter-form  { flex-direction: column; }
  .filter-group { max-width: 100%; }
}
