/* ============================================================
   School SaaS — Design System
   Sans-serif uniquement (system stack), mobile-first
   ============================================================ */

:root {
  /* Couleurs */
  --bg: #F6F8FB;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --text: #0F172A;
  --text-2: #475569;
  --muted: #64748B;
  --muted-2: #94A3B8;
  --border: #E2E8F0;
  --border-2: #CBD5E1;

  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-soft: #DBEAFE;
  --primary-soft-2: #EFF6FF;

  --success: #16A34A;
  --success-soft: #DCFCE7;
  --warning: #F59E0B;
  --warning-soft: #FEF3C7;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --accent: #7C3AED;
  --accent-soft: #EDE9FE;

  /* Couleurs sémantiques */
  --color-bg: var(--bg);
  --color-surface: var(--surface);
  --color-text: var(--text);
  --color-muted: var(--muted);
  --color-border: var(--border);
  --color-primary: var(--primary);
  --color-primary-hover: var(--primary-hover);
  --color-danger: var(--danger);
  --color-success: var(--success);
  --color-warning: var(--warning);

  /* Radius */
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 9999px;
  --radius: var(--r);

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px -8px rgba(15, 23, 42, 0.12), 0 4px 8px rgba(15, 23, 42, 0.04);
  --shadow-focus: 0 0 0 3px rgba(37, 99, 235, 0.18);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;

  /* Transitions */
  --t-fast: 120ms ease;
  --t: 180ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --sidebar-w: 248px;
  --topbar-h: 64px;

  /* Typography (sans-serif uniquement, system stack) */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui,
    'Helvetica Neue', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--t-fast);
}
a:hover { color: var(--primary-hover); text-decoration: underline; }
a:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: 4px; }

h1, h2, h3, h4 { margin: 0 0 0.4em; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
h1 { font-size: 1.5rem; line-height: 1.25; }
h2 { font-size: 1.25rem; line-height: 1.3; }
h3 { font-size: 1.05rem; line-height: 1.35; }
h4 { font-size: 0.95rem; }

p { margin: 0 0 var(--space-3); }
.muted { color: var(--muted); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.numeric { font-variant-numeric: tabular-nums; }

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.1em 0.4em;
  border-radius: 4px;
}

hr { border: none; border-top: 1px solid var(--border); margin: var(--space-4) 0; }

/* ============================================================
   Layout
   ============================================================ */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-4);
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ============================================================
   Sidebar
   ============================================================ */

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--space-5) var(--space-3);
  position: sticky; top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex; flex-direction: column;
  gap: var(--space-2);
}

.sidebar-brand {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3) var(--space-5);
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}
.sidebar-brand-mark {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 16px;
  flex-shrink: 0;
}
.sidebar-brand-text {
  display: flex; flex-direction: column; min-width: 0;
}
.sidebar-brand-name {
  font-weight: 600; font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-brand-sub {
  font-size: 0.75rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar nav a {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 0.55rem 0.75rem;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
}
.sidebar nav a:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.sidebar nav a.active {
  background: var(--primary-soft-2);
  color: var(--primary);
  font-weight: 600;
}
.sidebar nav a .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-footer {
  margin-top: auto;
  padding: var(--space-3) var(--space-3) var(--space-2);
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* ============================================================
   Topbar
   ============================================================ */

.main {
  min-width: 0;
  display: flex; flex-direction: column;
}

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center;
  gap: var(--space-3);
  height: var(--topbar-h);
  padding: 0 var(--space-6);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}
.topbar .user-info {
  margin-left: auto;
  display: flex; align-items: center; gap: var(--space-3);
  font-size: 0.85rem;
  color: var(--text-2);
}

.mobile-menu-button {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  cursor: pointer;
  padding: 0;
  color: var(--text);
}
.mobile-menu-button:hover { background: var(--surface-2); }
.mobile-menu-button:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 90;
  opacity: 0;
  transition: opacity var(--t);
}

.main-content {
  padding: var(--space-6);
  min-height: calc(100vh - var(--topbar-h));
}

/* User avatar (cercle initiales) */
.avatar {
  width: 32px; height: 32px;
  border-radius: var(--r-full);
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft));
  color: var(--primary);
  font-weight: 600;
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* ============================================================
   Cards
   ============================================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-xs);
}
.card-hover {
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.card-hover:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-2);
}
.card h3 { margin-top: 0; }

