/* ════════════════════════════════════════════════════════════════════
   CDR SaaS — Thème « Ardoise » — v7.9.0
   ════════════════════════════════════════════════════════════════════
   Design : minimalisme suisse clair. Fond blanc cassé froid, surfaces
   blanches, filets 1px, UN accent indigo utilisé avec parcimonie,
   ombres quasi inexistantes, rayons 6-8px, chiffres tabulaires.
   Sidebar CLAIRE. Statuts sémantiques distincts de la marque.
   ════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

:root {
  /* Palette — encre/ardoise (les noms navy-* sont conservés pour compat) */
  --navy-900: #141b24;
  --navy-800: #1c2530;
  --navy-700: #2a3441;
  --navy-600: #3e4956;
  --navy-500: #54606e;
  --navy-400: #6b7787;

  --primary:        #3d46c4;
  --primary-hover:  #333ba8;
  --primary-active: #2b3190;
  --primary-50:     #ecedfb;
  --primary-100:    #dfe1f8;
  --primary-200:    #c6c9f0;

  --slate-50:  #f8f9fb;
  --slate-100: #f3f5f7;
  --slate-150: #eff2f5;
  --slate-200: #eaedf1;
  --slate-300: #dde3e9;
  --slate-400: #93a0ae;
  --slate-500: #6b7787;
  --slate-600: #54606e;
  --slate-700: #3e4956;
  --slate-800: #2a3441;
  --slate-900: #1c2530;

  --green-50:  #e6f5ee;
  --green-100: #d2eddf;
  --green-500: #1e9e6a;
  --green-600: #157a50;
  --green-700: #157a50;

  --amber-50:  #faf1df;
  --amber-100: #f4e3c2;
  --amber-500: #c98a22;
  --amber-600: #906214;
  --amber-700: #906214;
  --amber-900: #6e4a0e;

  --red-50:  #fbecea;
  --red-100: #f6d8d4;
  --red-200: #efbdb7;
  --red-500: #d0574a;
  --red-600: #c13e31;
  --red-700: #a32e23;
  --red-900: #7a241b;

  --purple-100: #ede7f8;
  --purple-500: #8348b5;
  --purple-700: #67368f;

  /* Tokens sémantiques */
  --bg-page:       #fbfbfc;
  --bg-surface:    #ffffff;
  --bg-elevated:   #ffffff;
  --bg-muted:      #f8f9fb;
  --bg-hover:      #f3f5f7;

  --text-primary:   #1c2530;
  --text-secondary: #3e4956;
  --text-tertiary:  #54606e;
  --text-muted:     #54606e;   /* contraste RGAA >= 4.5 sur blanc et fond teinté */
  --text-on-dark:   #ffffff;

  --border-subtle:  #eaedf1;
  --border-default: #dde3e9;
  --border-strong:  #aeb9c4;

  /* Sidebar — CLAIRE (Ardoise) */
  --sidebar-bg-start:     #ffffff;
  --sidebar-bg-end:       #ffffff;
  --sidebar-bg:           linear-gradient(180deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
  --sidebar-ink:          #1c2530;
  --sidebar-text:         #54606e;
  --sidebar-text-muted:   #6b7787;
  --sidebar-text-section: #6b7787;
  --sidebar-hover:        #f3f5f7;
  --sidebar-active-bg:    #ecedfb;
  --sidebar-active-bar:   #3d46c4;
  --sidebar-border:       #eaedf1;

  /* Statuts */
  --status-pending:  #93a0ae;
  --status-progress: #906214;
  --status-passed:   #157a50;
  --status-failed:   #c13e31;
  --status-blocked:  #8348b5;
  --status-ignored:  #6b7787;

  --sev-s1: #c13e31;
  --sev-s2: #906214;
  --sev-s3: #3d46c4;
  --sev-s4: #93a0ae;

  /* Shadows — quasi inexistantes (cartes = filet 1px) ; les éléments
     flottants (modales, menus, toasts) gardent une ombre douce */
  --shadow-xs: none;
  --shadow-sm: none;
  --shadow-md: 0 1px 2px rgba(28, 37, 48, 0.04);
  --shadow-lg: 0 8px 24px -12px rgba(28, 37, 48, 0.18);
  --shadow-xl: 0 16px 40px -16px rgba(28, 37, 48, 0.22);
  --shadow-primary: none;

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 7px;
  --radius-lg: 8px;
  --radius-xl: 8px;
  --radius-2xl: 10px;
  --radius-full: 9999px;

  /* Motion */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast:   150ms;
  --duration-normal: 200ms;
  --duration-slow:   300ms;

  /* Layout */
  --sidebar-width:           240px;
  --sidebar-width-collapsed: 64px;
  --topbar-height:           60px;
  --content-padding:         24px;

  /* Compat ancien code */
  --theme-accent: var(--primary);
  --blue-50:  var(--primary-50);
  --blue-100: var(--primary-100);
  --blue-500: var(--primary);
  --blue-600: var(--primary-hover);
}

