/* ══════════════════════════════════════════════════════════════════════
   InsightForge v3 — Design System
   Light mode · Enterprise SaaS · White-label ready
══════════════════════════════════════════════════════════════════════ */

:root {
  /* Brand */
  --brand-primary: #155EEF;
  --brand-primary-hover: #1151d6;
  --brand-primary-light: #EFF6FF;
  --brand-secondary: #7C3AED;
  --brand-secondary-light: #EDE9FE;

  /* Layout */
  --brand-bg: #F8FAFC;
  --brand-surface: #FFFFFF;
  --brand-border: #E2E8F0;
  --brand-border-strong: #CBD5E1;
  --brand-sidebar-bg: #FFFFFF;
  --brand-topbar-bg: #FFFFFF;

  /* Typography */
  --text-primary: #0F172A;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --text-inverse: #FFFFFF;

  /* Statuts */
  --status-draft-bg: #EFF6FF;
  --status-draft-text: #1D4ED8;
  --status-draft-border: #BFDBFE;

  --status-reviewed-bg: #DCFCE7;
  --status-reviewed-text: #15803D;
  --status-reviewed-border: #BBF7D0;

  --status-validated-bg: #D1FAE5;
  --status-validated-text: #047857;
  --status-validated-border: #A7F3D0;

  --status-published-bg: #EDE9FE;
  --status-published-text: #6D28D9;
  --status-published-border: #DDD6FE;

  --status-warning-bg: #FEF3C7;
  --status-warning-text: #D97706;
  --status-warning-border: #FDE68A;

  --status-error-bg: #FEE2E2;
  --status-error-text: #DC2626;
  --status-error-border: #FECACA;

  --status-pending-bg: #F1F5F9;
  --status-pending-text: #64748B;
  --status-pending-border: #E2E8F0;

  --status-synced-bg: #ECFDF5;
  --status-synced-text: #059669;
  --status-synced-border: #A7F3D0;

  /* Dimensions */
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.04);

  /* White-label overrides (modifiable) */
  --wl-app-name: "InsightForge";
  --wl-primary: var(--brand-primary);
  --wl-company: "InsightForge";
}

/* ── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--brand-bg);
  color: var(--text-primary);
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ══════════════════════════════════════════════════════════════════════
   APP SHELL
══════════════════════════════════════════════════════════════════════ */
.v3-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.v3-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════════════
   TOPBAR
══════════════════════════════════════════════════════════════════════ */
.v3-topbar {
  height: var(--topbar-height);
  background: var(--brand-topbar-bg);
  border-bottom: 1px solid var(--brand-border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 1rem;
  flex-shrink: 0;
  z-index: 100;
}

.v3-topbar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  flex-shrink: 0;
}

.v3-topbar-logo-icon {
  width: 28px;
  height: 28px;
  background: var(--brand-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.8rem;
  font-weight: 800;
}

.v3-topbar-divider {
  width: 1px;
  height: 20px;
  background: var(--brand-border);
  flex-shrink: 0;
}

.v3-topbar-project {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.v3-topbar-project-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.v3-topbar-project-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v3-topbar-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.v3-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.v3-notif-btn {
  position: relative;
  width: 32px;
  height: 32px;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: background .15s;
}
.v3-notif-btn:hover { background: var(--brand-bg); }

.v3-notif-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  background: #EF4444;
  border-radius: 50%;
  border: 1.5px solid white;
}

.v3-user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  transition: background .15s;
}
.v3-user-chip:hover { background: var(--brand-bg); }

.v3-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.v3-user-info { text-align: left; }
.v3-user-name { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); display: block; }
.v3-user-role { font-size: 0.7rem; color: var(--text-muted); display: block; }