.card-title {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.card-title h3 { margin: 0; }

/* ============================================================
   Stat cards / KPI
   ============================================================ */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
  transition: transform var(--t), box-shadow var(--t);
}
.metric-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.metric-card .metric-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft-2);
  color: var(--primary);
  margin-bottom: var(--space-3);
  font-size: 18px;
}
.metric-card.warn .metric-icon { background: var(--warning-soft); color: var(--warning); }
.metric-card.success .metric-icon { background: var(--success-soft); color: var(--success); }
.metric-card.danger .metric-icon { background: var(--danger-soft); color: var(--danger); }
.metric-card.accent .metric-icon { background: var(--accent-soft); color: var(--accent); }

.metric-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.metric-value.warn { color: var(--warning); }
.metric-value.danger { color: var(--danger); }
.metric-value.success { color: var(--success); }

.metric-card a, .metric-card .metric-cta {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: var(--space-3);
  font-size: 0.8rem;
  font-weight: 500;
}

/* ============================================================
   Buttons
   ============================================================ */

button, .btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.55rem 1rem;
  min-height: 40px;
  border-radius: var(--r-sm);
  border: 1px solid var(--primary);
  background: var(--primary);
  color: white;
  cursor: pointer;
  transition: all var(--t-fast);
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  white-space: nowrap;
}
button:hover, .btn:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
button:focus-visible, .btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}
button:active, .btn:active { transform: translateY(0.5px); }
button:disabled, .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

button.secondary, .btn.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-2);
}
button.secondary:hover, .btn.secondary:hover {
  background: var(--surface-2);
  border-color: var(--muted-2);
}
button.danger, .btn.danger {
  background: var(--danger);
  border-color: var(--danger);
}
button.danger:hover, .btn.danger:hover {
  background: #B91C1C;
  border-color: #B91C1C;
}
button.ghost, .btn.ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
button.ghost:hover, .btn.ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}
button.text-sm, .btn.text-sm {
  padding: 0.35rem 0.7rem;
  min-height: 32px;
  font-size: 0.8rem;
}

/* Boutons full-width sur mobile */
.btn-block { width: 100%; }

/* ============================================================
   Forms
   ============================================================ */

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: var(--space-1);
}