/* ─── BASE ─── */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg-page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  letter-spacing: -0.005em;
}

.mono { font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace; }

/* ─── ACCESSIBILITÉ (RGAA) ─── */
/* Focus visible global : anneau net sur tout élément interactif au clavier.
   :focus-visible n'apparaît qu'à la navigation clavier, pas au clic souris. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
.nav-item:focus-visible,
.status-pill:focus-visible,
[role="button"]:focus-visible,
[onclick]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
/* Sidebar : anneau accent (identique au reste, la sidebar est claire) */
.sidebar a:focus-visible,
.sidebar button:focus-visible,
.sidebar .nav-item:focus-visible {
  outline-color: var(--sidebar-active-bar);
}

/* Lien d'évitement (RGAA 12.7) : masqué jusqu'au focus clavier */
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100000;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: top var(--duration-fast) var(--ease-out);
}
.skip-link:focus {
  top: 12px;
}

/* Classe utilitaire pour texte réservé aux lecteurs d'écran */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.4px; color: var(--text-primary); }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; color: var(--text-primary); }
h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.2px; color: var(--text-primary); }
h4 { font-size: 15px; font-weight: 600; color: var(--text-primary); }

::selection { background: var(--primary-100); color: var(--primary-active); }

/* ════════════════════════════════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════════════════════════════════ */

.app-layout { display: flex; min-height: 100vh; }

/* Sidebar claire (Ardoise) : blanc + filet 1px */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--duration-normal) var(--ease-in-out),
              transform var(--duration-normal) var(--ease-in-out);
  border-right: 1px solid var(--sidebar-border);
}

.sidebar.collapsed { width: var(--sidebar-width-collapsed); }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .sidebar-subtitle,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .sidebar-footer-text,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 11px;
}
.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 16px 8px;
}

.sidebar-header {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-logo-wrap {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
/* Monogramme Digitech — tuile indigo plate (sidebar + login) */
.dgt-tile{width:34px;height:34px;border-radius:8px;display:grid;place-items:center;
  background:var(--primary)}
.sidebar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--sidebar-ink);
  line-height: 1.2;
  letter-spacing: -0.1px;
}
.sidebar-subtitle {
  font-size: 10px;
  color: var(--sidebar-text-muted);
  margin-top: 2px;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.nav-section {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--sidebar-text-section);
  padding: 14px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  margin: 1px 0;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: background var(--duration-fast), color var(--duration-fast);
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-ink);
}
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--primary);
  font-weight: 600;
  border-left-color: var(--sidebar-active-bar);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding-left: 9px;
}
.nav-icon {
  width: 20px;
  font-size: 14px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.9;
}
.nav-item.active .nav-icon {
  color: var(--primary);
  opacity: 1;
}
.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-badge {
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}
.nav-badge.blue { background: var(--primary); color: white; }
.nav-badge.red  { background: var(--red-600); color: white; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--sidebar-border);
  font-size: 10px;
  color: var(--sidebar-text-muted);
  text-align: center;
  font-weight: 500;
}

.sidebar-mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 37, 48, 0.45);
  z-index: 99;
  display: none;
  backdrop-filter: blur(2px);
}

/* Topbar */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--duration-normal) var(--ease-in-out);
  background: var(--bg-page);
}
.main.expanded { margin-left: var(--sidebar-width-collapsed); }

.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.breadcrumb {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
  font-weight: 500;
}

.content-area {
  flex: 1;
  padding: var(--content-padding);
  overflow-x: auto;
}

.section { display: none; }
.section.active { display: block; animation: fade-in var(--duration-normal) var(--ease-out); }

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.section-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.2;
}
.section-title i { color: var(--primary); }
/* Eyebrow (surtitre) façon maquette Ardoise */
.dash-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 6px;
}
.dash-eyebrow:empty { display: none; }
/* Pastille de verdict de recette dans l'en-tête */
.verdict-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}
.verdict-pill .vd-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.verdict-pill .vd-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.section-desc {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
  font-weight: 500;
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scale-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* ════════════════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.1px;
  cursor: pointer;
  transition: background var(--duration-fast), border-color var(--duration-fast), box-shadow var(--duration-fast), transform var(--duration-fast);
  white-space: nowrap;
  user-select: none;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn i { font-size: 13px; }

.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn-sm i { font-size: 12px; }
.btn-xs { height: 26px; padding: 0 10px; font-size: 11.5px; gap: 5px; }
.btn-xs i { font-size: 11px; }

/* Primary (bleu Digitech) */
.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: none;
}
.btn-primary:active {
  background: var(--primary-active);
}