/* ══════════════════════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════════════════════ */
.v3-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--brand-sidebar-bg);
  border-right: 1px solid var(--brand-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.v3-sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.v3-nav-group {
  margin-top: 1rem;
  margin-bottom: 0.25rem;
  padding: 0 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.v3-nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.83rem;
  font-weight: 500;
  transition: background .12s, color .12s;
  cursor: pointer;
  white-space: nowrap;
}
.v3-nav-item:hover { background: var(--brand-bg); color: var(--text-primary); }
.v3-nav-item.active {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  font-weight: 600;
}

.v3-nav-icon {
  width: 18px;
  text-align: center;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.v3-nav-pill {
  margin-left: auto;
  background: var(--brand-border);
  color: var(--text-secondary);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
}
.v3-nav-item.active .v3-nav-pill {
  background: var(--brand-primary);
  color: white;
}

.v3-nav-warn-pill {
  margin-left: auto;
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

.v3-sidebar-project-card {
  margin: 0.5rem;
  padding: 0.75rem;
  background: var(--brand-bg);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  font-size: 0.75rem;
}

.v3-sidebar-project-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.v3-sidebar-project-name {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-primary);
  margin-bottom: 0.125rem;
}

.v3-sidebar-project-meta {
  color: var(--text-muted);
  font-size: 0.72rem;
  margin-bottom: 0.5rem;
}

.v3-sidebar-project-link {
  color: var(--brand-primary);
  font-size: 0.72rem;
  font-weight: 500;
}
.v3-sidebar-project-link:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════════════════════════════════ */
.v3-main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.v3-page {
  flex: 1;
  padding: 1.5rem 2rem;
  max-width: 1600px;
  width: 100%;
}

.v3-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.v3-page-header-left { flex: 1; min-width: 0; }

.v3-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}
.v3-breadcrumb a { color: var(--brand-primary); }
.v3-breadcrumb a:hover { text-decoration: underline; }
.v3-breadcrumb-sep { color: var(--brand-border-strong); }

.v3-page-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.v3-page-subtitle {
  font-size: 0.83rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.v3-page-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════
   BADGES & STATUS
══════════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid transparent;
}
.badge-sm { font-size: 0.65rem; padding: 1px 6px; }
.badge-draft { background: var(--status-draft-bg); color: var(--status-draft-text); border-color: var(--status-draft-border); }
.badge-reviewed { background: var(--status-reviewed-bg); color: var(--status-reviewed-text); border-color: var(--status-reviewed-border); }
.badge-validated { background: var(--status-validated-bg); color: var(--status-validated-text); border-color: var(--status-validated-border); }
.badge-published { background: var(--status-published-bg); color: var(--status-published-text); border-color: var(--status-published-border); }
.badge-warning { background: var(--status-warning-bg); color: var(--status-warning-text); border-color: var(--status-warning-border); }
.badge-error { background: var(--status-error-bg); color: var(--status-error-text); border-color: var(--status-error-border); }
.badge-pending { background: var(--status-pending-bg); color: var(--status-pending-text); border-color: var(--status-pending-border); }
.badge-synced { background: var(--status-synced-bg); color: var(--status-synced-text); border-color: var(--status-synced-border); }
.badge-primary { background: var(--brand-primary-light); color: var(--brand-primary); border-color: #BFDBFE; }
.badge-purple { background: var(--brand-secondary-light); color: var(--brand-secondary); border-color: #DDD6FE; }
.badge-neutral { background: var(--brand-bg); color: var(--text-secondary); border-color: var(--brand-border); }

/* Mode badge */
.badge-mode { background: #F0FDF4; color: #166534; border-color: #BBF7D0; }
.badge-role { background: #EFF6FF; color: #1E40AF; border-color: #BFDBFE; }
.badge-readonly { background: var(--status-warning-bg); color: var(--status-warning-text); border-color: var(--status-warning-border); }

/* ══════════════════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius);
  font-size: 0.83rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
  cursor: pointer;
  line-height: 1.4;
}
.btn-sm { padding: 0.3rem 0.625rem; font-size: 0.78rem; }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.72rem; }

.btn-primary {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
}
.btn-primary:hover { background: var(--brand-primary-hover); border-color: var(--brand-primary-hover); }

.btn-secondary {
  background: white;
  color: var(--text-primary);
  border-color: var(--brand-border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--brand-bg); border-color: var(--brand-border-strong); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--brand-bg); color: var(--text-primary); }

.btn-danger {
  background: var(--status-error-bg);
  color: var(--status-error-text);
  border-color: var(--status-error-border);
}
.btn-danger:hover { background: #FEE2E2; }

.btn-success {
  background: var(--status-validated-bg);
  color: var(--status-validated-text);
  border-color: var(--status-validated-border);
}

.btn-icon { padding: 0.4rem; width: 32px; height: 32px; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ══════════════════════════════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════════════════════════════ */
.card {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--brand-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-body { padding: 1.25rem; }
.card-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--brand-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ══════════════════════════════════════════════════════════════════════
   KPI CARDS
══════════════════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.125rem;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 0.375rem;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.kpi-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.kpi-icon {
  font-size: 1.25rem;
  margin-bottom: 0.375rem;
}

.kpi-card-warning { border-color: var(--status-warning-border); background: var(--status-warning-bg); }
.kpi-card-warning .kpi-value { color: var(--status-warning-text); }
.kpi-card-success { border-color: var(--status-validated-border); }
.kpi-card-success .kpi-value { color: var(--status-validated-text); }
.kpi-card-primary { border-color: #BFDBFE; }
.kpi-card-primary .kpi-value { color: var(--brand-primary); }

/* ══════════════════════════════════════════════════════════════════════
   WORKFLOW STEPPER
══════════════════════════════════════════════════════════════════════ */
.v3-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.v3-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.v3-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  border: 2px solid var(--brand-border);
  background: var(--brand-surface);
  color: var(--text-muted);
  flex-shrink: 0;
}
.v3-step-dot.done { background: var(--status-validated-bg); border-color: var(--status-validated-text); color: var(--status-validated-text); }
.v3-step-dot.active { background: var(--brand-primary); border-color: var(--brand-primary); color: white; }
.v3-step-dot.warn { background: var(--status-warning-bg); border-color: var(--status-warning-text); color: var(--status-warning-text); }

.v3-step-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.v3-step-dot.done ~ .v3-step-label { color: var(--status-validated-text); }
.v3-step-dot.active ~ .v3-step-label { color: var(--brand-primary); }

.v3-step-connector {
  flex: 1;
  min-width: 1.5rem;
  height: 2px;
  background: var(--brand-border);
  margin: 0 0.5rem;
}
.v3-step-connector.done { background: var(--status-validated-text); }

/* ══════════════════════════════════════════════════════════════════════
   DATA TABLE
══════════════════════════════════════════════════════════════════════ */
.v3-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--brand-border);
  background: var(--brand-surface);
  box-shadow: var(--shadow-sm);
}

.v3-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.v3-table thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--brand-border);
  background: var(--brand-bg);
  white-space: nowrap;
}

.v3-table thead th:first-child { border-radius: var(--radius-lg) 0 0 0; }
.v3-table thead th:last-child { border-radius: 0 var(--radius-lg) 0 0; }

.v3-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--brand-border);
  color: var(--text-primary);
  vertical-align: middle;
}

