/* ============================================================
   TRIKAZ — Feuille de style principale
   ============================================================ */

:root {
  --bg: #0f1117;
  --bg-surface: #1a1d27;
  --bg-card: #1e2130;
  --bg-hover: #252839;
  --border: #2e3147;
  --text: #e8eaf0;
  --text-muted: #8b90a8;
  --accent: #6c63ff;
  --accent-hover: #5a52e0;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- UTILITIES ---- */
.hidden { display: none !important; }
.screen { width: 100%; min-height: 100vh; }
.screen.active { display: flex; }
.mobile-only { display: none; }

/* ============================================================
   ÉCRAN DE CONNEXION
   ============================================================ */
#login-screen {
  justify-content: center;
  align-items: center;
  background: radial-gradient(ellipse at 60% 40%, #1e1b4b 0%, #0f1117 70%);
}

.login-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
  justify-content: center;
}

.logo-icon {
  font-size: 28px;
  color: var(--accent);
}

.logo-text {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}

.logo.small .logo-icon { font-size: 20px; }
.logo.small .logo-text { font-size: 18px; }

/* ============================================================
   FORMULAIRES
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.field input, .field textarea, .field select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  transition: border-color .2s;
  width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid { display: flex; flex-direction: column; }

/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: none;
  transition: background .2s, opacity .2s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-full { width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  transition: background .15s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

.upload-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
  transition: border-color .2s, color .2s;
}
.upload-label:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
}
.badge-urgent { background: rgba(239,68,68,.15); color: #ef4444; }
.badge-normal { background: rgba(59,130,246,.15); color: #60a5fa; }
.badge-faible { background: rgba(139,144,168,.15); color: #8b90a8; }
.badge-grey { background: rgba(139,144,168,.15); color: #8b90a8; }
.badge-blue { background: rgba(59,130,246,.15); color: #60a5fa; }
.badge-green { background: rgba(34,197,94,.15); color: #22c55e; }
.badge-purple { background: rgba(108,99,255,.15); color: #a89af7; }
.badge-orange { background: rgba(249,115,22,.15); color: #fb923c; }
.badge-yellow { background: rgba(234,179,8,.15); color: #eab308; }
.badge-teal { background: rgba(20,184,166,.15); color: #2dd4bf; }
.badge-indigo { background: rgba(99,102,241,.15); color: #818cf8; }

/* ============================================================
   APP LAYOUT
   ============================================================ */
#app-screen {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}

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

#spaces-nav {
  overflow-y: auto;
  padding: 4px 8px;
}

.nav-space {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background .15s, color .15s, border-color .15s;
  margin-bottom: 8px;
}
.nav-space:hover { background: var(--bg-hover); border-color: var(--accent); color: var(--text); }
.nav-space.active { background: rgba(108,99,255,.2); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.space-icon { font-size: 18px; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-profile-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  min-width: 0;
  text-align: left;
}
.user-profile-btn:hover { background: var(--bg-hover); border-color: var(--border); }

.user-avatar-mini {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(108,99,255,.25);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}

#user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  min-width: 0;
}
#user-name {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

/* MAIN */
#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#top-bar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

#breadcrumb {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}
.crumb { color: var(--text-muted); }
.crumb.link { cursor: pointer; }
.crumb.link:hover { color: var(--accent); }
.crumb.current { color: var(--text); font-weight: 500; }
.crumb-sep { color: var(--border); }

#header-actions { display: flex; gap: 8px; }

#view-container {
  flex: 1;
  padding: 28px 24px;
  overflow-y: auto;
}

/* ============================================================
   CARDS GRID
   ============================================================ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: border-color .2s, transform .15s;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-icon { font-size: 24px; flex-shrink: 0; }
.card-body { flex: 1; min-width: 0; }
.card-body h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.card-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.card-meta { font-size: 12px; color: var(--text-muted); }

.card-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .2s;
}
.card:hover .card-actions { opacity: 1; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar-wrap { display: flex; align-items: center; gap: 8px; }
.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill { height: 100%; background: var(--success); border-radius: 3px; transition: width .3s; }

/* ============================================================
   VUES : DOSSIER
   ============================================================ */
