/* ═══════════════════════════════════════════════════════════════
   OPUS ONE — Design System Global
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --color-primary:     #161616;
  --color-accent:      #FFC501;
  --color-accent-dark: #E6B100;
  --color-orange:      #FF9900;
  --color-white:       #FFFFFF;
  --color-bg:          #F5F5F5;
  --color-border:      #E8E8E8;
  --color-border-light:#F0F0F0;
  --color-text:        #1F2937;
  --color-text-muted:  #6B7280;
  --color-text-light:  #9CA3AF;

  --color-success:     #10B981;
  --color-success-bg:  #D1FAE5;
  --color-danger:      #EF4444;
  --color-danger-bg:   #FEE2E2;
  --color-warning:     #F59E0B;
  --color-warning-bg:  #FEF3C7;
  --color-info:        #3B82F6;
  --color-info-bg:     #DBEAFE;

  --sidebar-width: 240px;
  --sidebar-collapsed: 60px;
  --topbar-height: 60px;

  --radius-sm:  6px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-pill:20px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:  0 20px 60px rgba(0,0,0,0.15);
  --shadow-modal: 0 20px 60px rgba(0,0,0,0.18);

  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --transition: 150ms ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
  height: 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
#app { height: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* ── Splash screen ──────────────────────────────────────────── */
.splash {
  position: fixed; inset: 0;
  background: var(--color-primary);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 24px; z-index: 9999;
  transition: opacity 0.3s ease;
}
.splash-logo {
  display: flex; align-items: center; gap: 12px;
  color: #fff; font-size: 22px; font-weight: 700;
}
.splash-spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(255,197,1,0.3);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── App layout ─────────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-primary);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  z-index: 100;
  transition: width var(--transition);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-logo svg { flex-shrink: 0; }
.sidebar-logo-text {
  font-size: 17px; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden;
}

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

.nav-section-label {
  padding: 12px 16px 4px;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: rgba(255,255,255,0.3);
  white-space: nowrap;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  margin: 2px 10px;
  color: rgba(255,255,255,0.6);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  border-radius: 10px;
  background: none;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
  text-align: left;
  width: calc(100% - 20px);
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active {
  background: rgba(255,197,1,0.15);
  color: var(--color-accent);
}
.nav-item .nav-icon {
  font-size: 16px; flex-shrink: 0; width: 20px; text-align: center;
}
.nav-item .nav-label { flex: 1; }
.nav-item .nav-badge {
  background: var(--color-danger);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 10px;
  min-width: 18px; text-align: center;
}

/* Current mission mini-card in sidebar */
.sidebar-mission-card {
  margin: 8px 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.08);
}
.sidebar-mission-card .mission-label {
  font-size: 10px; color: rgba(255,255,255,0.4); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px;
}
.sidebar-mission-card .mission-name {
  font-size: 12px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-mission-card .mission-progress-bar {
  height: 3px; background: rgba(255,255,255,0.1);
  border-radius: 2px; margin-top: 8px; overflow: hidden;
}
.sidebar-mission-card .mission-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-orange));
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* Sidebar user profile */
.sidebar-bottom {
  padding: 8px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-user {
  padding: 10px 14px;
  margin: 4px 10px;
  border-radius: 10px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}
.sidebar-user:hover { background: rgba(255,255,255,0.08); }
.sidebar-user .user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--color-primary);
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 13px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11px; font-weight: 500; color: rgba(255,255,255,0.5);
  margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-chevron {
  color: rgba(255,255,255,0.25); flex-shrink: 0;
  transition: color var(--transition);
}
.sidebar-user:hover .sidebar-user-chevron { color: rgba(255,255,255,0.5); }