input, select, textarea {
  font-family: inherit;
  font-size: 0.95rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  min-height: 44px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input:hover, select:hover, textarea:hover {
  border-color: var(--muted-2);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
textarea { min-height: 96px; resize: vertical; }
input[type="checkbox"], input[type="radio"] {
  width: auto;
  min-height: auto;
  accent-color: var(--primary);
}
input[type="file"] { padding: 0.4rem; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-help {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: var(--space-1);
}
.form-error {
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: var(--space-1);
}

/* ============================================================
   Tables
   ============================================================ */

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
}
.table-responsive table {
  margin: 0;
  border-radius: 0;
  border: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  font-size: 0.9rem;
}
thead th {
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0.7rem 0.85rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.numeric, th.numeric { font-variant-numeric: tabular-nums; text-align: right; }

/* ============================================================
   Badges
   ============================================================ */

.badge {
  display: inline-flex; align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: var(--r-full);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-success {
  background: var(--success-soft);
  color: #166534;
  border-color: #BBF7D0;
}
.badge-warning {
  background: var(--warning-soft);
  color: #92400E;
  border-color: #FDE68A;
}
.badge-danger {
  background: var(--danger-soft);
  color: #991B1B;
  border-color: #FECACA;
}
.badge-info {
  background: var(--primary-soft);
  color: #1E40AF;
  border-color: #BFDBFE;
}
.badge-accent {
  background: var(--accent-soft);
  color: #5B21B6;
  border-color: #DDD6FE;
}
.badge-neutral {
  background: var(--surface-2);
  color: var(--text-2);
  border-color: var(--border);
}

/* StatusPill = badge avec point coloré */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.25rem 0.6rem;
  border-radius: var(--r-full);
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.status-pill::before {
  content: ''; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
}
.status-pill.green::before { background: var(--success); }
.status-pill.amber::before { background: var(--warning); }
.status-pill.red::before { background: var(--danger); }
.status-pill.blue::before { background: var(--primary); }

/* ============================================================
   Alerts / banners
   ============================================================ */

.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--r);
  margin-bottom: var(--space-4);
  border: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: var(--space-3);
  background: var(--surface);
  font-size: 0.9rem;
}
.alert.info { background: var(--primary-soft-2); border-color: #BFDBFE; color: #1E40AF; }
.alert.success { background: var(--success-soft); border-color: #BBF7D0; color: #166534; }
.alert.warning { background: var(--warning-soft); border-color: #FDE68A; color: #92400E; }
.alert.error, .alert.danger { background: var(--danger-soft); border-color: #FECACA; color: #991B1B; }

/* ============================================================
   Toasts
   ============================================================ */

#toast-container {
  position: fixed; top: 1rem; right: 1rem;
  display: flex; flex-direction: column; gap: var(--space-2);
  z-index: 9999; pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--r);
  padding: 0.85rem 1rem;
  min-width: 280px; max-width: 420px;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity var(--t), transform var(--t);
  pointer-events: auto;
}
.toast-show { opacity: 1; transform: translateX(0); }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-info { border-left-color: var(--primary); }

@media (max-width: 600px) {
  #toast-container { left: 1rem; right: 1rem; }
  .toast { min-width: auto; max-width: none; }
}

/* ============================================================
   Modals
   ============================================================ */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 9000;
  opacity: 0;
  transition: opacity var(--t);
  padding: 0;
}
@media (min-width: 600px) {
  .modal-backdrop { align-items: center; padding: var(--space-4); }
}
.modal-show { opacity: 1; }
.modal {
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--t);
}
@media (min-width: 600px) {
  .modal { border-radius: var(--r-lg); }
}
.modal-show .modal { transform: translateY(0); }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--surface);
  z-index: 1;
}
.modal-header h3 { margin: 0; font-size: 1.05rem; }
.modal-close {
  background: none; border: none; color: var(--muted);
  font-size: 1.5rem; cursor: pointer; padding: 0;
  width: 32px; height: 32px; min-height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  line-height: 1;
}
.modal-close:hover { color: var(--text); background: var(--surface-2); }
.modal-body { padding: var(--space-5); }
.modal-body p { margin: 0; }
.modal-body .prompt-input { margin-top: var(--space-3); }
.modal-footer {
  display: flex; justify-content: flex-end; gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  position: sticky; bottom: 0;
}
@media (max-width: 600px) {
  .modal-footer button { flex: 1; }
}

/* ============================================================
   Skeletons / loaders
   ============================================================ */

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-table { display: flex; flex-direction: column; gap: var(--space-2); }
.skeleton-row {
  height: 44px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--border) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: var(--r-sm);
}

.spinner {
  display: inline-block; vertical-align: middle;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-sm { width: 14px; height: 14px; }
.spinner-md { width: 22px; height: 22px; }
.spinner-lg { width: 36px; height: 36px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Empty states
   ============================================================ */

.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-4);
}
.empty-state-icon {
  width: 56px; height: 56px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 24px;
  margin-bottom: var(--space-3);
}
.empty-state-title {
  font-size: 1rem; font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-2);
}
.empty-state-desc {
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 340px;
  margin: 0 auto var(--space-4);
}

/* ============================================================
   Pagination
   ============================================================ */

.pagination {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: var(--space-3);
}
.pagination-info { color: var(--muted); font-size: 0.85rem; }
.pagination-controls { display: flex; gap: var(--space-1); align-items: center; }
.pagination-controls button {
  padding: 0.35rem 0.7rem;
  min-height: 36px;
  font-size: 0.85rem;
}