.folder-view { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
.missions-section h2, .comments-section h2 { font-size: 16px; margin-bottom: 16px; color: var(--text-muted); }

/* ============================================================
   TÂCHES
   ============================================================ */
.tasks-view {}

.tasks-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tasks-search-wrap { flex: 1; min-width: 180px; }

.tasks-search {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 14px;
  font-size: 14px;
  transition: border-color .2s;
}
.tasks-search:focus { outline: none; border-color: var(--accent); }

.tasks-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  transition: all .2s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.tasks-list { display: flex; flex-direction: column; gap: 8px; }

.task-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color .2s;
}
.task-row:hover { border-color: var(--accent); }
.task-row.termine { opacity: .6; }
.task-main { flex: 1; min-width: 0; }
.task-title-wrap { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.task-title { font-size: 14px; font-weight: 500; }
.task-attach { font-size: 12px; color: var(--text-muted); }
.task-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.task-assignee, .task-due { font-size: 12px; color: var(--text-muted); }
.task-due.overdue { color: var(--danger); }
.task-actions { display: flex; gap: 6px; align-items: center; }

/* ============================================================
   DÉTAIL TÂCHE
   ============================================================ */
.task-detail { display: flex; flex-direction: column; gap: 20px; }
.task-detail-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-desc { font-size: 14px; color: var(--text-muted); line-height: 1.6; }

.attach-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.attach-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.attach-list a { font-size: 13px; }

/* ============================================================
   COMMENTAIRES
   ============================================================ */
.comments-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.comments-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; max-height: 340px; overflow-y: auto; }