/* ── Main content area ──────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  flex-shrink: 0;
  z-index: 50;
}
.topbar-breadcrumb {
  flex: 1;
  font-size: 13px; color: var(--color-text-muted);
  display: flex; align-items: center; gap: 6px;
}
.topbar-breadcrumb .crumb { cursor: pointer; }
.topbar-breadcrumb .crumb:hover { color: var(--color-text); }
.topbar-breadcrumb .crumb-sep { color: var(--color-border); }
.topbar-breadcrumb .crumb-current { color: var(--color-text); font-weight: 500; }
.topbar-datetime { font-size: 12px; color: var(--color-text-muted); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* Notification bell */
.notif-btn {
  position: relative;
  width: 36px; height: 36px;
  border: 1px solid var(--color-border);
  background: var(--color-white);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px;
  transition: all var(--transition);
}
.notif-btn:hover { border-color: var(--color-accent); background: #FFFBEB; }
.notif-badge {
  position: absolute; top: -5px; right: -5px;
  background: var(--color-danger); color: #fff;
  font-size: 9px; font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--color-white);
}

/* Topbar avatar dropdown */
.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--color-primary);
  cursor: pointer; position: relative;
}

/* Hamburger (mobile) */
.hamburger {
  display: none;
  width: 36px; height: 36px;
  border: 1px solid var(--color-border);
  background: transparent;
  border-radius: var(--radius-md);
  align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer;
}

/* ── Page content ───────────────────────────────────────────── */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}
.page-content::-webkit-scrollbar { width: 6px; }
.page-content::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 24px; font-weight: 700; color: var(--color-primary); }
.page-subtitle { font-size: 13px; color: var(--color-text-muted); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

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

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
}
.card-body { padding: 20px; }
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--color-primary); }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── KPI Cards ──────────────────────────────────────────────── */
.kpi-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
  display: flex; flex-direction: column; gap: 8px;
}
.kpi-label { font-size: 12px; font-weight: 500; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-value { font-size: 32px; font-weight: 700; color: var(--color-primary); line-height: 1; }
.kpi-sub { font-size: 12px; color: var(--color-text-muted); }
.kpi-icon { font-size: 24px; }
.kpi-card .kpi-top { display: flex; justify-content: space-between; align-items: flex-start; }
.kpi-badge-red .kpi-value { color: var(--color-danger); }
.kpi-badge-orange .kpi-value { color: var(--color-orange); }

/* ── Progress bars ──────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-orange));
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 600;
  border: none; cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--color-accent);
  color: var(--color-primary);
}
.btn-primary:hover:not(:disabled) { background: var(--color-accent-dark); }

.btn-secondary {
  background: var(--color-white);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.btn-secondary:hover:not(:disabled) { background: var(--color-bg); border-color: #ccc; }

.btn-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover:not(:disabled) { background: var(--color-danger); color: #fff; }

.btn-ghost {
  background: transparent; color: var(--color-text-muted);
  border: 1px solid transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--color-bg); color: var(--color-text); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }
.btn-full { width: 100%; justify-content: center; }

.btn-icon {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  background: transparent; border: 1px solid var(--color-border);
  color: var(--color-text-muted); cursor: pointer; font-size: 14px;
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--color-bg); color: var(--color-text); }
.btn-loading .btn-spinner { animation: spin 0.8s linear infinite; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--color-primary); color: #fff;
  padding: 10px 16px; text-align: left;
  font-size: 12px; font-weight: 600; letter-spacing: 0.03em;
  white-space: nowrap;
}
thead th:first-child { border-radius: var(--radius-lg) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius-lg) 0 0; }
tbody tr { border-bottom: 1px solid var(--color-border-light); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #FAFAFA; }
tbody td { padding: 12px 16px; font-size: 13px; vertical-align: middle; }
.table-actions { display: flex; gap: 4px; align-items: center; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; margin-bottom: 6px;
  font-size: 13px; font-weight: 500; color: var(--color-text);
}
.form-label .required { color: var(--color-danger); margin-left: 2px; }
.form-hint { font-size: 11px; color: var(--color-text-muted); margin-top: 4px; }

.form-control {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px; color: var(--color-text);
  background: var(--color-white);
  transition: all var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(255,197,1,0.2);
}
.form-control::placeholder { color: var(--color-text-light); }
.form-control:disabled { background: var(--color-bg); color: var(--color-text-muted); cursor: not-allowed; }
.form-control.error { border-color: var(--color-danger); }

textarea.form-control { resize: vertical; min-height: 80px; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* Input with icon */
.input-group { position: relative; }
.input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); font-size: 16px; pointer-events: none; }
.input-group .form-control { padding-left: 38px; }
.input-icon-right { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); cursor: pointer; color: var(--color-text-muted); font-size: 16px; }

