/* ============================================================
   PointageRH Pro — Complete Stylesheet
   Stack: Custom CSS + FontAwesome 6.4
   Author: PointageRH Pro v2.0
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --sidebar-w: 260px;
  --topbar-h: 64px;

  --bg: #f0f2f7;
  --surface: #ffffff;
  --surface2: #f8f9fc;
  --border: #e4e8f0;
  --text: #1a1f36;
  --text2: #6b7a99;
  --text3: #a0aec0;

  --primary: #3b5bdb;
  --primary-light: #e8edff;
  --primary-dark: #2f4ac0;

  --green: #0ca678;
  --green-light: #d3f9d8;
  --red: #e03131;
  --red-light: #ffe3e3;
  --orange: #e8590c;
  --orange-light: #fff3e0;
  --purple: #7048e8;
  --purple-light: #f3f0ff;
  --teal: #0c8599;
  --teal-light: #e3fafc;
  --yellow: #e67700;
  --yellow-light: #fff9db;
  --pink: #c2255c;
  --pink-light: #ffdeeb;
  --indigo: #364fc7;
  --gold: #d4a017;

  --sidebar-bg: #ffffff;
  --sidebar-hover: rgba(59,91,219,0.06);
  --sidebar-active: rgba(59,91,219,0.12);
  --sidebar-text: #4a5568;
  --sidebar-text-active: #1a1f36;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --transition: 0.2s ease;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Sora', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, select, textarea { font-family: inherit; }
code { font-family: 'JetBrains Mono', monospace; }

/* ==================== SIDEBAR ==================== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid #e4e8f0;
  box-shadow: 2px 0 8px rgba(0,0,0,0.06);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 4px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #e4e8f0;
}

.brand-icon {
  width: 40px; height: 40px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 18px;
  flex-shrink: 0;
}

.brand-name { display: block; font-weight: 700; color: #1a1f36; font-size: 1rem; line-height: 1; }
.brand-sub { display: block; font-size: 0.75rem; color: #6b7a99; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-group { margin-bottom: 8px; }

.nav-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 8px 20px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  border-radius: 0;
  transition: all var(--transition);
  position: relative;
  font-size: 0.88rem;
  font-weight: 500;
}

.nav-item i { width: 18px; text-align: center; font-size: 14px; }
.nav-item span:first-of-type { flex: 1; }

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--primary);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}

.badge {
  background: rgba(59,91,219,0.1);
  color: #3b5bdb;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 99px;
  font-weight: 600;
}
.badge.badge-green { background: rgba(12,166,120,0.15); color: #0ca678; }
.badge.badge-red { background: rgba(224,49,49,0.12); color: #e03131; }
.badge.badge-orange { background: rgba(232,89,12,0.12); color: #e8590c; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid #e4e8f0;
}

.user-info { display: flex; align-items: center; gap: 10px; }

.user-avatar {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-name { font-size: 0.85rem; font-weight: 600; color: #1a1f36; line-height: 1; }
.user-role { font-size: 0.72rem; color: #6b7a99; margin-top: 2px; }

/* ==================== MAIN CONTENT ==================== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==================== TOPBAR ==================== */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.sidebar-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2);
  font-size: 15px;
  transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--bg); color: var(--text); }

.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.88rem;
  color: var(--text2);
}
.breadcrumb i { color: var(--primary); }
.breadcrumb span { color: var(--text); font-weight: 500; }

.sync-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.78rem;
  color: var(--text2);
  background: var(--green-light);
  color: #0ca678;
  padding: 4px 12px;
  border-radius: 99px;
  font-weight: 500;
}
.sync-dot {
  width: 7px; height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2);
  position: relative;
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg); color: var(--text); }

.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid white;
}

/* ==================== PAGE CONTENT ==================== */
.page-content { flex: 1; padding: 24px; }

.page { display: none; animation: fadeIn 0.25s ease; }
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.page-header h1 i { color: var(--primary); font-size: 1.2rem; }

.page-subtitle { color: var(--text2); font-size: 0.88rem; margin-top: 4px; }

.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ==================== CARDS ==================== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.card-body { padding: 20px; }
.card-body.p0 { padding: 0; }

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--transition);
  border: 1px solid transparent;
  line-height: 1;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #0b9467; }

.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #c02222; }

.btn-warning { background: var(--yellow); color: white; }
.btn-warning:hover { filter: brightness(0.9); }

.btn-purple { background: var(--purple); color: white; }
.btn-purple:hover { filter: brightness(0.9); }

.btn-orange { background: var(--orange); color: white; }
.btn-orange:hover { filter: brightness(0.9); }

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text2);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-report { width: 100%; justify-content: center; background: rgba(0,0,0,0.15); color: white; margin-top: auto; border: 1px solid rgba(255,255,255,0.2); }
.btn-report:hover { background: rgba(0,0,0,0.25); }

.btn-sm.btn-success { background: var(--green); color: white; }
.btn-sm.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text2); }

.btn-icon-sm {
  width: 30px; height: 30px;
  border-radius: var(--radius-xs);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg);
  color: var(--primary);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  transition: all var(--transition);
}
.btn-icon-sm:hover { background: var(--primary); color: white; border-color: var(--primary); }
.btn-icon-sm.danger { color: var(--red); }
.btn-icon-sm.danger:hover { background: var(--red); color: white; border-color: var(--red); }
.btn-icon-sm.success { color: var(--green); }
.btn-icon-sm.success:hover { background: var(--green); color: white; border-color: var(--green); }

/* ==================== FORMS ==================== */
.form-control, .form-control-sm, .form-select-sm {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition);
  height: 36px;
}
.form-control:focus, .form-control-sm:focus, .form-select-sm:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,91,219,0.1);
}
.form-control { width: 100%; height: auto; min-height: 38px; }
textarea.form-control { height: auto; resize: vertical; }

.form-control-xs {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.8rem;
  width: 90px;
  height: 30px;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 0.82rem; font-weight: 600; color: var(--text2); }

.checkbox-group { display: flex; flex-direction: column; gap: 8px; }
.checkbox-group label { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text); cursor: pointer; font-weight: 400; }
.checkbox-group input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; }

/* ==================== TABLES ==================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 640px;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text2);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody tr:hover { background: var(--surface2); }
.data-table tbody tr:last-child td { border-bottom: none; }

.row-danger td { background: rgba(224,49,49,0.02); }
.row-orange td { background: rgba(232,89,12,0.02); }
.row-yellow td { background: rgba(230,119,0,0.02); }
.row-purple td { background: rgba(112,72,232,0.02); }

/* ==================== TABLE TOOLBAR ==================== */
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}