/* ============================================================
   Search input
   ============================================================ */

.search-input {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 100%;
  max-width: 320px;
}
.search-input input {
  padding-left: 2.25rem;
  width: 100%;
}
.search-input::before {
  content: '🔍';
  position: absolute; left: 0.75rem;
  font-size: 0.8rem;
  opacity: 0.5;
  pointer-events: none;
}

/* ============================================================
   Wizard / stepper
   ============================================================ */

.wizard-steps {
  display: flex; gap: var(--space-2);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-3);
  overflow-x: auto;
}
.wizard-step {
  flex: 1; min-width: 140px;
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--r-sm);
  font-size: 0.85rem;
  color: var(--muted);
}
.wizard-step .step-num {
  width: 26px; height: 26px;
  border-radius: var(--r-full);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--border);
  color: var(--text);
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.wizard-step.active { color: var(--primary); font-weight: 600; }
.wizard-step.active .step-num { background: var(--primary); color: white; }
.wizard-step.done .step-num { background: var(--success); color: white; }

/* ============================================================
   Timeline (workflow congés, incidents)
   ============================================================ */

.timeline {
  position: relative;
  padding-left: var(--space-6);
}
.timeline::before {
  content: ''; position: absolute;
  left: 11px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  padding-bottom: var(--space-4);
}
.timeline-item::before {
  content: ''; position: absolute;
  left: -1.5rem; top: 4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border-2);
}
.timeline-item.done::before { background: var(--success); border-color: var(--success); }
.timeline-item.current::before { background: var(--primary); border-color: var(--primary); }
.timeline-item.danger::before { background: var(--danger); border-color: var(--danger); }
.timeline-title {
  font-weight: 500;
  font-size: 0.9rem;
}
.timeline-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ============================================================
   Progress bar
   ============================================================ */

.progress {
  width: 100%;
  height: 8px;
  background: var(--surface-2);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: inherit;
  transition: width var(--t);
}

/* ============================================================
   Drawer (mobile menu, file detail)
   ============================================================ */

.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 100;
  opacity: 0;
  transition: opacity var(--t);
}
.drawer-backdrop.open { opacity: 1; }
.drawer {
  position: fixed; top: 0; bottom: 0; right: 0;
  width: min(440px, 90vw);
  background: var(--surface);
  z-index: 101;
  transform: translateX(100%);
  transition: transform var(--t);
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-left {
  right: auto; left: 0;
  transform: translateX(-100%);
}
.drawer-left.open { transform: translateX(0); }

/* ============================================================
   Tabs
   ============================================================ */

.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab {
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 0;
  min-height: 40px;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: none;
}

/* ============================================================
   File attachment card
   ============================================================ */

.file-card {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.file-card:hover { background: var(--surface-2); }
.file-card-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  background: var(--primary-soft-2);
  color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.file-card-name {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
  word-break: break-all;
}
.file-card-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ============================================================
   Mobile card list (alternative aux tableaux sur mobile)
   ============================================================ */

.mobile-card-list { display: none; }
.mobile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
}
.mobile-card-row {
  display: flex; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-1) 0;
  font-size: 0.88rem;
}
.mobile-card-row .label {
  color: var(--muted);
  font-size: 0.78rem;
}

/* ============================================================
   Login / hero pages
   ============================================================ */

.login-container {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background:
    radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.08), transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(124, 58, 237, 0.07), transparent 50%),
    var(--bg);
}
.login-card {
  background: var(--surface);
  padding: var(--space-8);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--border);
}
.login-card h1 {
  font-size: 1.5rem;
  margin-bottom: var(--space-2);
}
.login-card form > div { margin-bottom: var(--space-3); }
.login-card form button[type="submit"] {
  width: 100%;
  margin-top: var(--space-2);
}

@media (max-width: 600px) {
  .login-card { padding: var(--space-5); }
}