/* Password strength */
.password-strength { margin-top: 6px; }
.strength-bars { display: flex; gap: 4px; margin-bottom: 4px; }
.strength-bar { height: 4px; flex: 1; border-radius: 2px; background: var(--color-border); transition: background 0.3s; }
.strength-bar.weak   { background: var(--color-danger); }
.strength-bar.medium { background: var(--color-orange); }
.strength-bar.strong { background: var(--color-success); }
.strength-label { font-size: 11px; color: var(--color-text-muted); }

/* Checkbox */
.checkbox-group { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-group input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--color-accent); cursor: pointer; }
.checkbox-group label { font-size: 13px; cursor: pointer; }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--color-accent);
  background: #FFFBEB;
}
.upload-zone-icon { font-size: 32px; margin-bottom: 8px; }
.upload-zone-text { font-size: 14px; color: var(--color-text-muted); }
.upload-zone-text strong { color: var(--color-accent); }
.upload-zone-hint { font-size: 11px; color: var(--color-text-light); margin-top: 4px; }

/* ── Badges / Status ────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-a_venir       { background: #F3F4F6; color: #4B5563; }
.badge-en_cours      { background: #DBEAFE; color: #1E40AF; }
.badge-en_revision   { background: #FEF3C7; color: #92400E; }
.badge-valide        { background: #D1FAE5; color: #065F46; }
.badge-bloque        { background: #FEE2E2; color: #991B1B; }
.badge-publie        { background: #DCFCE7; color: #166534; }
.badge-en_revision_client { background: #FEF3C7; color: #92400E; }
.badge-fourni        { background: #DBEAFE; color: #1E40AF; }
.badge-accepte       { background: #D1FAE5; color: #065F46; }
.badge-refuse        { background: #FEE2E2; color: #991B1B; }
.badge-planifie      { background: #F3F4F6; color: #4B5563; }
.badge-confirme      { background: #DBEAFE; color: #1E40AF; }
.badge-realise       { background: #D1FAE5; color: #065F46; }
.badge-annule        { background: #F3F4F6; color: #6B7280; }
.badge-a_produire    { background: #F3F4F6; color: #4B5563; }
.badge-non_demarre   { background: #F3F4F6; color: #4B5563; }
.badge-preparation   { background: #DBEAFE; color: #1E40AF; }
.badge-termine       { background: #D1FAE5; color: #065F46; }
.badge-archive       { background: #F3F4F6; color: #6B7280; }
.badge-validation    { background: #FEF3C7; color: #92400E; }

.badge-admin       { background: #161616; color: #FFC501; }
.badge-chef_projet { background: #DBEAFE; color: #1E40AF; }
.badge-consultant  { background: #EDE9FE; color: #5B21B6; }
.badge-client      { background: #D1FAE5; color: #065F46; }
.badge-observateur { background: #F3F4F6; color: #4B5563; }

.badge-critique      { background: #FEE2E2; color: #991B1B; }
.badge-importante    { background: #FEF3C7; color: #92400E; }
.badge-nice_to_have  { background: #D1FAE5; color: #065F46; }

.badge-active   { background: #D1FAE5; color: #065F46; }
.badge-inactive { background: #F3F4F6; color: #6B7280; }
.badge-pending  { background: #FEF3C7; color: #92400E; }

/* ── 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;
  color: #fff;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--color-border);
  gap: 0; overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 20px;
  font-size: 13px; font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}
.tab:hover { color: var(--color-text); }
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-accent); font-weight: 600; }
.tab .tab-badge {
  background: var(--color-danger); color: #fff;
  font-size: 10px; padding: 1px 5px; border-radius: 10px;
}

/* ── Accordion / Phase cards ────────────────────────────────── */
.accordion {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 8px;
}
.accordion-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--color-white);
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
}
.accordion-header:hover { background: #FAFAFA; }
.accordion-header .phase-num {
  width: 28px; height: 28px;
  border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.accordion-title { flex: 1; font-size: 14px; font-weight: 600; }
.accordion-meta { font-size: 12px; color: var(--color-text-muted); }
.accordion-chevron { color: var(--color-text-muted); font-size: 12px; transition: transform var(--transition); }
.accordion.open .accordion-chevron { transform: rotate(180deg); }
.accordion-body {
  display: none;
  padding: 16px;
  border-top: 1px solid var(--color-border);
  background: #FAFAFA;
}
.accordion.open .accordion-body { display: block; }

/* ── Activity feed ──────────────────────────────────────────── */
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border-light);
  transition: background var(--transition);
}
.activity-item:hover { background: var(--color-bg); }
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
  background: var(--color-bg);
}
.activity-content { flex: 1; min-width: 0; }
.activity-text { font-size: 13px; line-height: 1.4; }
.activity-text strong { font-weight: 600; }
.activity-meta { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; }
.activity-time { font-size: 11px; color: var(--color-text-light); white-space: nowrap; }