/* Success */
.btn-success {
  background: var(--green-600);
  color: white;
  box-shadow: none;
}
.btn-success:hover {
  background: var(--green-700);
  box-shadow: none;
}

/* Danger */
.btn-danger {
  background: var(--red-600);
  color: white;
  box-shadow: none;
}
.btn-danger:hover {
  background: var(--red-700);
  box-shadow: none;
}

/* Outline */
.btn-outline {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--text-tertiary);
}

/* Ghost / text */
.btn-ghost,
.btn-text {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover,
.btn-text:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Icon button */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--duration-fast);
}
.btn-icon:hover {
  background: var(--bg-hover);
  border-color: var(--border-default);
  color: var(--text-primary);
}
.btn-icon:active { transform: translateY(1px); }

.btn-icon-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: var(--shadow-primary);
}
.btn-icon-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: white;
  box-shadow: none;
}

.btn-icon-danger {
  color: var(--red-600);
}
.btn-icon-danger:hover {
  background: var(--red-50);
  border-color: var(--red-200, #fca5a5);
  color: var(--red-700);
}

/* FAB */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 90;
  transition: all var(--duration-fast);
}
.fab:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

/* ════════════════════════════════════════════════════════════════════
   CARDS & SURFACES
   ════════════════════════════════════════════════════════════════════ */

.card {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  overflow-y: hidden;
  transition: box-shadow var(--duration-fast);
}
.card.elevated { box-shadow: var(--shadow-sm); }
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.1px;
}
.card-body {
  padding: 16px 18px;
}

/* Card avec barre de couleur à gauche (marqueur de statut) */
.card-accent {
  border-left: 3px solid var(--primary);
}
.card-accent-success { border-left-color: var(--green-600); }
.card-accent-warning { border-left-color: var(--amber-600); }
.card-accent-danger  { border-left-color: var(--red-600); }
.card-accent-muted   { border-left-color: var(--slate-400); }

/* ════════════════════════════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════════════════════════════ */

.form-group { margin-bottom: 16px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: -0.05px;
}
.form-label.required::after {
  content: ' *';
  color: var(--red-600);
}

/* Validation : champ obligatoire non rempli (posé par markFieldError dans ui.js) */
.form-control.input-error,
.form-control.input-error:focus {
  border-color: var(--red-600);
  box-shadow: 0 0 0 3px var(--red-100);
}
.field-error-msg {
  color: var(--red-700);
  font-size: 11.5px;
  font-weight: 500;
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.field-error-msg i { font-size: 11px; }

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="url"],
input[type="search"],
textarea,
select {
  width: 100%;
  height: 36px;
  padding: 7px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
  outline: none;
}
textarea,
textarea.form-control {
  height: auto;
  min-height: 80px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}
.form-control:hover,
input:hover:not(:focus),
textarea:hover:not(:focus),
select:hover:not(:focus) {
  border-color: var(--text-tertiary);
}
.form-control:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(61, 70, 196, 0.14);
}
.form-control:disabled,
input:disabled,
select:disabled {
  background: var(--slate-50);
  color: var(--text-muted);
  cursor: not-allowed;
}
.form-control::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

select.form-control {
  appearance: none;
  background-image: 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='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0;
}


/* ════════════════════════════════════════════════════════════════════
   TABLES
   ════════════════════════════════════════════════════════════════════ */

.data-table,
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.data-table thead th,
table thead th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-muted);
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table tbody td,
table tbody td {
  padding: 11px 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}
.data-table tbody tr:last-child td,
table tbody tr:last-child td {
  border-bottom: none;
}
.data-table tbody tr,
table tbody tr {
  transition: background var(--duration-fast);
}
.data-table tbody tr:hover,
table tbody tr:hover {
  background: var(--bg-muted);
}

/* Tables larges : quand il y a beaucoup de colonnes (ex. plan de tests avec la
   colonne ACTIONS, plus fournie pour org_admin/pm), le conteneur défile
   horizontalement au lieu de rogner la dernière colonne. Tout le contenu reste
   accessible sur écran étroit comme large. */
.card:has(.data-table) {
  overflow-x: auto;
}
/* Repli pour les navigateurs sans :has() — le conteneur direct du tableau reste défilable */
.table-scroll {
  overflow-x: auto;
}