.comment {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.comment-header strong { color: var(--text); }
.comment-header time { color: var(--text-muted); margin-left: auto; }
.comment-body { font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.comment-internal { border-color: #f59e0b; background: rgba(245,158,11,.06); }
.badge-internal { font-size: 11px; background: rgba(245,158,11,.15); color: #f59e0b; padding: 2px 7px; border-radius: 20px; font-weight: 600; }

.comment-form { display: flex; flex-direction: column; gap: 8px; }
.comment-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.comment-internal-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.comment-internal-toggle input { cursor: pointer; }
.comment-form textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  resize: vertical;
  width: 100%;
}
.comment-form textarea:focus { outline: none; border-color: var(--accent); }

/* Lien Dropbox */
.dropbox-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #0061ff;
  background: rgba(0,97,255,.1);
  padding: 2px 8px;
  border-radius: 20px;
  text-decoration: none;
  margin-left: 6px;
  transition: background .2s;
}
.dropbox-link:hover { background: rgba(0,97,255,.2); }

/* Permissions dossiers */
.perms-list { display: flex; flex-direction: column; gap: 8px; }
.perm-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.perm-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.perm-name { font-weight: 600; font-size: 13px; }
.perm-edit { font-size: 12px; color: var(--text-muted); }

/* Historique */
.history-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.history-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.history-body { flex: 1; line-height: 1.5; }
.history-who { font-weight: 600; color: var(--accent); margin-right: 4px; }
.history-text { color: var(--text-muted); }
.history-text strong { color: var(--text); }
.history-date { color: var(--text-muted); font-size: 11px; white-space: nowrap; flex-shrink: 0; }

/* ============================================================
   MODAL
   ============================================================ */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}

#modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

#modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#modal-title { font-size: 16px; font-weight: 600; }

#modal-body { padding: 24px; }

/* ============================================================
   TOAST
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 13px;
  max-width: 320px;
  opacity: 0;
  transform: translateY(8px);
  transition: all .3s;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-color: var(--success); color: var(--success); }
.toast-error { border-color: var(--danger); color: var(--danger); }
.toast-info { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   LOADER / EMPTY
   ============================================================ */
.loader { display: flex; justify-content: center; padding: 60px; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

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

.error-msg {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.3);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ============================================================
   DESKTOP : sidebar toujours visible, toggle caché
   ============================================================ */
@media (min-width: 769px) {
  #sidebar-toggle { display: none; }
  #sidebar { position: sticky; left: 0; }
}

/* ============================================================
   RESPONSIVE MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .mobile-only { display: flex; }

  #sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    z-index: 50;
    height: 100vh;
    transition: left .25s;
  }
  #sidebar.open { left: 0; box-shadow: 4px 0 24px rgba(0,0,0,.5); }

  #sidebar-toggle { display: flex; }

  #view-container { padding: 16px; }
  #top-bar { padding: 0 16px; }

  .folder-view { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 1fr; }

  .task-row { flex-direction: column; align-items: flex-start; }
  .task-actions { width: 100%; justify-content: flex-end; }

  .login-box { padding: 32px 24px; }
  .users-table th:nth-child(3), .users-table td:nth-child(3) { display: none; }
  .user-form-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   ADMIN NAV + PAGE UTILISATEURS
   ============================================================ */
/* DASHBOARD NAV */
#dashboard-nav { padding: 8px 8px 0; }

.nav-dashboard {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  margin-bottom: 4px;
}
.nav-dashboard:hover { background: var(--bg-hover); border-color: var(--accent); }
.nav-dashboard.active { background: rgba(108,99,255,.2); border-color: var(--accent); color: var(--accent); }

/* BADGE ALERTE SIDEBAR */
.alert-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}

/* BANNIÈRE D'ALERTE */
#alert-banner {
  background: linear-gradient(90deg, rgba(239,68,68,.12), rgba(245,158,11,.08));
  border-bottom: 1px solid rgba(239,68,68,.25);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  flex-wrap: wrap;
}
#alert-banner .alert-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
#alert-banner .alert-item.danger {
  background: rgba(239,68,68,.15);
  color: #ef4444;
}
#alert-banner .alert-item.warning {
  background: rgba(245,158,11,.15);
  color: #f59e0b;
}
#alert-banner .alert-item:hover { filter: brightness(1.2); }
#alert-banner .alert-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
}
#alert-banner .alert-dismiss:hover { color: var(--text); }