.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  flex: 1; min-width: 200px;
}
.search-box i { color: var(--text3); font-size: 13px; }
.search-box input { border: none; background: none; height: 36px; flex: 1; font-size: 0.85rem; color: var(--text); }
.search-box input:focus { outline: none; }

.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ==================== TABLE FOOTER ==================== */
.table-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0 0;
  font-size: 0.82rem;
  color: var(--text2);
}

.pagination { display: flex; align-items: center; gap: 4px; }
.pg-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-xs);
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text2);
  transition: all var(--transition);
}
.pg-btn:hover, .pg-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ==================== BADGE STATUS ==================== */
.badge-status {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.73rem;
  font-weight: 600;
}
.badge-status.active { background: var(--green-light); color: var(--green); }
.badge-status.warn { background: var(--orange-light); color: var(--orange); }
.badge-status.danger { background: var(--red-light); color: var(--red); }
.badge-status.suspended { background: var(--yellow-light); color: var(--yellow); }

/* ==================== KPI GRID ==================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: transform var(--transition), box-shadow var(--transition);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.kpi-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.kpi-blue .kpi-icon { background: var(--primary-light); color: var(--primary); }
.kpi-red .kpi-icon { background: var(--red-light); color: var(--red); }
.kpi-orange .kpi-icon { background: var(--orange-light); color: var(--orange); }
.kpi-purple .kpi-icon { background: var(--purple-light); color: var(--purple); }
.kpi-teal .kpi-icon { background: var(--teal-light); color: var(--teal); }
.kpi-yellow .kpi-icon { background: var(--yellow-light); color: var(--yellow); }
.kpi-teal .kpi-icon { background: var(--teal-light); color: var(--teal); }
.kpi-green .kpi-icon { background: var(--green-light); color: var(--green); }


.kpi-body { flex: 1; min-width: 0; }
.kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--text); line-height: 1; }
.kpi-label { font-size: 0.78rem; color: var(--text2); margin-top: 4px; }
.kpi-trend { font-size: 0.72rem; font-weight: 600; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.kpi-trend.up { color: var(--green); }
.kpi-trend.down { color: var(--red); }
.kpi-trend.neutral { color: var(--text2); }

/* ==================== DASHBOARD GRID ==================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: auto auto;
  gap: 16px;
}

.chart-card { grid-column: 1; }

/* Chart bars demo */
.chart-bars-demo {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  height: 160px;
  padding: 0 8px;
}
.bar-group {
  display: flex; flex-direction: column; align-items: center;
  flex: 1; height: 100%;
}
.bar-group span { font-size: 0.72rem; color: var(--text2); margin-top: 6px; }
.bar-group .bar {
  width: 60%;
  border-radius: 4px 4px 0 0;
  transition: height 0.6s ease;
}
.bar.b1 { height: var(--h1); background: var(--primary); margin-bottom: 4px; }
.bar.b2 { height: var(--h2); background: var(--red-light); border: 1px solid var(--red); }