/* Tests table */
.tests-table .tc-row {
  position: relative;
  cursor: pointer;
  border-left: 3px solid var(--row-status-color, transparent);
}
.tests-table .tc-row:hover {
  background: color-mix(in srgb, var(--row-status-color, var(--primary)) 5%, var(--bg-muted));
}
.tests-table td:not(:nth-child(4)) { white-space: nowrap; }
.tests-table td:nth-child(4) {
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
  min-width: 240px;
}
.tc-fav-cell { padding-left: 14px !important; text-align: center; width: 36px; }
.tc-actions-cell {
  text-align: right;
  white-space: nowrap;
  padding-right: 12px !important;
}
.tc-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}
.tc-title-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tc-title-cell a {
  color: var(--text-primary);
  font-weight: 500;
}
.tc-title-cell a:hover {
  color: var(--primary);
  text-decoration: underline;
}
.tc-ext-ref {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* Favori */
.tc-fav-btn,
.tc-detail-fav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  transition: all var(--duration-fast);
}
.tc-fav-btn:hover,
.tc-detail-fav-btn:hover {
  background: color-mix(in srgb, var(--amber-500) 15%, transparent);
  color: var(--amber-500);
  transform: scale(1.1);
}
.tc-fav-btn.is-favorite,
.tc-detail-fav-btn.is-favorite {
  color: var(--amber-500);
}

/* Avatar */
.tester-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  overflow: hidden;
}
.tester-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: none;
}
.tester-name {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

/* ════════════════════════════════════════════════════════════════════
   MODALS
   ════════════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 37, 48, 0.45);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}
.modal-overlay.open {
  display: flex;
  animation: fade-in var(--duration-fast) var(--ease-out);
}

.modal {
  background: var(--bg-surface);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scale-in var(--duration-normal) var(--ease-out);
  border: 1px solid var(--border-subtle);
}
.modal-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-title i { color: var(--primary); }
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast);
  flex-shrink: 0;
}
.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
  overflow-wrap: break-word;   /* les longues chaînes cassent au lieu de déborder */
}
/* Anti-débordement : aucun média/tableau/bloc ne dépasse la largeur du corps de modale */
.modal-body img,
.modal-body svg,
.modal-body pre,
.modal-body canvas,
.modal-body table { max-width: 100%; }
.modal-body pre { white-space: pre-wrap; word-break: break-word; }

/* Sélecteur d'icône (modules) */
.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  max-height: 168px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-muted);
}
.m-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 15px;
  transition: border-color var(--duration-fast), background var(--duration-fast), color var(--duration-fast);
}
.m-icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.m-icon-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.modal-footer {
  padding: 12px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-muted);
}

/* ════════════════════════════════════════════════════════════════════
   PILLS, CHIPS, BADGES
   ════════════════════════════════════════════════════════════════════ */

.modules-pills-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.module-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 130ms ease, border-color 130ms ease, color 130ms ease;
  white-space: nowrap;
}
.module-pill i { font-size: 12px; color: var(--pill-mod-color, var(--primary)); }
.module-pill:hover {
  border-color: var(--pill-mod-color, var(--border-default));
  background: #F8F9FB;
  color: var(--text-primary);
}
.module-pill.active {
  background: var(--pill-mod-color, var(--primary));
  border-color: var(--pill-mod-color, var(--primary));
  color: #fff;
}
.module-pill.active i { color: #fff; }
.module-pill-count {
  background: color-mix(in srgb, currentColor 12%, transparent);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.module-pill.active .module-pill-count {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
}

.tags-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
  font-size: 12px;
}
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast);
}
.tag-pill:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.tag-pill.active {
  background: var(--amber-100);
  border-color: var(--amber-500);
  color: var(--amber-900);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 10.5px;
  font-weight: 600;
  background: var(--slate-100);
  color: var(--text-secondary);
}
.badge-success { background: var(--green-100); color: var(--green-700); }
.badge-warning { background: var(--amber-100); color: var(--amber-700); }
.badge-danger  { background: var(--red-100); color: var(--red-700); }
.badge-info    { background: var(--primary-100); color: var(--primary-active); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-secondary);
}

.module-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--primary-50);
  color: var(--primary-active);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 10.5px;
  font-weight: 700;
  font-family: ui-monospace, "SF Mono", monospace;
  border: 1px solid var(--primary-100);
}
.module-badge i {
  font-size: 10px;
  opacity: 0.7;
}