/* ── Alert banners ──────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px;
}
.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-content { flex: 1; }
.alert-title { font-weight: 600; margin-bottom: 2px; }
.alert-danger  { background: var(--color-danger-bg); color: #7F1D1D; border: 1px solid rgba(239,68,68,0.2); }
.alert-warning { background: var(--color-warning-bg); color: #78350F; border: 1px solid rgba(245,158,11,0.2); }
.alert-info    { background: var(--color-info-bg);    color: #1E3A5F; border: 1px solid rgba(59,130,246,0.2); }
.alert-success { background: var(--color-success-bg); color: #064E3B; border: 1px solid rgba(16,185,129,0.2); }

/* Observer banner */
.observer-banner {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--color-primary); color: var(--color-accent);
  text-align: center; padding: 10px;
  font-size: 13px; font-weight: 600;
  z-index: 200;
}

/* ── Skeleton loaders ───────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-text  { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 20px; width: 60%; margin-bottom: 16px; }
.skeleton-card  { height: 100px; }

/* ── Empty states ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--color-text); margin-bottom: 6px; }
.empty-state-text { font-size: 13px; margin-bottom: 16px; }

/* ── Login page ─────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #161616 0%, #1F2937 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-bottom: 28px;
}
.login-logo-text { font-size: 20px; font-weight: 700; color: var(--color-primary); }
.login-title { font-size: 24px; font-weight: 700; color: var(--color-primary); margin-bottom: 4px; }
.login-subtitle { font-size: 14px; color: var(--color-text-muted); margin-bottom: 28px; }
.form-error {
  padding: 10px 14px;
  background: var(--color-danger-bg);
  color: #991B1B;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid rgba(239,68,68,0.2);
}

/* ── SVG Charts ─────────────────────────────────────────────── */
.chart-container { position: relative; }
.donut-chart { display: block; margin: 0 auto; }