/* VUE CLIENT */
.client-welcome {
  background: linear-gradient(135deg, rgba(108,99,255,.15), rgba(108,99,255,.05));
  border: 1px solid rgba(108,99,255,.2);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.client-welcome-icon { font-size: 36px; }
.client-welcome-text h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.client-welcome-text p { font-size: 13px; color: var(--text-muted); }

.task-row.client-view {
  border-left: 3px solid transparent;
}
.task-row.client-view.a_faire { border-left-color: var(--text-muted); }
.task-row.client-view.en_cours { border-left-color: var(--info); }
.task-row.client-view.termine { border-left-color: var(--success); }

.client-status-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.client-stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.client-stat-num { font-size: 24px; font-weight: 800; }
.client-stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

/* TABLEAU DE BORD */
.dashboard { display: flex; flex-direction: column; gap: 28px; }
.dashboard-greeting { font-size: 22px; font-weight: 700; }
.dashboard-greeting span { color: var(--accent); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color .2s;
}
.stat-card:hover { border-color: var(--accent); }
.stat-number { font-size: 32px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.stat-card.urgent .stat-number { color: #ef4444; }
.stat-card.overdue .stat-number { color: #f59e0b; }
.stat-card.done .stat-number { color: #22c55e; }
.stat-card.inprogress .stat-number { color: #60a5fa; }

.dashboard-section { display: flex; flex-direction: column; gap: 12px; }
.dashboard-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dashboard-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.dash-task-list { display: flex; flex-direction: column; gap: 6px; }

.dash-task {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color .15s;
}
.dash-task:hover { border-color: var(--accent); }
.dash-task-left { flex: 1; min-width: 0; }
.dash-task-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-task-path { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.dash-task-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.dash-task-due { font-size: 12px; padding: 3px 8px; border-radius: 20px; }
.dash-task-due.overdue { background: rgba(239,68,68,.1); color: #ef4444; }
.dash-task-due.ok { color: var(--text-muted); }

.space-progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.space-progress-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.space-progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.space-progress-name { font-size: 13px; font-weight: 600; }
.space-progress-count { font-size: 12px; color: var(--text-muted); }
.space-progress-pct { font-size: 11px; color: var(--accent); font-weight: 600; margin-top: 6px; }

#admin-nav { padding: 0 8px 8px; }

.sidebar-divider {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 6px 6px;
}

.nav-admin {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.nav-admin:hover { background: var(--bg-hover); border-color: var(--accent); }
.nav-admin.active { background: rgba(108,99,255,.2); border-color: var(--accent); color: var(--accent); }

/* PAGE UTILISATEURS */
.users-page { display: flex; flex-direction: column; gap: 24px; }
.users-page h1 { font-size: 22px; font-weight: 700; }

.users-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
}
.users-table th {
  background: var(--bg-surface);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
}
.users-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.users-table tr:last-child td { border-bottom: none; }
.users-table tr:hover td { background: var(--bg-hover); }

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(108,99,255,.2);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}

.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell-info { display: flex; flex-direction: column; gap: 2px; }
.user-cell-name { font-weight: 500; }
.user-cell-email { font-size: 12px; color: var(--text-muted); }

.table-actions { display: flex; gap: 6px; justify-content: flex-end; }

.user-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.user-form-grid .field-full { grid-column: 1 / -1; }

/* ----- CALENDRIER ----- */
.calendar { width: 100%; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-month { font-weight: 700; font-size: 16px; color: var(--text); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-header-cell { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; padding: 6px 0; letter-spacing: .5px; }
.cal-cell { min-height: 80px; background: var(--bg-card); border-radius: 6px; padding: 6px; cursor: default; transition: background .15s; }
.cal-cell[data-date]:has(.cal-task) { cursor: pointer; }
.cal-cell[data-date]:hover { background: var(--bg-hover); }
.cal-empty { background: transparent; }
.cal-today { background: rgba(108,99,255,.12); border: 1px solid var(--accent); }
.cal-overdue { border-color: var(--danger); }
.cal-day-num { font-size: 12px; font-weight: 700; color: var(--text-muted); display: block; margin-bottom: 4px; }
.cal-today .cal-day-num { color: var(--accent); }
.cal-task { font-size: 10px; padding: 2px 5px; border-radius: 3px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-task-urgent { background: rgba(239,68,68,.15); color: #ef4444; }
.cal-task-normal { background: rgba(108,99,255,.15); color: var(--accent); }
.cal-task-faible { background: rgba(139,144,168,.12); color: var(--text-muted); }
.cal-more { font-size: 10px; color: var(--text-muted); text-align: right; margin-top: 2px; }

/* ----- MODÈLES ----- */
.template-task-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.template-task-row input { flex: 1; }
.template-task-row select { width: 110px; flex-shrink: 0; }

/* ----- ARCHIVAGE ----- */
.folder-archived { opacity: 0.6; }
.folder-archived h3 { color: var(--text-muted); }
.badge-archived {
  display: inline-block;
  background: rgba(139,144,168,.15);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  vertical-align: middle;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: .3px;
}

/* ----- AIDE ----- */
.help-content { font-size: 14px; line-height: 1.7; color: var(--text); }
.help-content h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--accent); margin: 20px 0 8px; }
.help-content h3:first-child { margin-top: 0; }
.help-content ul { margin: 0 0 8px 0; padding-left: 18px; }
.help-content ul li { margin-bottom: 5px; color: var(--text-muted); }
.help-content ul li strong { color: var(--text); }
.help-content p { color: var(--text-muted); margin: 0 0 8px; }

#btn-help {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#btn-help:hover { color: var(--accent); border-color: var(--accent); }