/* Module dans le plan de test : icône colorée + code + libellé lisible */
.module-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
}
.module-tag > i {
  font-size: 13px;
  flex-shrink: 0;
}
.module-tag-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.module-tag-code {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: #93A0AE;
  font-family: ui-monospace, "SF Mono", monospace;
}
.module-tag-name {
  font-size: 12px;
  font-weight: 600;
  color: #1C2530;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ════════════════════════════════════════════════════════════════════
   STATUS PILLS
   ════════════════════════════════════════════════════════════════════ */

.status-pills-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

/* Display only (modal détail) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--pill-color, var(--text-secondary)) 14%, white);
  color: var(--pill-color, var(--text-secondary));
}

/* Filtre cliquable */
.status-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--pill-color, var(--text-secondary));
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 130ms ease, border-color 130ms ease, color 130ms ease;
  white-space: nowrap;
}
.status-filter-pill:hover {
  border-color: var(--pill-color);
  background: color-mix(in srgb, var(--pill-color) 7%, white);
}
.status-filter-pill.active {
  background: var(--pill-color);
  border-color: var(--pill-color);
  color: #fff;
}
.status-filter-pill .status-pill-icon { font-size: 12px; }
.status-pill-count {
  background: color-mix(in srgb, currentColor 12%, transparent);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.status-filter-pill.active .status-pill-count {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
}
.status-pill-clear {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 12px;
  background: transparent;
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
  font-size: 11.5px;
  cursor: pointer;
  transition: all var(--duration-fast);
}
.status-pill-clear:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Cellule cliquable dans tableau */
.status-pill-cell {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  height: 26px !important;
  min-height: 26px;
  min-width: 110px;
  padding: 0 10px !important;
  background: color-mix(in srgb, var(--pill-color, var(--text-secondary)) 14%, white);
  color: var(--pill-color, var(--text-secondary));
  border: 1px solid color-mix(in srgb, var(--pill-color, var(--border-default)) 30%, transparent);
  border-radius: var(--radius-xs);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap !important;
  overflow: visible !important;
  text-decoration: none !important;
  line-height: 1 !important;
  box-sizing: border-box;
}
.status-pill-cell > * {
  text-decoration: none !important;
}
.status-pill-cell:hover {
  background: color-mix(in srgb, var(--pill-color, var(--text-secondary)) 22%, white);
}
.status-pill-cell .fa-chevron-down {
  font-size: 7px;
  opacity: 0.6;
  margin-left: 2px;
}

/* Sev / Prio */
.sev-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 10.5px;
  font-weight: 700;
  background: color-mix(in srgb, var(--sev-color, var(--primary)) 14%, white);
  color: var(--sev-color, var(--text-primary));
  border: 1px solid color-mix(in srgb, var(--sev-color, var(--border-default)) 25%, transparent);
  font-family: ui-monospace, "SF Mono", monospace;
  min-width: 28px;
}
.sev-pill-sm { font-size: 10px; min-width: 24px; padding: 1px 6px; }

.prio-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  border: none;
  white-space: nowrap;
}
.prio-pill::before {
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 9px;
}
.prio-critique { background: var(--red-100); color: var(--red-700); }
.prio-critique::before { content: "\f06a"; }
.prio-haute    { background: var(--amber-100); color: var(--amber-700); }
.prio-haute::before { content: "\f062"; }
.prio-normale  { background: var(--slate-100); color: var(--text-tertiary); }
.prio-normale::before { content: "\f068"; }
.prio-basse    { background: var(--slate-100); color: var(--text-muted); }
.prio-basse::before { content: "\f063"; }


/* ════════════════════════════════════════════════════════════════════
   KPI CARDS (barre de couleur à gauche)
   ════════════════════════════════════════════════════════════════════ */

/* KPI « Ardoise » : grille bordée jointe (filets 1px), sans icône,
   gros chiffre tabulaire, fine barre d'accent en bas. */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--bg-surface);
  border: none;
  border-radius: 0;
  padding: 18px 18px 17px;
  position: relative;
  transition: background var(--duration-fast);
}
.kpi-card:hover { background: var(--bg-muted); }
/* barre d'accent en bas, couleur = type de KPI */
.kpi-card::after {
  content: "";
  position: absolute;
  left: 18px; right: 18px; bottom: 0;
  height: 3px;
  border-radius: 2px 2px 0 0;
  background: var(--primary);
}
.kpi-card.kpi-green::after  { background: var(--green-500); }
.kpi-card.kpi-amber::after  { background: var(--amber-500); }
.kpi-card.kpi-red::after    { background: var(--red-600); }
.kpi-card.kpi-purple::after { background: var(--purple-500); }
.kpi-card.kpi-slate::after  { background: var(--slate-400); }

/* Ardoise : les KPI n'ont pas d'icône */
.kpi-icon { display: none; }

.kpi-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.kpi-value {
  font-size: 29px;
  font-weight: 650;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
}
.kpi-trend {
  font-size: 11.5px;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Mini KPI */
.kpi-mini-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.kpi-mini-label {
  font-size: 10px;
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.kpi-mini-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.4px;
}
.kpi-mini-bar {
  margin-top: 8px;
  height: 4px;
  background: var(--slate-100);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.kpi-mini-bar > div {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-out);
}

.module-card,
.user-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  transition: all var(--duration-fast);
}
.module-card:hover,
.user-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--border-default);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
}
.chart-legend > div {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ════════════════════════════════════════════════════════════════════
   FILTERS BAR
   ════════════════════════════════════════════════════════════════════ */

.filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
.filters-bar .form-control {
  height: 32px;
  flex: 0 1 200px;
  font-size: 12.5px;
  padding: 5px 10px;
}
.filter-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
  white-space: nowrap;
  text-transform: uppercase;
}
.filter-count {
  font-size: 11.5px;
  color: var(--text-tertiary);
  margin-left: auto;
  font-weight: 600;
}