/* Hero (landing) */
.hero {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-6) var(--space-4);
  background:
    radial-gradient(ellipse at 20% 0%, rgba(37, 99, 235, 0.10), transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(124, 58, 237, 0.08), transparent 60%),
    var(--bg);
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: var(--space-10);
  max-width: 1100px;
  width: 100%;
  align-items: center;
}
.hero-text h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
}
.hero-text h1 .highlight {
  background: linear-gradient(120deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-text p {
  font-size: 1.05rem;
  color: var(--text-2);
  margin-bottom: var(--space-5);
  max-width: 520px;
}
.hero-actions {
  display: flex; gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}
.hero-features {
  display: flex; gap: var(--space-4);
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--muted);
}
.hero-feature { display: flex; align-items: center; gap: var(--space-2); }
.hero-feature::before { content: '✓'; color: var(--success); font-weight: 700; }

.hero-visual {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.hero-visual::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 8px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.hero-visual-rows { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-2); }
.hero-mini-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--space-3);
  display: flex; align-items: center; justify-content: space-between;
}
.hero-mini-card-label { font-size: 0.8rem; color: var(--muted); }
.hero-mini-card-value { font-weight: 700; font-size: 1.1rem; }
.hero-mini-card-pct { font-size: 0.78rem; font-weight: 600; }

@media (max-width: 880px) {
  .hero-inner { grid-template-columns: 1fr; gap: var(--space-6); }
  .hero-visual { order: -1; max-width: 480px; margin: 0 auto; }
}

/* ============================================================
   Utility classes
   ============================================================ */

.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: var(--space-3); }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-1 { margin-top: var(--space-2); }
.mt-2 { margin-top: var(--space-4); }
.mb-1 { margin-bottom: var(--space-2); }
.mb-2 { margin-bottom: var(--space-4); }
.hidden { display: none !important; }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ============================================================
   Responsive — mobile first
   ============================================================ */

/* Tablette : sidebar plus compacte */
@media (max-width: 1023px) {
  :root { --sidebar-w: 220px; }
  .main-content { padding: var(--space-4); }
  .topbar { padding: 0 var(--space-4); }
}

/* Mobile : transformation complète */
@media (max-width: 767px) {
  body { font-size: 14.5px; }

  .layout { grid-template-columns: 1fr; }

  /* Sidebar devient drawer */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform var(--t);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay.open {
    display: block;
    opacity: 1;
  }

  .mobile-menu-button { display: inline-flex; }

  .topbar {
    padding: 0 var(--space-4);
  }
  .topbar h1 {
    font-size: 1rem;
    /* Tronque sur petits écrans */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar .user-info { font-size: 0.8rem; gap: var(--space-2); }
  .topbar .user-info-name { display: none; }

  .main-content {
    padding: var(--space-4) var(--space-3);
  }

  .card { padding: var(--space-4); }

  /* Tableaux : overflow horizontal par défaut */
  table { font-size: 0.85rem; }
  thead th, tbody td { padding: 0.6rem 0.7rem; }

  /* Quand on veut afficher des cards à la place du tableau */
  .show-cards-mobile table { display: none; }
  .show-cards-mobile .mobile-card-list { display: block; }

  /* Form row : empilement */
  .form-row { grid-template-columns: 1fr; }

  /* Boutons full-width en bas */
  .actions-mobile-stack { display: flex; flex-direction: column; gap: var(--space-2); }
  .actions-mobile-stack button { width: 100%; }

  /* Pagination mobile-friendly */
  .pagination { flex-direction: column; align-items: stretch; }
  .pagination-controls { justify-content: center; }

  /* Modals plein écran sur petit mobile */
  .modal {
    max-height: 95vh;
  }
}

/* Petit mobile */
@media (max-width: 480px) {
  h1 { font-size: 1.3rem; }
  h2 { font-size: 1.1rem; }

  .metric-grid { grid-template-columns: 1fr; gap: var(--space-3); }
  .metric-card { padding: var(--space-4); }
  .metric-value { font-size: 1.5rem; }

  .hero-text h1 { font-size: 1.6rem; }
}

/* Préférence de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible global */
*:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: 4px;
}
button:focus-visible, .btn:focus-visible {
  border-radius: var(--r-sm);
}