/* ── Dropdown ───────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  min-width: 180px; z-index: 500;
  overflow: hidden;
  animation: dropdownIn 0.15s ease;
}
@keyframes dropdownIn { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:none; } }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: 13px;
  cursor: pointer; transition: background var(--transition);
  color: var(--color-text);
}
.dropdown-item:hover { background: var(--color-bg); }
.dropdown-item.danger { color: var(--color-danger); }
.dropdown-item.danger:hover { background: var(--color-danger-bg); }
.dropdown-sep { height: 1px; background: var(--color-border); margin: 4px 0; }

/* Notif dropdown */
.notif-dropdown {
  width: min(340px, calc(100vw - 20px));
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: 500;
  overflow: hidden;
  animation: dropdownIn 0.15s ease;
}
.notif-dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 600;
}
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border-light);
  cursor: pointer; transition: background var(--transition);
  display: flex; gap: 10px;
}
.notif-item:hover { background: var(--color-bg); }
.notif-item.unread { background: #FFFBEB; }
.notif-item.unread:hover { background: #FFF3CD; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-accent); flex-shrink: 0; margin-top: 4px; }
.notif-text { font-size: 12px; color: var(--color-text); }
.notif-time { font-size: 10px; color: var(--color-text-muted); margin-top: 2px; }
.notif-empty { padding: 24px; text-align: center; color: var(--color-text-muted); font-size: 13px; }

/* ── Filters / Pills ────────────────────────────────────────── */
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.pill {
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
  color: var(--color-text-muted);
  background: var(--color-white);
}
.pill:hover { border-color: var(--color-accent); color: var(--color-text); }
.pill.active { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-primary); }

/* ── Search bar ─────────────────────────────────────────────── */
.search-bar {
  position: relative; flex: 1; max-width: 320px;
}
.search-bar input {
  width: 100%; padding: 8px 12px 8px 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 13px; background: var(--color-white);
  transition: all var(--transition);
}
.search-bar input:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(255,197,1,0.15); }
.search-bar .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); font-size: 14px; pointer-events: none; }