.v3-table tbody tr:last-child td { border-bottom: none; }
.v3-table tbody tr:hover td { background: var(--brand-bg); }
.v3-table tbody tr.selected td { background: var(--brand-primary-light); }

.v3-table-cell-muted { color: var(--text-muted); font-size: 0.78rem; }
.v3-table-cell-mono { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; }

.v3-table-checkbox { width: 40px; text-align: center; }
.v3-table-actions { width: 120px; text-align: right; white-space: nowrap; }

/* ══════════════════════════════════════════════════════════════════════
   TABS
══════════════════════════════════════════════════════════════════════ */
.v3-tabs {
  display: flex;
  border-bottom: 1px solid var(--brand-border);
  gap: 0;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.v3-tab {
  padding: 0.625rem 1rem;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.v3-tab:hover { color: var(--text-primary); }
.v3-tab.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); font-weight: 600; }
.v3-tab-count {
  background: var(--brand-border);
  color: var(--text-secondary);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
}
.v3-tab.active .v3-tab-count { background: var(--brand-primary); color: white; }

/* ══════════════════════════════════════════════════════════════════════
   FILTERS BAR
══════════════════════════════════════════════════════════════════════ */
.v3-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.v3-search {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
  position: relative;
}

.v3-search-icon {
  position: absolute;
  left: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.8rem;
  pointer-events: none;
}

.v3-input {
  width: 100%;
  padding: 0.4rem 0.75rem 0.4rem 2rem;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  background: var(--brand-surface);
  font-size: 0.83rem;
  color: var(--text-primary);
  transition: border-color .15s;
}
.v3-input:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(21,94,239,.08); }