/* ════════════════════════════════════════════════════════════════════
   KANBAN
   ════════════════════════════════════════════════════════════════════ */

.kanban-board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.kanban-column {
  background: var(--bg-muted);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 10px;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}
.kanban-column-header {
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--col-color, var(--border-default));
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.kanban-column-header > div {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.kanban-count {
  background: color-mix(in srgb, var(--col-color, var(--text-secondary)) 14%, transparent);
  color: var(--col-color, var(--text-secondary));
  padding: 1px 8px;
  border-radius: var(--radius-full);
  font-size: 10.5px;
  font-weight: 700;
  margin-left: auto;
}
.kanban-column-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 100px;
  border-radius: var(--radius-md);
  transition: background var(--duration-fast);
}
.kanban-column-body.drag-over {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}
.kanban-empty {
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: center;
  padding: 14px 8px;
  font-style: italic;
}
.kanban-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: grab;
  transition: all var(--duration-fast);
  box-shadow: var(--shadow-xs);
}
.kanban-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}
.kanban-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.kanban-card-ref {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: var(--text-tertiary);
  font-weight: 700;
}
.kanban-card-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.4;
}
.kanban-card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--text-tertiary);
  flex-wrap: wrap;
}
.kanban-card-author {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-tertiary);
}

/* ════════════════════════════════════════════════════════════════════
   MODAL DETAIL TC
   ════════════════════════════════════════════════════════════════════ */

.tc-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.tc-detail-card {
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.tc-detail-card-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}
.tc-detail-card-value {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tc-detail-card-value.mono {
  font-family: ui-monospace, "SF Mono", monospace;
}
.tc-detail-section {
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 10px 0;
}
.tc-detail-section-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tc-detail-section-title i { color: var(--primary); }
.tc-detail-section-body {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.tc-detail-expected {
  background: var(--green-50);
  border-color: color-mix(in srgb, var(--green-500) 30%, transparent);
  border-left: 3px solid var(--green-600);
}
.tc-detail-expected .tc-detail-section-title,
.tc-detail-expected .tc-detail-section-title i {
  color: var(--green-700);
}

.tc-steps-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tc-steps-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}
.tc-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 10.5px;
  font-weight: 700;
  flex-shrink: 0;
  font-family: system-ui, sans-serif;
}

/* Tabs */
.tc-detail-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  margin: 14px 0 10px;
  overflow-x: auto;
  gap: 0;
}
.tc-detail-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  margin-bottom: -1px;
  transition: color var(--duration-fast);
  white-space: nowrap;
  font-family: inherit;
}
.tc-detail-tab:hover {
  color: var(--text-primary);
}
.tc-detail-tab.active {
  color: var(--primary);
}
.tc-detail-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}
.tc-detail-tab i { font-size: 12px; }
.tc-detail-tab-content {
  padding: 8px 0 0;
  min-height: 80px;
}

/* History items */
.tc-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tc-history-item {
  position: relative;
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--row-status-color, transparent);
  border-radius: var(--radius-md);
}

/* Comments */
.tc-comment-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: flex-end;
}
.tc-comment-form textarea { flex: 1; resize: vertical; }
.tc-comments-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tc-comment {
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.tc-comment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text-primary);
}
.tc-comment-head strong { font-weight: 700; }
.tc-comment-body {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Links */
.tc-link-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.tc-links-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tc-link-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 12.5px;
}
.tc-link-url {
  color: var(--primary);
  font-weight: 500;
  flex: 1;
}
.tc-link-url:hover { text-decoration: underline; }


/* ════════════════════════════════════════════════════════════════════
   EMPTY STATES
   ════════════════════════════════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
}
.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.4;
  color: var(--text-muted);
}
.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.empty-state-message {
  font-size: 13px;
  color: var(--text-tertiary);
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ════════════════════════════════════════════════════════════════════
   TOASTS
   ════════════════════════════════════════════════════════════════════ */

#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
#toast-container > div {
  pointer-events: auto;
  background: var(--navy-800);
  color: white;
  padding: 12px 16px !important;
  border-radius: var(--radius-md) !important;
  font-size: 13px;
  min-width: 280px;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ════════════════════════════════════════════════════════════════════
   QUICK STATUS MENU
   ════════════════════════════════════════════════════════════════════ */