.chart-legend { display: flex; gap: 12px; }
.leg-item { font-size: 0.75rem; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.leg-item::before { content: ''; width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.leg-blue::before { background: var(--primary); }
.leg-red::before { background: var(--red); }

/* Site Stats */
.site-stats { display: flex; flex-direction: column; gap: 14px; }
.site-row { display: flex; align-items: center; gap: 10px; }
.site-info { font-size: 0.8rem; color: var(--text); width: 120px; flex-shrink: 0; display: flex; align-items: center; gap: 6px; }
.site-bar-wrap { flex: 1; background: var(--bg); border-radius: 99px; height: 8px; overflow: hidden; }
.site-bar { height: 100%; background: var(--primary); border-radius: 99px; transition: width 0.6s ease; }
.site-pct { font-size: 0.78rem; font-weight: 600; color: var(--text2); width: 35px; text-align: right; }

/* Alert List */
.alert-list { display: flex; flex-direction: column; }
.alert-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.alert-item:last-child { border-bottom: none; }
.alert-item > i { font-size: 16px; flex-shrink: 0; }
.alert-item > div { flex: 1; }
.alert-title { font-size: 0.83rem; font-weight: 600; }
.alert-sub { font-size: 0.75rem; color: var(--text2); }
.alert-red > i { color: var(--red); }
.alert-orange > i { color: var(--orange); }
.alert-yellow > i { color: var(--yellow); }
.alert-blue > i { color: var(--primary); }

/* Device mini list */
.device-mini-list { display: flex; flex-direction: column; gap: 8px; }
.device-mini {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8rem; color: var(--text);
}
.device-mini .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.device-mini.online .dot { background: var(--green); }
.device-mini.warning .dot { background: var(--orange); animation: blink 1s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.device-mini .ip { margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; color: var(--text3); }
.status-tag { font-size: 0.7rem; font-weight: 600; background: var(--green-light); color: var(--green); padding: 2px 7px; border-radius: 99px; }
.status-tag.warn { background: var(--orange-light); color: var(--orange); }

/* ==================== POINTEUSES ==================== */
.pointeuses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.pointeuse-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.pointeuse-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pointeuse-card.warning-card { border-color: var(--orange); }

.p-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 16px 18px;
  color: white;
}
.p-header h3 { font-size: 1rem; font-weight: 700; }
.p-header span:not(.badge-status) { font-size: 0.78rem; opacity: 0.8; display: flex; align-items: center; gap: 4px; margin-top: 2px; }

.p-blue { background: linear-gradient(135deg, #3b5bdb, #4c6ef5); }
.p-green { background: linear-gradient(135deg, #0ca678, #12b886); }
.p-orange { background: linear-gradient(135deg, #e8590c, #fd7e14); }
.p-purple { background: linear-gradient(135deg, #7048e8, #9775fa); }
.p-teal { background: linear-gradient(135deg, #0c8599, #22b8cf); }

.p-body { padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.p-info { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text2); }
.p-info i { width: 16px; color: var(--text3); text-align: center; }
.p-info code { font-size: 0.8rem; color: var(--primary); }
.sync-info { color: var(--text3); font-size: 0.78rem; }
.warning-text { color: var(--orange) !important; font-weight: 600; }

.p-actions {
  padding: 12px 18px 16px;
  display: flex; gap: 8px;
}

/* ==================== RAPPORTS ==================== */
.rapports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.rapport-card {
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: white;
  min-height: 180px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.rapport-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.rapport-card h3 { font-size: 1rem; font-weight: 700; }
.rapport-card p { font-size: 0.82rem; opacity: 0.85; flex: 1; }

.rc-icon { font-size: 1.8rem; margin-bottom: 4px; }

.rc-red { background: linear-gradient(135deg, #e03131, #fa5252); }
.rc-orange { background: linear-gradient(135deg, #e67700, #fd7e14); }
.rc-pink { background: linear-gradient(135deg, #c2255c, #e64980); }
.rc-blue { background: linear-gradient(135deg, #1971c2, #4dabf7); }
.rc-green { background: linear-gradient(135deg, #2f9e44, #40c057); }
.rc-purple { background: linear-gradient(135deg, #7048e8, #9775fa); }
.rc-indigo { background: linear-gradient(135deg, #364fc7, #5c7cfa); }
.rc-teal { background: linear-gradient(135deg, #0b7285, #0c8599); }
.rc-red2 { background: linear-gradient(135deg, #c0392b, #e74c3c); }
.rc-gold { background: linear-gradient(135deg, #b8860b, #d4a017); }

.report-filters { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-group label { font-size: 0.78rem; font-weight: 600; color: var(--text2); }
.filter-row { display: flex; gap: 8px; }

/* ==================== ABSENCES ==================== */
.absence-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip {
  padding: 6px 14px;
  border-radius: 99px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text2);
  transition: all var(--transition);
}
.filter-chip:hover, .filter-chip.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.type-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.73rem;
  font-weight: 600;
}
.type-sick { background: #fff3e0; color: var(--orange); }
.type-unj { background: var(--red-light); color: var(--red); }
.type-mat { background: var(--pink-light); color: var(--pink); }
.type-auth { background: var(--green-light); color: var(--green); }

/* ==================== RETARDS ==================== */
.retard-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.leg-retard { font-size: 0.78rem; font-weight: 600; }
.leg-retard.tolere { color: var(--green); }
.leg-retard.modere { color: var(--orange); }
.leg-retard.grave { color: var(--red); }
.leg-retard.tgrave { color: #9b1a1a; }

.retard-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.73rem;
  font-weight: 600;
}
.retard-badge.tolere { background: var(--green-light); color: var(--green); }
.retard-badge.modere { background: var(--orange-light); color: var(--orange); }
.retard-badge.grave { background: var(--red-light); color: var(--red); }
.retard-badge.tgrave { background: #ffe0e0; color: #9b1a1a; }

.text-success { color: var(--green); font-weight: 600; }
.text-danger { color: var(--red); font-weight: 600; }
.text-warning { color: var(--orange); font-weight: 600; }
.text-muted { color: var(--text3); }

/* ==================== ANOMALIES ====================
 * Note v2.4 : Les KPIs anomalies utilisent maintenant .kpi-grid/.kpi-card
 * (identique au dashboard). Les classes ci-dessous sont gardées pour
 * compatibilité avec d'éventuels widgets existants.
 *===================================================== */
.anomalie-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.ano-kpi {
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  font-size: 1.2rem;
}
.ano-kpi span { font-size: 1.8rem; font-weight: 700; display: block; line-height: 1; }
.ano-kpi small { font-size: 0.75rem; opacity: 0.85; }
.ano-kpi.red { background: linear-gradient(135deg, var(--red), #fa5252); }
.ano-kpi.orange { background: linear-gradient(135deg, var(--orange), #fd7e14); }
.ano-kpi.yellow { background: linear-gradient(135deg, var(--yellow), #fcc419); }
.ano-kpi.purple { background: linear-gradient(135deg, var(--purple), #9775fa); }

.ano-type-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.73rem;
  font-weight: 600;
}
.ano-type-badge.red { background: var(--red-light); color: var(--red); }
.ano-type-badge.orange { background: var(--orange-light); color: var(--orange); }
.ano-type-badge.yellow { background: var(--yellow-light); color: var(--yellow); }
.ano-type-badge.purple { background: var(--purple-light); color: var(--purple); }

/* ==================== SETTINGS ==================== */
.settings-layout { display: flex; gap: 20px; align-items: flex-start; }

.settings-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.settings-tab {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text2);
  text-align: left;
  transition: all var(--transition);
}
.settings-tab:last-child { border-bottom: none; }
.settings-tab:hover { background: var(--bg); color: var(--text); }
.settings-tab.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.settings-tab i { width: 16px; text-align: center; }

.settings-content { flex: 1; min-width: 0; }
.settings-panel { display: none; }
.settings-panel.active { display: block; animation: fadeIn 0.2s ease; }

.panel-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.panel-header h2 { font-size: 1rem; font-weight: 700; flex: 1; }
.panel-header p { font-size: 0.82rem; color: var(--text2); width: 100%; margin-top: -8px; }

/* Horaires Grid */
.horaires-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.horaire-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all var(--transition);
}
.horaire-card:hover { box-shadow: var(--shadow); }
.horaire-card.hc-active { border-color: var(--primary); background: var(--primary-light); }

.hc-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; }
.hc-type { font-size: 0.72rem; color: var(--text3); font-weight: 500; margin-bottom: 10px; }
.hc-times { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.hc-times span { font-size: 0.78rem; color: var(--text); display: flex; align-items: center; gap: 5px; }
.hc-times i { font-size: 11px; width: 14px; }
.hc-days { font-size: 0.72rem; color: var(--text3); font-weight: 500; }

/* Feries Grid */
.feries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.ferie-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ferie-card h4 { font-size: 0.88rem; font-weight: 600; }
.ferie-date { font-size: 0.78rem; color: var(--text2); display: flex; align-items: center; gap: 5px; }
.ferie-type { font-size: 0.72rem; font-weight: 600; }
.ferie-type.national { color: var(--primary); }
.ferie-type.religieux { color: var(--orange); }
.ferie-pay { font-size: 0.72rem; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.ferie-pay.paid { color: var(--green); }
.ferie-pay.paid::before { content: '✅'; }
.ferie-pay.unpaid { color: var(--red); }
.ferie-pay.unpaid::before { content: '🟥'; }

/* ==================== ROLES ==================== */
.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.73rem;
  font-weight: 600;
}
.role-badge.admin { background: var(--primary-light); color: var(--primary); }
.role-badge.rh { background: var(--green-light); color: var(--green); }
.role-badge.readonly { background: var(--bg); color: var(--text2); border: 1px solid var(--border); }

/* ==================== AUDIT ==================== */
.audit-note {
  margin-top: 16px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  border: 1px solid rgba(59,91,219,0.2);
}

.action-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.73rem;
  font-weight: 600;
}
.action-badge.edit { background: var(--orange-light); color: var(--orange); }
.action-badge.validate { background: var(--green-light); color: var(--green); }
.action-badge.sync { background: var(--primary-light); color: var(--primary); }
.action-badge.create { background: var(--teal-light); color: var(--teal); }
.action-badge.export { background: var(--purple-light); color: var(--purple); }

/* ==================== MODALS ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: none;
  backdrop-filter: blur(2px);
}
.modal-overlay.active { display: flex; align-items: center; justify-content: center; }

/* Modal interne (dans overlay local) */
.modal-overlay > .modal {
  position: relative;
  top: auto; left: auto;
  transform: scale(0.95);
  width: 90%;
  max-height: 90vh;
}
.modal-overlay.active > .modal,
.modal-overlay > .modal.active {
  transform: scale(1);
  display: flex !important;
  animation: modalIn 0.2s ease;
}

/* Modal autonome (overlay global séparé) */
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 201;
  width: 90%; max-width: 620px;
  max-height: 90vh;
  display: none;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.2s ease;
}
.modal.active {
  display: flex;
  transform: translate(-50%, -50%) scale(1);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.97); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-header h3 i { color: var(--primary); }
.modal-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  color: var(--text2);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--red); color: white; border-color: var(--red); }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ==================== TOASTS ==================== */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--text);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  min-width: 260px;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.warning { background: var(--orange); }
.toast.info { background: var(--primary); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ==================== SIDEBAR COLLAPSE (Desktop) ==================== */
/*
 * Classe .collapsed ajoutée par JS au clic du bouton hamburger (desktop).
 * La sidebar passe de 260px → 64px en n'affichant que les icônes.
 * La classe .sidebar-collapsed sur #mainContent ajuste le margin-left.
 */
.sidebar {
  transition: width 0.25s ease, transform 0.25s ease;
}

.sidebar.collapsed {
  width: 64px;
  overflow: hidden;
}

/* Masquer tous les textes/labels dans la sidebar collapsed */
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-item > span:first-of-type,
.sidebar.collapsed .nav-item > .badge,
.sidebar.collapsed .user-name,
.sidebar.collapsed .user-role {
  display: none !important;
  opacity: 0;
}

/* Centrer les icônes de navigation */
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 11px 0;
  gap: 0;
}
.sidebar.collapsed .nav-item i {
  width: auto;
  font-size: 16px;
  margin: 0;
}
.sidebar.collapsed .nav-item.active::before {
  top: 6px; bottom: 6px;
}

/* Centrer le logo brand */
.sidebar.collapsed .sidebar-brand {
  justify-content: center;
  padding: 18px 0;
}
.sidebar.collapsed .brand-icon {
  margin: 0;
}

/* Footer sidebar collapsed */
.sidebar.collapsed .sidebar-footer {
  padding: 12px 0;
}
.sidebar.collapsed .user-info {
  justify-content: center;
  gap: 0;
}
.sidebar.collapsed .user-avatar {
  margin: 0 auto;
}

/* Bouton déconnexion : centrer */
.sidebar.collapsed .sidebar-footer > a {
  display: none;
}

/* Tooltip au survol en mode collapsed */
.sidebar.collapsed .nav-item {
  position: relative;
}
.sidebar.collapsed .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: #1a1f36;
  color: #fff;
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 200;
}
.sidebar.collapsed .nav-item:hover::after {
  opacity: 1;
}

/* Ajustement du contenu principal quand sidebar collapsed */
.main-content.sidebar-collapsed {
  margin-left: 64px;
  transition: margin-left 0.25s ease;
}
.main-content {
  transition: margin-left 0.25s ease;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .chart-card { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    /* Pas de collapsed en mobile : uniquement open/close */
  }
  .sidebar.open  { transform: translateX(0); }
  .sidebar.collapsed { width: var(--sidebar-w); }  /* reset collapsed en mobile */
  .main-content { margin-left: 0 !important; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .settings-layout { flex-direction: column; }
  .settings-sidebar { width: 100%; }
}

/* ==================== FLASH MESSAGES ==================== */
.flash-msg {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 8px; margin-bottom: 1rem;
  font-size: 0.875rem; transition: opacity 0.3s;
}
.flash-success { background: var(--green-light); color: var(--green); }
.flash-error   { background: var(--red-light);   color: var(--red);   }
.flash-warning { background: var(--orange-light); color: var(--orange); }
.flash-info    { background: var(--primary-light); color: var(--primary); }

/* ==================== RETARDS ==================== */
.retard-badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 99px; font-size: 0.75rem; font-weight: 600;
}
.retard-badge.tolere  { background: var(--green-light);   color: var(--green); }
.retard-badge.modere  { background: var(--yellow-light);  color: var(--yellow); }
.retard-badge.grave   { background: var(--orange-light);  color: var(--orange); }
.retard-badge.tgrave  { background: var(--red-light);     color: var(--red); }
.leg-retard { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text2); margin-right: 12px; }

/* ==================== ANOMALIES ====================
 * Note v2.4 : Les KPIs anomalies utilisent maintenant .kpi-grid/.kpi-card
 * (identique au dashboard). Les classes ci-dessous sont gardées pour
 * compatibilité avec d'éventuels widgets existants.
 *===================================================== */
.anomalie-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.ano-kpi {
  background: var(--surface); border-radius: var(--radius); padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem; box-shadow: var(--shadow-sm);
  border-left: 4px solid;
}
.ano-kpi.red    { border-color: var(--red); }    .ano-kpi.red i    { color: var(--red); }
.ano-kpi.orange { border-color: var(--orange); } .ano-kpi.orange i { color: var(--orange); }
.ano-kpi.yellow { border-color: var(--yellow); } .ano-kpi.yellow i { color: var(--yellow); }
.ano-kpi.purple { border-color: var(--purple); } .ano-kpi.purple i { color: var(--purple); }
.ano-kpi i { font-size: 1.5rem; }
.ano-kpi span { font-size: 1.75rem; font-weight: 700; color: var(--text); }
.ano-kpi small { font-size: 0.78rem; color: var(--text2); }
.ano-type-badge {
  display: inline-flex; padding: 3px 10px; border-radius: 99px; font-size: 0.75rem; font-weight: 600;
}
.ano-type-badge.red    { background: var(--red-light);    color: var(--red); }
.ano-type-badge.orange { background: var(--orange-light); color: var(--orange); }
.ano-type-badge.yellow { background: var(--yellow-light); color: var(--yellow); }
.ano-type-badge.purple { background: var(--purple-light); color: var(--purple); }
.row-danger td { background: #fff5f5 !important; }
.row-orange td { background: #fff8f3 !important; }
.row-yellow td { background: #fffcf0 !important; }
.row-purple td { background: #fdf8ff !important; }
.form-control-xs { padding: 3px 6px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 0.8rem; font-family: inherit; }

/* ==================== ABSENCES ==================== */
.type-badge { display: inline-flex; padding: 3px 10px; border-radius: 99px; font-size: 0.75rem; font-weight: 600; }
.type-sick { background: var(--orange-light); color: var(--orange); }
.type-unj  { background: var(--red-light);    color: var(--red); }
.type-mat  { background: var(--pink-light);   color: var(--pink); }
.type-fam  { background: var(--teal-light);   color: var(--teal); }
.type-acc  { background: var(--purple-light); color: var(--purple); }
.type-auth { background: var(--primary-light); color: var(--primary); }
.absence-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip {
  padding: 5px 14px; border-radius: 99px; font-size: 0.8rem; font-weight: 500;
  background: var(--surface2); border: 1.5px solid var(--border); cursor: pointer;
  color: var(--text2); text-decoration: none; transition: all 0.15s;
}
.filter-chip.active, .filter-chip:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ==================== AUDIT TRAIL ==================== */
.action-badge { display: inline-flex; padding: 3px 10px; border-radius: 99px; font-size: 0.75rem; font-weight: 600; }
.action-badge.create   { background: var(--green-light);   color: var(--green); }
.action-badge.edit     { background: var(--primary-light); color: var(--primary); }
.action-badge.delete   { background: var(--red-light);     color: var(--red); }
.action-badge.validate { background: var(--teal-light);    color: var(--teal); }
.action-badge.sync     { background: var(--purple-light);  color: var(--purple); }
.action-badge.export   { background: var(--yellow-light);  color: var(--yellow); }
.audit-note {
  margin-top: 1rem; padding: 12px 16px; background: var(--primary-light);
  color: var(--primary); border-radius: 8px; font-size: 0.82rem; display: flex; align-items: center; gap: 8px;
}

/* ==================== ROLE BADGES ==================== */
.role-badge { display: inline-flex; padding: 3px 10px; border-radius: 99px; font-size: 0.75rem; font-weight: 600; }
.role-badge.admin    { background: var(--red-light);     color: var(--red); }
.role-badge.rh       { background: var(--primary-light); color: var(--primary); }
.role-badge.readonly { background: var(--surface2);      color: var(--text2); }

/* ==================== PAGE SUBTITLE ==================== */
.page-subtitle { color: var(--text2); font-size: 0.875rem; margin-top: 2px; }

/* ==================== BADGE DANGER ==================== */
.badge-status.danger { background: var(--red-light); color: var(--red); }

/* ==================== RETARD LEGEND ==================== */
.retard-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }

/* ==================== SETTINGS LAYOUT RESPONSIVE ==================== */
@media (max-width: 768px) {
  .anomalie-kpis { grid-template-columns: repeat(2, 1fr); }
  .report-filters { flex-direction: column; }
  .retard-legend { flex-direction: column; gap: 4px; }
}

/* ================================================================
   ABH ERP — Additions spécifiques v4
   (en complément du template de base)
   ================================================================ */

/* ── Font override → Sora (from template) ───────────────────── */
body { font-family: 'Sora', 'Segoe UI', system-ui, sans-serif; }

/* ── Page content ────────────────────────────────────────────── */
.page-content { flex: 1; padding: 24px; }
.main-content { transition: margin-left 0.25s ease; }

/* ── Tags ────────────────────────────────────────────────────── */
.tag {
  font-size: 0.72rem; font-weight: 600;
  padding: 2px 8px; border-radius: 4px;
  display: inline-block;
}
.tag-blue    { background: var(--primary-light); color: var(--primary); }
.tag-purple  { background: var(--purple-light);  color: var(--purple); }
.tag-teal    { background: var(--teal-light);    color: var(--teal); }
.tag-green   { background: var(--green-light);   color: var(--green); }
.tag-red     { background: var(--red-light);     color: var(--red); }
.tag-orange  { background: var(--orange-light);  color: var(--orange); }
.tag-yellow  { background: var(--yellow-light);  color: var(--yellow); }

/* ── Badge status extras ─────────────────────────────────────── */
.badge-status.grey   { background: #f1f3f9; color: #6b7a99; }
.badge-status.blue   { background: var(--primary-light); color: var(--primary); }
.badge-status.teal   { background: var(--teal-light); color: var(--teal); }
.badge-status.purple { background: var(--purple-light); color: var(--purple); }
.badge-status.green  { background: var(--green-light); color: var(--green); }
.badge-status.red    { background: var(--red-light); color: var(--red); }
.badge-status.orange { background: var(--orange-light); color: var(--orange); }
.badge-status.warn   { background: var(--orange-light); color: var(--orange); }

/* ── KPI cards ───────────────────────────────────────────────── */
.kpi-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 20px;
  display: flex; gap: 16px; align-items: flex-start;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-icon { width: 48px; height: 48px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.kpi-blue .kpi-icon   { background: var(--primary-light); color: var(--primary); }
.kpi-red .kpi-icon    { background: var(--red-light);     color: var(--red); }
.kpi-orange .kpi-icon { background: var(--orange-light);  color: var(--orange); }
.kpi-purple .kpi-icon { background: var(--purple-light);  color: var(--purple); }
.kpi-teal .kpi-icon   { background: var(--teal-light);    color: var(--teal); }
.kpi-yellow .kpi-icon { background: var(--yellow-light);  color: var(--yellow); }
.kpi-green .kpi-icon  { background: var(--green-light);   color: var(--green); }
.kpi-pink .kpi-icon   { background: var(--pink-light);    color: var(--pink); }
.kpi-body { flex: 1; min-width: 0; }
.kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--text); line-height: 1; }
.kpi-label { font-size: 0.78rem; color: var(--text2); margin-top: 4px; }
.kpi-trend { font-size: 0.72rem; font-weight: 600; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.kpi-trend.up      { color: var(--green); }
.kpi-trend.down    { color: var(--red); }
.kpi-trend.neutral { color: var(--text2); }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }

/* ── KPI gradient (rapport style) ───────────────────────────── */
.kpi-grad {
  border-radius: var(--radius); padding: 20px; color: white;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
}
.kpi-grad:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-grad::after { content:''; position:absolute; right:-10px; top:-10px; width:80px; height:80px; background:rgba(255,255,255,.1); border-radius:50%; }
.kpi-grad h6 { font-size:.78rem; font-weight:600; margin-bottom:8px; opacity:.9; }
.kpi-grad h3 { font-size:2rem; font-weight:800; margin:0; line-height:1; }
.kpi-grad .float-right { float:right; opacity:.7; font-size:1.1rem; }
.g-primary { background: linear-gradient(135deg,#3b5bdb,#5c7cfa) }
.g-success  { background: linear-gradient(135deg,#0ca678,#38d9a9) }
.g-warning  { background: linear-gradient(135deg,#e67700,#ffa94d) }
.g-info     { background: linear-gradient(135deg,#0c8599,#22d3ee) }
.g-danger   { background: linear-gradient(135deg,#e03131,#ff6b6b) }
.g-dark     { background: linear-gradient(135deg,#343a40,#6c757d) }
.g-purple   { background: linear-gradient(135deg,#7048e8,#9775fa) }
.g-teal     { background: linear-gradient(135deg,#0c8599,#22b8cf) }
.g-pink     { background: linear-gradient(135deg,#c2255c,#e64980) }

/* ── Rapport cards (dashboard rapports) ─────────────────────── */
.rapports-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 16px; }
.rapport-card { border-radius:var(--radius); padding:20px; display:flex; flex-direction:column; gap:10px; color:white; min-height:180px; transition:transform var(--transition),box-shadow var(--transition); }
.rapport-card:hover { transform:translateY(-3px); box-shadow:0 8px 24px rgba(0,0,0,.15); }
.rapport-card h3 { font-size:1rem; font-weight:700; }
.rapport-card p  { font-size:.82rem; opacity:.85; flex:1; }
.rc-icon { font-size:1.8rem; margin-bottom:4px; }
.rc-red    { background:linear-gradient(135deg,#e03131,#fa5252) }
.rc-orange { background:linear-gradient(135deg,#e67700,#fd7e14) }
.rc-pink   { background:linear-gradient(135deg,#c2255c,#e64980) }
.rc-blue   { background:linear-gradient(135deg,#1971c2,#4dabf7) }
.rc-green  { background:linear-gradient(135deg,#2f9e44,#40c057) }
.rc-purple { background:linear-gradient(135deg,#7048e8,#9775fa) }
.rc-indigo { background:linear-gradient(135deg,#364fc7,#5c7cfa) }
.rc-teal   { background:linear-gradient(135deg,#0b7285,#0c8599) }
.rc-red2   { background:linear-gradient(135deg,#c0392b,#e74c3c) }
.rc-gold   { background:linear-gradient(135deg,#b8860b,#d4a017) }
.btn-report { width:100%; justify-content:center; background:rgba(0,0,0,.15); color:white; margin-top:auto; border:1px solid rgba(255,255,255,.2); }
.btn-report:hover { background:rgba(0,0,0,.25); }

/* ── SLA bar ─────────────────────────────────────────────────── */
.sla-bar { height: 8px; border-radius: 99px; overflow: hidden; background: var(--border); margin: 4px 0; }
.sla-fill { height: 100%; border-radius: 99px; transition: width 0.5s; }
.sla-fill.green  { background: var(--green); }
.sla-fill.orange { background: var(--orange); }
.sla-fill.red    { background: var(--red); }

/* ── Nb badge (nb lignes) ────────────────────────────────────── */
.nb-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: white;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 0.72rem; font-weight: 700;
}

/* ── Rapport stat (top raisons) ─────────────────────────────── */
.rapport-stat { display:flex; justify-content:space-between; align-items:center; padding:10px 0; border-bottom:1px solid var(--border); font-size:.85rem; }
.rapport-stat:last-child { border-bottom:none; }
.rapport-stat .val { font-weight:700; color:var(--text); }

/* ── Retard badges ───────────────────────────────────────────── */
.retard-badge { display:inline-flex; padding:3px 10px; border-radius:99px; font-size:.73rem; font-weight:600; }
.retard-badge.tolere  { background:var(--green-light);  color:var(--green); }
.retard-badge.modere  { background:var(--yellow-light); color:var(--yellow); }
.retard-badge.grave   { background:var(--orange-light); color:var(--orange); }
.retard-badge.tgrave  { background:var(--red-light);    color:var(--red); }

/* ── Dashboard grid ──────────────────────────────────────────── */
.dashboard-grid { display:grid; grid-template-columns:2fr 1fr; gap:16px; }
.chart-card { grid-column:1; }
.alert-list { display:flex; flex-direction:column; }
.alert-item { display:flex; align-items:center; gap:12px; padding:12px 16px; border-bottom:1px solid var(--border); }
.alert-item:last-child { border-bottom:none; }
.alert-item > i { font-size:16px; flex-shrink:0; }
.alert-item > div { flex:1; }
.alert-title { font-size:.83rem; font-weight:600; }
.alert-sub   { font-size:.75rem; color:var(--text2); }
.alert-red > i    { color:var(--red); }
.alert-orange > i { color:var(--orange); }
.alert-yellow > i { color:var(--yellow); }
.alert-blue > i   { color:var(--primary); }
.site-stats { display:flex; flex-direction:column; gap:14px; }
.site-row   { display:flex; align-items:center; gap:10px; }
.site-info  { font-size:.8rem; color:var(--text); width:120px; flex-shrink:0; display:flex; align-items:center; gap:6px; }
.site-bar-wrap { flex:1; background:var(--bg); border-radius:99px; height:8px; overflow:hidden; }
.site-bar   { height:100%; background:var(--primary); border-radius:99px; transition:width .6s ease; }
.site-pct   { font-size:.78rem; font-weight:600; color:var(--text2); width:35px; text-align:right; }

/* ── Workflow steps ──────────────────────────────────────────── */
.workflow-steps { display:flex; align-items:center; gap:0; margin-bottom:24px; }
.wf-step { display:flex; flex-direction:column; align-items:center; flex:1; position:relative; }
.wf-step:not(:last-child)::after { content:''; position:absolute; top:18px; left:50%; width:100%; height:2px; background:var(--border); z-index:0; }
.wf-step.done:not(:last-child)::after { background:var(--green); }
.wf-circle { width:36px; height:36px; border-radius:50%; border:2px solid var(--border); background:white; display:flex; align-items:center; justify-content:center; font-size:13px; color:var(--text3); z-index:1; position:relative; }
.wf-step.done .wf-circle   { background:var(--green);   border-color:var(--green);   color:white; }
.wf-step.active .wf-circle { background:var(--primary); border-color:var(--primary); color:white; }
.wf-label { font-size:.68rem; font-weight:600; color:var(--text2); margin-top:6px; text-align:center; }
.wf-step.active .wf-label { color:var(--primary); }

/* ── Timeline ────────────────────────────────────────────────── */
.timeline { display:flex; flex-direction:column; gap:0; }
.tl-item { display:flex; gap:14px; padding-bottom:20px; position:relative; }
.tl-item:not(:last-child)::before { content:''; position:absolute; left:15px; top:32px; bottom:0; width:2px; background:var(--border); }
.tl-dot { width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:12px; color:white; flex-shrink:0; }
.tl-dot.blue   { background:var(--primary); }
.tl-dot.green  { background:var(--green); }
.tl-dot.orange { background:var(--orange); }
.tl-dot.purple { background:var(--purple); }
.tl-dot.red    { background:var(--red); }
.tl-body  { flex:1; }
.tl-title { font-size:.85rem; font-weight:600; color:var(--text); }
.tl-sub   { font-size:.75rem; color:var(--text2); margin-top:2px; }
.tl-time  { font-size:.72rem; color:var(--text3); margin-top:4px; }

/* ── Validation ──────────────────────────────────────────────── */
.validation-ligne { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:14px; margin-bottom:10px; }
.validation-ligne .ligne-meta { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:10px; }

/* ── Ligne form ──────────────────────────────────────────────── */
.ligne-row { background:var(--surface2); border-radius:var(--radius-sm); padding:16px; border:1px solid var(--border); margin-bottom:12px; position:relative; }
.ligne-row .ligne-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.ligne-num { font-size:.72rem; font-weight:700; color:var(--primary); background:var(--primary-light); padding:2px 10px; border-radius:99px; display:inline-block; }
.form-grid-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:12px; }
.form-grid-4 { display:grid; grid-template-columns:1fr 1fr 1fr 1fr; gap:12px; }
.section-divider { border:none; border-top:1px solid var(--border); margin:20px 0; }
.demande-header-grid { display:grid; grid-template-columns:1fr 1fr 1fr; gap:16px; margin-bottom:20px; }
.info-box { background:var(--primary-light); border-radius:var(--radius-sm); padding:14px 18px; display:flex; align-items:center; gap:12px; }
.info-box i { color:var(--primary); font-size:18px; }
.info-box-label { font-size:.72rem; color:var(--primary); font-weight:600; }
.info-box-val   { font-size:.95rem; font-weight:700; color:var(--text); }

/* ── Switch ──────────────────────────────────────────────────── */
.switch-group { display:flex; align-items:center; gap:8px; }
.switch { position:relative; display:inline-block; width:42px; height:24px; }
.switch input { opacity:0; width:0; height:0; }
.slider { position:absolute; cursor:pointer; top:0; left:0; right:0; bottom:0; background:var(--border); border-radius:34px; transition:.3s; }
.slider:before { position:absolute; content:''; height:18px; width:18px; left:3px; bottom:3px; background:white; border-radius:50%; transition:.3s; }
input:checked + .slider { background:var(--primary); }
input:checked + .slider:before { transform:translateX(18px); }

/* ── Fournitures sub / technicien sub ───────────────────────── */
.fourniture-sub  { display:none; margin-top:8px; }
.fourniture-sub.visible  { display:block; }
.technicien-sub  { display:none; margin-top:8px; }
.technicien-sub.visible  { display:block; }

/* ── Modal overlay (ABH version) ────────────────────────────── */
.modal-overlay { position:fixed; inset:0; background:rgba(26,31,54,.5); z-index:200; display:none; backdrop-filter:blur(2px); }
.modal-overlay.active,.modal-overlay.open { display:flex; align-items:center; justify-content:center; }
.modal-box { background:var(--surface); border-radius:var(--radius); box-shadow:var(--shadow-lg); width:90%; max-width:620px; max-height:90vh; overflow-y:auto; }
.modal-header { display:flex; align-items:center; justify-content:space-between; padding:16px 24px; border-bottom:1px solid var(--border); }
.modal-header h2 { font-size:1rem; font-weight:700; }
.modal-body   { padding:24px; }
.modal-footer { padding:16px 24px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:10px; }

/* ── Settings ────────────────────────────────────────────────── */
.settings-layout { display:grid; grid-template-columns:220px 1fr; gap:20px; align-items:start; }
.settings-sidebar { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow-sm); position:sticky; top:calc(var(--topbar-h) + 12px); }
.settings-tab { display:flex; align-items:center; gap:10px; padding:12px 20px; font-size:.88rem; font-weight:500; color:var(--sidebar-text); border-left:3px solid transparent; transition:all var(--transition); text-decoration:none; width:100%; background:none; border-top:none; border-right:none; border-bottom:1px solid var(--border); cursor:pointer; text-align:left; font-family:inherit; }
.settings-tab:last-child { border-bottom:none; }
.settings-tab:hover { background:var(--sidebar-hover); color:var(--primary); }
.settings-tab.active { background:var(--sidebar-active); color:var(--primary); border-left-color:var(--primary); font-weight:600; }
.settings-tab i { width:16px; text-align:center; }
.settings-content { min-width:0; }
.panel-header { margin-bottom:16px; }
.panel-header h2 { font-size:1.1rem; font-weight:700; color:var(--text); display:flex; align-items:center; gap:8px; }
.panel-header p  { font-size:.85rem; color:var(--text2); margin-top:4px; }
.settings-panel { display:none; }
.settings-panel.active { display:block; }

/* ── Role badges ─────────────────────────────────────────────── */
.role-badge { display:inline-flex; padding:3px 10px; border-radius:99px; font-size:.73rem; font-weight:600; }
.role-badge.admin      { background:var(--red-light);     color:var(--red); }
.role-badge.plateforme { background:var(--primary-light); color:var(--primary); }
.role-badge.faconnier  { background:var(--teal-light);    color:var(--teal); }
.role-badge.demandeur  { background:var(--green-light);   color:var(--green); }
.role-badge.technicien { background:var(--orange-light);  color:var(--orange); }
.role-badge.direction  { background:var(--purple-light);  color:var(--purple); }
.role-badge.rh         { background:var(--primary-light); color:var(--primary); }
.role-badge.readonly   { background:var(--surface2); color:var(--text2); border:1px solid var(--border); }

/* ── Action badges ───────────────────────────────────────────── */
.action-badge { display:inline-flex; padding:3px 10px; border-radius:99px; font-size:.73rem; font-weight:600; }
.action-badge.create   { background:var(--green-light);   color:var(--green); }
.action-badge.edit     { background:var(--primary-light); color:var(--primary); }
.action-badge.delete   { background:var(--red-light);     color:var(--red); }
.action-badge.validate { background:var(--teal-light);    color:var(--teal); }
.action-badge.sync     { background:var(--purple-light);  color:var(--purple); }
.action-badge.export   { background:var(--yellow-light);  color:var(--yellow); }
.action-badge.livraison{ background:var(--orange-light);  color:var(--orange); }
.action-badge.reception{ background:var(--indigo-light,#eef2ff); color:var(--indigo); }

/* ── Logout ──────────────────────────────────────────────────── */
.logout-link { display:flex; align-items:center; gap:8px; padding:9px 14px; border-radius:var(--radius-sm); font-size:.82rem; font-weight:600; color:var(--red); background:var(--red-light); border:1px solid rgba(224,49,49,.15); text-decoration:none; transition:all var(--transition); margin-top:10px; justify-content:center; }
.logout-link:hover { background:var(--red); color:white; box-shadow:0 2px 8px rgba(224,49,49,.3); }

/* ── Flash messages ──────────────────────────────────────────── */
.flash-success,.flash-error,.flash-warning,.flash-info {
  display:flex; align-items:flex-start; gap:12px; padding:14px 18px;
  border-radius:var(--radius-sm); font-size:.88rem; font-weight:500;
  line-height:1.5; border-left:4px solid transparent; box-shadow:var(--shadow-sm);
  animation:flashIn .3s ease; margin-bottom:12px;
}
@keyframes flashIn { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:translateY(0)} }
.flash-success { background:#f0fdf4; border-color:var(--green);   color:#15803d; }
.flash-error   { background:#fff5f5; border-color:var(--red);     color:#b91c1c; }
.flash-warning { background:#fffbeb; border-color:var(--orange);  color:#92400e; }
.flash-info    { background:var(--primary-light); border-color:var(--primary); color:var(--primary-dark); }

/* ── Plateforme type badges ──────────────────────────────────── */
.pt-badge { display:inline-flex; align-items:center; gap:4px; padding:4px 12px; border-radius:99px; font-size:.75rem; font-weight:700; border:2px solid transparent; cursor:pointer; transition:all .15s; opacity:.45; }
.pt-badge.active { opacity:1; }
.pt-badge.tissu       { background:var(--primary-light); color:var(--primary);  border-color:var(--primary); }
.pt-badge.fournitures { background:#fff3e0;               color:var(--orange);   border-color:var(--orange); }
.pt-badge.autres      { background:var(--teal-light);     color:var(--teal);     border-color:var(--teal); }

/* ── Notifications ───────────────────────────────────────────── */
.notif-page-item { display:flex; gap:14px; padding:16px 20px; border-bottom:1px solid var(--border); cursor:pointer; transition:background .15s; align-items:flex-start; }
.notif-page-item:last-child { border-bottom:none; }
.notif-page-item:hover { background:var(--surface2); }
.notif-page-item.unread { background:var(--primary-light); }

/* ── Toast ───────────────────────────────────────────────────── */
.toast-container { position:fixed; bottom:24px; left:50%; transform:translateX(-50%); z-index:9999; display:flex; flex-direction:column; gap:8px; pointer-events:none; }
.toast { display:flex; align-items:center; gap:10px; padding:12px 20px; border-radius:var(--radius-sm); font-size:.85rem; font-weight:600; color:white; box-shadow:var(--shadow-lg); animation:toastIn .3s ease; pointer-events:auto; min-width:260px; max-width:440px; }
@keyframes toastIn { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
.toast.success { background:var(--green); }
.toast.error   { background:var(--red); }
.toast.warning { background:var(--orange); }
.toast.info    { background:var(--primary); }

/* ── User info card ──────────────────────────────────────────── */
.sidebar-footer { padding:16px; border-top:1px solid var(--border); margin-top:auto; }
.user-info { display:flex; align-items:center; gap:10px; padding:10px 12px; background:var(--surface2); border-radius:var(--radius-sm); border:1px solid var(--border); }

/* ── Grid Bootstrap compat ───────────────────────────────────── */
.row { display:flex; flex-wrap:wrap; margin-right:-8px; margin-left:-8px; }
.row>[class*="col-"] { padding-right:8px; padding-left:8px; box-sizing:border-box; }
.col-md-2  { flex:0 0 16.6667%; max-width:16.6667%; }
.col-md-3  { flex:0 0 25%;      max-width:25%; }
.col-md-4  { flex:0 0 33.3333%; max-width:33.3333%; }
.col-md-6  { flex:0 0 50%;      max-width:50%; }
.col-md-8  { flex:0 0 66.6667%; max-width:66.6667%; }
.col-md-12 { flex:0 0 100%;     max-width:100%; }
@media(max-width:768px) { .row>[class*="col-md-"] { flex:0 0 100%; max-width:100%; } }
.mt-1{margin-top:.4rem!important} .mt-2{margin-top:.8rem!important} .mt-3{margin-top:1.2rem!important}
.mb-1{margin-bottom:.4rem!important} .mb-2{margin-bottom:.8rem!important} .mb-3{margin-bottom:1.2rem!important}
.text-muted{color:var(--text2)!important} .text-end{text-align:right}
.text-success{color:var(--green);font-weight:600} .text-danger{color:var(--red);font-weight:600} .text-warning{color:var(--orange);font-weight:600}

/* ── Misc helpers ────────────────────────────────────────────── */
.help-text { font-size:.78rem; color:var(--text3); margin-top:4px; display:block; }
.link-text { color:var(--primary); text-decoration:none; font-weight:600; }
.link-text:hover { text-decoration:underline; }
.form-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; padding-top:16px; border-top:1px solid var(--border); }
.req { color:var(--red); margin-left:2px; }

/* ── SLA mini cards ──────────────────────────────────────────── */
.sla-mini-card { border-radius:var(--radius-sm); border:1px solid var(--border); background:var(--surface); padding:14px 20px; display:flex; align-items:center; justify-content:space-between; box-shadow:var(--shadow-sm); }
.sla-mini-card h6 { font-size:.8rem; font-weight:600; margin:0 0 2px; }
.sla-mini-card h4 { font-size:1.3rem; font-weight:800; margin:0; }

/* ── Stars ───────────────────────────────────────────────────── */
.stars { color:#f59f00; font-size:1rem; letter-spacing:1px; }

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  .sidebar,.topbar,.page-actions,.toast-container,.modal-overlay,button,.filters,.table-toolbar { display:none!important; }
  .main-content { margin-left:0!important; }
  .card { box-shadow:none; border:1px solid #ddd; }
}

/* ── Responsive ──────────────────────────────────────────────── */
@media(max-width:1100px) { .dashboard-grid{grid-template-columns:1fr 1fr;} .chart-card{grid-column:1/-1;} }
@media(max-width:768px)  { .kpi-grid{grid-template-columns:1fr 1fr;} .form-grid{grid-template-columns:1fr;} .settings-layout{grid-template-columns:1fr;} .form-grid-3,.form-grid-4{grid-template-columns:1fr 1fr;} }
