:root {
  --primary: #185FA5;
  --primary-light: #E6F1FB;
  --success: #5DCAA5;
  --success-bg: #E1F5EE;
  --success-text: #085041;
  --warning: #FAC775;
  --warning-bg: #FFF8E6;
  --danger: #F0997B;
  --danger-bg: #FAECE7;
  --danger-text: #a32d2d;
  --purple: #AFA9EC;
  --purple-bg: #EEEDFE;
  --bg: #F8F7F4;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --border-mid: #CBD5E1;
  --text: #1A2B3C;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

/* ── Layout ── */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: #0F2744; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-logo { padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo h1 { color: white; font-size: 14px; font-weight: 700; line-height: 1.3; }
.sidebar-logo p { color: rgba(255,255,255,0.5); font-size: 11px; margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 12px 8px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius); cursor: pointer; color: rgba(255,255,255,0.65); font-size: 13px; font-weight: 500; transition: all 0.15s; margin-bottom: 2px; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-item.active { background: var(--primary); color: white; }
.nav-item i { font-size: 16px; width: 18px; flex-shrink: 0; }
.nav-section { font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.3); text-transform: uppercase; letter-spacing: 0.08em; padding: 12px 12px 4px; margin-top: 8px; }
.sidebar-footer { padding: 12px 8px; border-top: 1px solid rgba(255,255,255,0.08); }
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { background: white; border-bottom: 1px solid var(--border); padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.topbar-title { font-size: 16px; font-weight: 700; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.content { flex: 1; padding: 24px; overflow-y: auto; }

/* ── Cards ── */
.card { background: white; border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }

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

/* ── Stat cards ── */
.stat-card { background: white; border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 20px; }
.stat-num { font-size: 32px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.stat-icon { width: 44px; height: 44px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 20px; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: white; color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: white; }
.btn-primary:hover { background: #1450A0; }
.btn-success { background: var(--success); border-color: var(--success); color: white; }
.btn-danger { background: #e53e3e; border-color: #e53e3e; color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; }

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-full { grid-column: 1 / -1; }
input, select, textarea { width: 100%; padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; color: var(--text); background: white; outline: none; transition: border-color 0.15s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(24,95,165,0.08); }
textarea { resize: vertical; min-height: 70px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th { background: #F8F9FC; padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr { border-bottom: 1px solid #F1F5F9; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #F8F9FC; }
tbody td { padding: 10px 14px; font-size: 13px; color: var(--text); }

/* ── Badges / Tags ── */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 100px; white-space: nowrap; }
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-warning { background: var(--warning-bg); color: #854F0B; }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); }
.badge-info { background: var(--primary-light); color: var(--primary); }
.badge-gray { background: #F1F5F9; color: var(--text-secondary); }
.badge-purple { background: var(--purple-bg); color: #3C3489; }

/* ── Avatar ── */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }

/* ── Modal ── */
.modal-bg { position: fixed; inset: 0; background: rgba(10,20,40,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.modal { background: white; border-radius: var(--radius-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-md); }
.modal-header { padding: 20px 24px 0; display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 0 24px 20px; display: flex; justify-content: flex-end; gap: 8px; }

/* ── Progress bar ── */
.progress { background: #E2E8F0; border-radius: 100px; height: 8px; overflow: hidden; }
.progress-bar { height: 8px; border-radius: 100px; transition: width 0.3s; }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 16px; font-size: 13px; font-weight: 500; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab:hover:not(.active) { color: var(--text); }

/* ── Alert ── */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 13px; }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-warning { background: var(--warning-bg); color: #854F0B; }
.alert-danger { background: var(--danger-bg); color: var(--danger-text); }
.alert-info { background: var(--primary-light); color: var(--primary); }

/* ── Empty state ── */
.empty { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty i { font-size: 40px; display: block; margin-bottom: 12px; }
.empty p { font-size: 14px; }

/* ── Login ── */
.login-screen { min-height: 100vh; background: linear-gradient(135deg, #0F2744 0%, #185FA5 100%); display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: white; border-radius: 16px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-circle { width: 72px; height: 72px; background: var(--primary-light); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; font-size: 32px; color: var(--primary); }
.login-logo h1 { font-size: 20px; font-weight: 700; color: var(--text); }
.login-logo p { font-size: 13px; color: var(--text-secondary); }

/* ── Soldes ── */
.solde-card { padding: 14px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--border); }
.solde-num { font-size: 24px; font-weight: 800; }
.solde-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* ── Calendrier ── */
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); }
.cal-day-header { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-secondary); padding: 8px 4px; background: #F8F9FC; }
.cal-cell { min-height: 80px; padding: 4px; border: 0.5px solid var(--border); background: white; }
.cal-cell.other-month { background: var(--bg); opacity: 0.5; }
.cal-cell.today { background: var(--primary-light); }
.cal-num { font-size: 11px; color: var(--text-secondary); text-align: right; margin-bottom: 2px; }
.cal-cell.today .cal-num { background: var(--primary); color: white; border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; margin-left: auto; font-size: 10px; font-weight: 700; }
.cal-event { font-size: 10px; padding: 2px 5px; border-radius: 3px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }

/* ── Absence timeline ── */
.timeline-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline-item:last-child { border-bottom: none; }

/* ── Spinner ── */
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 200px; gap: 12px; color: var(--text-secondary); }

/* ── Misc ── */
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Service colors ── */
.svc-0 { background: #E6F1FB; color: #185FA5; }
.svc-1 { background: #E1F5EE; color: #085041; }
.svc-2 { background: #EEEDFE; color: #3C3489; }
.svc-3 { background: #FAECE7; color: #712B13; }