.quick-status-menu {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  animation: scale-in var(--duration-fast) var(--ease-out);
  transform-origin: top left;
}
.quick-status-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font-size: 12.5px;
  color: var(--text-primary);
  transition: background var(--duration-fast);
  font-weight: 500;
  font-family: inherit;
}
.quick-status-menu button:hover {
  background: color-mix(in srgb, var(--pill-color, var(--text-secondary)) 10%, transparent);
  color: var(--pill-color, var(--text-primary));
}
.quick-status-menu-icon { font-size: 13px; }

/* ════════════════════════════════════════════════════════════════════
   AUDIT, BULK, MISC
   ════════════════════════════════════════════════════════════════════ */

.audit-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
}

.bulk-bar,
.bulk-action-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy-800);
  color: white;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 800;
  min-width: 380px;
  border: 1px solid var(--border-subtle);
}
.bulk-action-bar-left,
.bulk-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.screenshot-zone {
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-muted);
  transition: all var(--duration-fast);
}
.screenshot-zone:hover {
  background: var(--primary-50);
  border-color: var(--primary);
}
.screenshot-preview {
  position: relative;
  display: inline-block;
}
.screenshot-preview img {
  max-width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.screenshot-actions,
.screenshot-remove {
  position: absolute;
  top: 8px;
  right: 8px;
}

/* Alerts */
.alert-info {
  background: var(--primary-50);
  color: var(--primary-active);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 3px solid var(--primary);
}
.alert-error {
  background: var(--red-50);
  color: var(--red-700);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  border-left: 3px solid var(--red-600);
}

.info-banner {
  background: var(--primary-50);
  color: var(--primary-active);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  border-left: 3px solid var(--primary);
}
.info-banner-icon {
  font-size: 16px;
  color: var(--primary);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-primary);
  transition: background var(--duration-fast);
}
.user-menu-item:hover { background: var(--bg-hover); }

.view-toggle {
  display: inline-flex;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border-subtle);
}
.view-toggle-btn {
  padding: 5px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11.5px;
  color: var(--text-tertiary);
  transition: all var(--duration-fast);
  font-weight: 600;
  font-family: inherit;
}
.view-toggle-btn:hover { color: var(--text-primary); }
.view-toggle-btn.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

.theme-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}
.theme-option {
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: border-color var(--duration-fast);
  background: var(--bg-surface);
}
.theme-option:hover { border-color: var(--primary); }
.theme-option.selected {
  border-color: var(--primary);
  background: var(--primary-50);
}

.campaign-templates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.campaign-template {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: all var(--duration-fast);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.campaign-template:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.campaign-template-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--primary-50);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.campaign-template-text { flex: 1; }
.campaign-template-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.campaign-template-desc {
  font-size: 11.5px;
  color: var(--text-tertiary);
}

/* Barre de progression — règle spécifique pour ne pas affecter les pills statut */
.progress-bar-container,
.kpi-card .progress,
.module-card .progress,
.card-body > .progress {
  background: var(--slate-100);
  border-radius: var(--radius-full);
  height: 6px;
  overflow: hidden;
}
.progress-bar-container > div,
.kpi-card .progress > div,
.module-card .progress > div,
.card-body > .progress > div,
.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-out);
}

hr,
.divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 14px 0;
}

/* Density compact */
body.density-compact .data-table thead th,
body.density-compact .data-table tbody td,
body.density-compact table thead th,
body.density-compact table tbody td {
  padding: 7px 10px;
  font-size: 12px;
}
body.density-compact .btn { height: 32px; padding: 0 14px; }
body.density-compact .btn-sm { height: 26px; padding: 0 10px; }
body.density-compact .nav-item { padding: 7px 10px; }

body.no-animations *,
body.no-animations *::before,
body.no-animations *::after {
  animation-duration: 0s !important;
  animation-delay: 0s !important;
  transition-duration: 0s !important;
}

/* ════════════════════════════════════════════════════════════════════
   SCROLLBARS
   ════════════════════════════════════════════════════════════════════ */

*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
  background-clip: padding-box;
  border: 2px solid transparent;
}

/* Sidebar scrollbar (sidebar claire) */
.sidebar ::-webkit-scrollbar-thumb {
  background: var(--slate-300);
}
.sidebar ::-webkit-scrollbar-thumb:hover {
  background: var(--slate-400);
}

/* Focus rings */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Animations row flash */
@keyframes row-flash {
  0%, 100% { background: transparent; }
  30%      { background: color-mix(in srgb, var(--primary) 14%, transparent); }
}
.row-flash {
  animation: row-flash 1.5s ease;
}

/* ════════════════════════════════════════════════════════════════════
   PRINT
   ════════════════════════════════════════════════════════════════════ */