/* ── Mission cards ──────────────────────────────────────────── */
.mission-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; flex-direction: column; gap: 12px;
}
.mission-card:hover { border-color: var(--color-accent); box-shadow: 0 4px 16px rgba(255,197,1,0.1); transform: translateY(-1px); }
.mission-card-header { display: flex; align-items: flex-start; gap: 12px; }
.mission-initials {
  width: 40px; height: 40px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.mission-card-title { font-size: 14px; font-weight: 600; color: var(--color-primary); }
.mission-card-company { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.mission-card-meta { display: flex; gap: 12px; font-size: 12px; color: var(--color-text-muted); flex-wrap: wrap; }
.mission-card-meta span { display: flex; align-items: center; gap: 4px; }

/* ── Wizard steps ───────────────────────────────────────────── */
.wizard-steps {
  display: flex; align-items: center; justify-content: center;
  gap: 0; margin-bottom: 32px; flex-wrap: wrap;
}
.wizard-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--color-text-muted);
}
.wizard-step-num {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: var(--color-border); color: var(--color-text-muted);
}
.wizard-step.active .wizard-step-num { background: var(--color-accent); color: var(--color-primary); }
.wizard-step.done .wizard-step-num { background: var(--color-success); color: #fff; }
.wizard-step.active { color: var(--color-text); }
.wizard-step-line { width: 40px; height: 2px; background: var(--color-border); margin: 0 8px; }
.wizard-step.done + .wizard-step-line, .wizard-step.done .wizard-step-line { background: var(--color-accent); }

/* ── RDV date box ───────────────────────────────────────────── */
.rdv-date-box {
  width: 52px; flex-shrink: 0;
  background: var(--color-accent);
  border-radius: var(--radius-md);
  text-align: center; padding: 6px;
}
.rdv-date-day { font-size: 22px; font-weight: 700; color: var(--color-primary); line-height: 1; }
.rdv-date-month { font-size: 10px; font-weight: 600; color: var(--color-primary); text-transform: uppercase; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-cols-4 { grid-template-columns: repeat(2,1fr); }
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar .nav-label, .sidebar .nav-section-label,
  .sidebar .sidebar-logo-text, .sidebar .sidebar-user-info,
  .sidebar .sidebar-user-chevron, .sidebar .sidebar-mission-card { display: none; }
  .sidebar .sidebar-logo { justify-content: center; padding: 16px 0; }
  .sidebar .nav-item { justify-content: center; padding: 12px 0; margin: 2px 6px; border-radius: 10px; }
  .sidebar .nav-item.active { background: rgba(255,197,1,0.15); }
  .sidebar .sidebar-user { justify-content: center; padding: 10px 6px; margin: 4px 6px; }
  .sidebar .sidebar-user-chevron { display: none; }
}

@media (max-width: 768px) {
  html, body { overflow-x: hidden; max-width: 100vw; }
  .app-shell { overflow-x: hidden; }
  .sidebar { position: fixed; left: -240px; width: var(--sidebar-width); z-index: 1000; transition: left 0.3s ease; }
  .sidebar.open { left: 0; }
  .sidebar .nav-label, .sidebar .nav-section-label,
  .sidebar .sidebar-logo-text, .sidebar .sidebar-user-info { display: block; }
  .sidebar .sidebar-user-chevron { display: block; }
  .sidebar .nav-item { justify-content: flex-start; padding: 9px 12px; margin: 2px 10px; }
  .sidebar .sidebar-logo { justify-content: flex-start; padding: 20px 16px 16px; }
  .sidebar .sidebar-user { justify-content: flex-start; padding: 10px 14px; margin: 4px 10px; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999; }
  .sidebar-overlay.open { display: block; }
  .hamburger { display: flex; }
  .grid-cols-4 { grid-template-columns: 1fr 1fr; }
  .grid-cols-3 { grid-template-columns: 1fr 1fr; }
  .grid-cols-2 { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
  .main-wrapper { overflow-x: hidden; }
  .main-content { overflow-x: hidden; }
  .page-container { padding: 16px; max-width: 100%; width: 100%; overflow-x: hidden; }
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card { min-width: 0; }
  .kpi-card { min-width: 0; }
}

@media (max-width: 480px) {
  .grid-cols-4, .grid-cols-3, .grid-cols-2 { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }
}

/* ── Utilities ──────────────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: 12px; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--color-border); margin: 16px 0; }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.bg-warning-light { background: #FFF3CD; border-radius: var(--radius-md); }

/* ── App Shell Layout ───────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--color-bg);
}

.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--color-bg);
}

.page-container {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ── Topbar extras ──────────────────────────────────────────── */
.topbar-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
}
.topbar-menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: all 0.2s;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  position: relative;
}

@media (max-width: 768px) {
  .topbar-menu-btn { display: flex; }
}

/* ── Notification Bell ──────────────────────────────────────── */
.notif-bell {
  position: relative;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  user-select: none;
}
.notif-bell:hover { background: var(--color-surface); }

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--color-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

/* ── Notification Dropdown extras ───────────────────────────── */
.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--color-border);
}

.notif-content {
  flex: 1;
  min-width: 0;
}

/* ── Nav Logout ─────────────────────────────────────────────── */
.nav-logout {
  color: rgba(255,255,255,0.45) !important;
}
.nav-logout:hover {
  color: #ff6b6b !important;
  background: rgba(239,68,68,0.10) !important;
}

/* ── Sidebar overlay (visible class for JS toggle) ──────────── */
.sidebar-overlay.visible { display: block; }

/* ── Online status dots ──────────────────────────────────────── */
.online-dot  { display:inline-block; width:8px; height:8px; border-radius:50%; background:#10B981; flex-shrink:0; }
.offline-dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:#D1D5DB; flex-shrink:0; }
.status-online  { display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:600; color:#10B981; white-space:nowrap; }
.status-offline { display:inline-flex; align-items:center; gap:5px; font-size:11px; color:var(--color-text-muted); white-space:nowrap; }