.v3-select {
  padding: 0.4rem 2rem 0.4rem 0.75rem;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  background: var(--brand-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 8px center;
  font-size: 0.83rem;
  color: var(--text-primary);
  appearance: none;
  cursor: pointer;
  transition: border-color .15s;
}
.v3-select:focus { outline: none; border-color: var(--brand-primary); }

/* ══════════════════════════════════════════════════════════════════════
   SECTION / GRID LAYOUTS
══════════════════════════════════════════════════════════════════════ */
.v3-section { margin-bottom: 1.5rem; }

.v3-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.v3-section-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.v3-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.v3-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.v3-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

/* Main + sidebar layout */
.v3-split { display: grid; grid-template-columns: 1fr 340px; gap: 1.25rem; align-items: start; }

/* FSD 3-col : panneau avec scroll autonome intentionnel (tree + détail + qualité) */
.v3-split-3col {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  gap: 1rem;
  align-items: start;
  height: calc(100vh - var(--topbar-height) - 9rem);
  overflow: hidden;
}
.v3-split-panel { overflow-y: auto; height: 100%; padding-right: 2px; scrollbar-width: thin; scrollbar-color: var(--brand-border-strong) transparent; }
.v3-split-panel::-webkit-scrollbar { width: 4px; }

/* Sidebar scrollbar discret */
.v3-sidebar { scrollbar-width: thin; scrollbar-color: var(--brand-border-strong) transparent; }
.v3-sidebar::-webkit-scrollbar { width: 4px; }

/* ══════════════════════════════════════════════════════════════════════
   WORKFLOW STEPPER — HORIZONTAL (WORKSPACE)
══════════════════════════════════════════════════════════════════════ */
.workflow-bar {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-lg);
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  gap: 0;
}

.wf-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  cursor: default;
}

.wf-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  border: 2px solid var(--brand-border);
  color: var(--text-muted);
  background: var(--brand-surface);
  flex-shrink: 0;
}
.wf-step-num.done { background: #ECFDF5; border-color: #059669; color: #059669; }
.wf-step-num.active { background: var(--brand-primary); border-color: var(--brand-primary); color: white; }
.wf-step-num.warn { background: var(--status-warning-bg); border-color: var(--status-warning-text); color: var(--status-warning-text); }

.wf-step-info { }
.wf-step-name { font-size: 0.75rem; font-weight: 600; color: var(--text-primary); }
.wf-step-sub { font-size: 0.68rem; color: var(--text-muted); }

.wf-connector { flex: 1; min-width: 20px; height: 1px; background: var(--brand-border); margin: 0 0.5rem; }
.wf-connector.done { background: #059669; }

/* ══════════════════════════════════════════════════════════════════════
   ACTION CARDS (import types)
══════════════════════════════════════════════════════════════════════ */
.import-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.import-card {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.import-card:hover { border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(21,94,239,.06); }

.import-card-icon {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-bg);
  border-radius: var(--radius);
}

.import-card-title { font-size: 0.83rem; font-weight: 700; color: var(--text-primary); }
.import-card-desc { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.4; flex: 1; }
.import-card-action { margin-top: 0.25rem; }

/* ══════════════════════════════════════════════════════════════════════
   TRACEABILITY / PANEL
══════════════════════════════════════════════════════════════════════ */
.trace-chain {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.trace-node {
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  background: var(--brand-surface);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-primary);
}
.trace-arrow { color: var(--text-muted); font-size: 0.8rem; }

/* ══════════════════════════════════════════════════════════════════════
   ACTIVITY FEED
══════════════════════════════════════════════════════════════════════ */
.activity-list { display: flex; flex-direction: column; gap: 0.75rem; }
.activity-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-primary);
  margin-top: 0.375rem;
  flex-shrink: 0;
}
.activity-dot-warn { background: var(--status-warning-text); }
.activity-dot-success { background: var(--status-validated-text); }
.activity-content { flex: 1; }
.activity-text { font-size: 0.8rem; color: var(--text-primary); }
.activity-time { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.1rem; }

/* ══════════════════════════════════════════════════════════════════════
   RECOMMENDED ACTIONS
══════════════════════════════════════════════════════════════════════ */
.action-list { display: flex; flex-direction: column; gap: 0.5rem; }
.action-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  transition: border-color .15s;
}
.action-item:hover { border-color: var(--brand-primary); }
.action-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.action-item-icon-blue { background: var(--brand-primary-light); }
.action-item-icon-yellow { background: var(--status-warning-bg); }
.action-item-icon-green { background: var(--status-validated-bg); }
.action-item-body { flex: 1; }
.action-item-title { font-size: 0.83rem; font-weight: 600; color: var(--text-primary); }
.action-item-desc { font-size: 0.75rem; color: var(--text-secondary); }