@media print {
  .sidebar, .topbar, .modal-overlay, .fab, .bulk-bar,
  #toast-container, .filters-bar, .modules-pills-row,
  .tags-row, .status-pills-row, .tc-actions-cell { display: none !important; }
  .main { margin-left: 0 !important; }
  .content-area { padding: 0 !important; }
  body { background: white !important; color: black !important; }
  .card { border: 1px solid #dde3e9 !important; box-shadow: none !important; page-break-inside: avoid; }
  table thead th { background: #f3f5f7 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════════ */

@media (max-width: 1280px) {
  .grid-4, .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kanban-board { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
    z-index: 200;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.collapsed { width: var(--sidebar-width); }
  .main, .main.expanded { margin-left: 0 !important; }
  .kanban-board { grid-template-columns: repeat(2, 1fr); }
  .modal { width: 92vw; }
}

@media (max-width: 768px) {
  :root { --content-padding: 16px; }
  .topbar { padding: 0 12px; gap: 8px; }
  #topbar-campaign, #current-date, #topbar-progress { display: none !important; }
  .breadcrumb { display: none; }
  .page-title { font-size: 14px; }
  .section-header { gap: 12px; }
  .section-header > div:first-child { flex: 1 1 100%; }
  .section-title { font-size: 17px; }
  .grid-2, .grid-4, .kpi-grid { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; gap: 12px; }
  .filters-bar { gap: 6px; }
  .filters-bar .form-control { flex: 1 1 calc(50% - 6px); }
  /* Colonnes du plan de test : plus masquées sur écran étroit — le tableau
     défile horizontalement (voir .card:has(.data-table)) pour tout afficher. */
  .tc-detail-grid { grid-template-columns: 1fr; }
  .modal {
    width: 96vw !important;
    max-width: 96vw !important;
    max-height: 92vh;
    border-radius: var(--radius-xl);
  }
  .modal-header { padding: 14px 16px; }
  .modal-title { font-size: 15px; }
  .modal-body { padding: 14px 16px; }
  .modal-footer { padding: 10px 16px; }
  .modal-footer .btn { flex: 1 1 auto; }
  .kanban-board { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar { height: 52px; padding: 0 10px; }
  .topbar-right { gap: 4px; }
  .page-title { font-size: 13px; }
  .tester-name { display: none; }
  .filters-bar .form-control { flex: 1 1 100%; }
  .filter-label { display: none; }
  .filter-count { width: 100%; text-align: right; margin-top: 4px; }
  .btn-icon { width: 32px; height: 32px; }
  .tc-actions { gap: 2px; }
  #toast-container { right: 8px; left: 8px; bottom: 8px; }
  #toast-container > div { min-width: 0; max-width: none; width: 100%; font-size: 12.5px; }
  .bulk-bar { min-width: 90vw; max-width: 90vw; }
  .section-title { font-size: 16px; }
  .tc-link-form { flex-direction: column; align-items: stretch; }
  .tc-link-form .form-control,
  .tc-link-form select.form-control { width: 100% !important; }
}

@media (max-width: 420px) {
  .tests-table th:nth-child(6),
  .tests-table td:nth-child(6),
  .tests-table th:nth-child(8),
  .tests-table td:nth-child(8) { display: none; }
  .topbar { height: 48px; padding: 0 8px; }
  .modal-header { padding: 10px 12px; }
  .modal-body { padding: 10px 12px; }
  .sev-pill { font-size: 10px; min-width: 24px; padding: 2px 6px; }
  .prio-pill { font-size: 9.5px; padding: 2px 7px; }
}

/* ════════════════════════════════════════════════════════════════════
   EMPTY STATES — illustrés
   ════════════════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-tertiary);
}
.empty-state-icon {
  font-size: 56px;
  margin-bottom: 16px;
  display: block;
  opacity: 0.35;
  filter: grayscale(0.3);
}
.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.empty-state-message {
  font-size: 14px;
  color: var(--text-tertiary);
  max-width: 400px;
  margin: 0 auto 20px;
  line-height: 1.5;
}
.empty-state .btn {
  margin-top: 8px;
}

/* Skeleton loading */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.skeleton {
  background: var(--slate-200);
  border-radius: 6px;
  animation: skeleton-pulse 1.8s ease-in-out infinite;
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.short { width: 60%; }
.skeleton-card {
  height: 80px;
  border-radius: 12px;
  margin-bottom: 12px;
}

/* ============================================================
   THÈMES VISUELS (v7.0.1)
   ============================================================ */

/* Thème Compact (densité élevée, padding réduit) */
body.theme-compact {
  --spacing-xs: 2px;
  --spacing-sm: 4px;
  --spacing-md: 6px;
  --spacing-lg: 10px;
}
body.theme-compact .card {
  padding: 12px;
}
body.theme-compact .form-control {
  padding: 6px 10px;
  font-size: 12px;
}
body.theme-compact .btn {
  padding: 6px 12px;
  font-size: 12px;
}
body.theme-compact .sidebar-item {
  padding: 8px 16px;
  font-size: 12px;
}