/* ══════════════════════════════════════════════════════════════════════
   MODAL / OVERLAY
══════════════════════════════════════════════════════════════════════ */
.v3-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.4);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.v3-modal {
  background: var(--brand-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--brand-border);
}

.v3-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--brand-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.v3-modal-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.v3-modal-body { padding: 1.5rem; flex: 1; overflow-y: auto; }
.v3-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--brand-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Modal stepper */
.modal-stepper {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.modal-step {
  flex: 1;
  padding: 0.5rem 0.75rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--brand-bg);
  border-right: 1px solid var(--brand-border);
}
.modal-step:last-child { border-right: none; }
.modal-step.active { background: var(--brand-primary); color: white; }
.modal-step.done { background: var(--status-validated-bg); color: var(--status-validated-text); }

/* ══════════════════════════════════════════════════════════════════════
   FSD TREE
══════════════════════════════════════════════════════════════════════ */
.fsd-tree { font-size: 0.8rem; }
.fsd-node {
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--text-secondary);
  transition: background .1s;
}
.fsd-node:hover { background: var(--brand-bg); }
.fsd-node.active { background: var(--brand-primary-light); color: var(--brand-primary); font-weight: 600; }
.fsd-node-epic { font-weight: 700; color: var(--text-primary); }
.fsd-node-feature { padding-left: 1.25rem; }
.fsd-node-us { padding-left: 2.25rem; color: var(--text-secondary); }
.fsd-node-count {
  margin-left: auto;
  background: var(--brand-border);
  color: var(--text-muted);
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 999px;
}
.fsd-node.active .fsd-node-count { background: var(--brand-primary); color: white; }

/* ══════════════════════════════════════════════════════════════════════
   FORM CONTROLS
══════════════════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.375rem; }
.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  background: var(--brand-surface);
  font-size: 0.83rem;
  color: var(--text-primary);
  transition: border-color .15s;
}
.form-input:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(21,94,239,.08); }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

.form-radio-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-radio-option {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--brand-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s;
}
.form-radio-option:hover { border-color: var(--brand-primary); }
.form-radio-option.selected { border-color: var(--brand-primary); background: var(--brand-primary-light); }
.form-radio-option input { margin-top: 2px; accent-color: var(--brand-primary); }
.form-radio-label { font-size: 0.83rem; font-weight: 600; color: var(--text-primary); }
.form-radio-desc { font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.125rem; }

/* ══════════════════════════════════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════════════════════════════════ */
.v3-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.v3-empty-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.v3-empty-title { font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.375rem; }
.v3-empty-desc { font-size: 0.83rem; }

/* ══════════════════════════════════════════════════════════════════════
   READONLY MODE — Rôle QA
══════════════════════════════════════════════════════════════════════ */

/* Bannière lecture seule */
.v3-readonly-bar {
  display: none;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 1.25rem;
  background: var(--status-warning-bg);
  border-bottom: 1px solid var(--status-warning-border);
  font-size: 0.8rem;
  color: var(--status-warning-text);
  font-weight: 500;
}

/* Mode QA actif */
.role-qa .v3-readonly-bar { display: flex !important; }

/* Masquer les actions d'édition */
.role-qa .qa-edit-hidden { display: none !important; }

/* Désactiver sans masquer (ex : boutons de validation) */
.role-qa .qa-edit-disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
  filter: grayscale(30%);
}

/* Bouton primaire désactivé en QA */
.role-qa .btn-primary {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

/* Import cards désactivées en QA */
.role-qa .import-card {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

/* ══════════════════════════════════════════════════════════════════════
   MISC
══════════════════════════════════════════════════════════════════════ */
.v3-divider { height: 1px; background: var(--brand-border); margin: 1rem 0; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.text-success { color: var(--status-validated-text); }
.text-warning { color: var(--status-warning-text); }
.text-danger { color: var(--status-error-text); }
.text-blue { color: var(--brand-primary); }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-auto { margin-top: auto; }
.w-full { width: 100%; }

.close-btn {
  width: 28px; height: 28px;
  border: none; background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.close-btn:hover { background: var(--brand-bg); color: var(--text-primary); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--brand-border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .v3-split { grid-template-columns: 1fr; }
  .v3-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .v3-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .v3-sidebar { display: none; }
  .v3-page { padding: 1rem; }
  .v3-grid-2 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
