/* ============================================================================
   CTEM Risk Scoring — Système de design
   Palette instrument de terrain : sauge, coral (urgence), moutarde (mitigation),
   charbon (structure), olive (risque maîtrisé). Typo : Space Grotesk / Inter / IBM Plex Mono.
   ============================================================================ */

:root {
  /* --- Couleurs de base --- */
  --bg:            #F8F9FA;
  --bg-deep:       #F8F9FA;
  --panel:         #F6F4EA;
  --panel-2:       #EFEDE0;
  --ink:           #24261F;
  --ink-soft:      #5B5F4F;
  --line:          #C3C7AE;

  /* --- Couleurs de rôle (sévérité / priorité) --- */
  --coral:         #C1594B;
  --coral-dark:    #A34638;
  --coral-ink:     #FBEAE5;

  --mustard:       #E7D34E;
  --mustard-dark:  #C9AF2E;
  --mustard-ink:   #3A3312;

  --olive:         #7C8B5D;
  --olive-dark:    #63704A;
  --olive-ink:     #EEF2E4;

  --charcoal:      #2E3128;
  --charcoal-2:    #3A3E32;

  /* --- Champs utilisés uniquement en mode sombre (voir bloc [data-theme="dark"] ci-dessous) --- */
  --field-bg:      #fff;
  --checked-tint:  #F0EEE0;
  --recess:        rgba(0,0,0,0.06);
  --recess-track:  rgba(0,0,0,0.12);
  --shadow:        rgba(0,0,0,0.15);

  /* --- Typo --- */
  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body:    'Inter', 'Segoe UI', sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, monospace;

  --radius: 14px;
  --radius-sm: 8px;
}

/* ============================================================================
   THÈME SOMBRE — activé via <html data-theme="dark">
   Palette conservée dans la même famille (sauge/charbon) mais inversée : le
   charbon (--charcoal), trop proche du fond sombre pour rester "structurel",
   devient ici la teinte de survol/action (plus claire que le fond), et les
   trois couleurs de rôle (coral/mustard/olive) restent quasi identiques —
   déjà assez saturées pour bien ressortir sur fond sombre, pas besoin d'un
   jeu de couleurs différent qui romprait la cohérence entre les deux thèmes.
   ============================================================================ */
html[data-theme="dark"] {
  --bg:            #15171C;
  --bg-deep:       #15171C;
  --panel:         #1D2028;
  --panel-2:       #262A33;
  --ink:           #E7E9DC;
  --ink-soft:      #9BA08D;
  --line:          #383D46;

  /* Rôles : légèrement éclaircis pour garder un bon contraste sur fond sombre */
  --coral:         #D6685A;
  --coral-dark:    #C1594B;

  --mustard:       #E9D766;
  --mustard-dark:  #D4BC42;

  --olive:         #8DA06C;
  --olive-dark:    #7C8B5D;

  /* Charbon inversé : plus clair que --panel, sert de surface d'action/accent
     structurel (boutons primaires, badges, onglet actif) — les textes blancs
     codés en dur (color:#fff) posés dessus restent lisibles. */
  --charcoal:      #4B5443;
  --charcoal-2:    #5C6652;

  --field-bg:      #262A33;
  --checked-tint:  rgba(124,139,93,0.16);
  --recess:        rgba(255,255,255,0.05);
  --recess-track:  rgba(255,255,255,0.08);
  --shadow:        rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
.hidden { display: none !important; }

html, body { margin: 0; }
body { min-height: 100vh; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 0%, var(--bg-deep) 0%, transparent 45%),
    radial-gradient(circle at 100% 30%, var(--bg-deep) 0%, transparent 40%);
  color: var(--ink);
  font-family: var(--font-body);
  transition: background-color .25s ease, color .25s ease;
}
@media print { body { transition: none; } }

.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }

/* ---------------------------------------------------------------------- */
/* Barre supérieure                                                       */
/* ---------------------------------------------------------------------- */
.topbar {
  background: var(--charcoal);
  color: #EDEFE3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}
.topbar .brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 3px rgba(193,89,75,0.25);
}
.topbar .subtitle {
  color: #B7BBA9;
  font-size: 0.78rem;
  margin-left: 10px;
  font-family: var(--font-mono);
}
.topbar .nav-pills { display: flex; gap: 6px; }
.topbar .nav-pills a {
  color: #C7CABA;
  font-size: 0.82rem;
  padding: 6px 14px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
}
.topbar .nav-pills a.active {
  background: var(--charcoal-2);
  color: #fff;
  border-color: rgba(255,255,255,0.08);
}

/* ---------------------------------------------------------------------- */
/* Panneaux                                                                */
/* ---------------------------------------------------------------------- */
.panel {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 20px;
}
.panel-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.panel--coral {
  background: var(--coral);
  color: var(--coral-ink);
  border: none;
}
.panel--coral .panel-title { color: #fff; }
.panel--mustard {
  background: var(--mustard);
  color: var(--mustard-ink);
  border: none;
}
.panel--charcoal {
  background: var(--charcoal);
  color: #E7E9DC;
  border: none;
}
.panel--charcoal .panel-title { color: #fff; }
.panel--olive {
  background: var(--olive);
  color: var(--olive-ink);
  border: none;
}
.panel--olive .panel-title { color: #fff; }
.panel--charcoal .btn-ghost {
  color: #E7E9DC;
  border-color: rgba(255,255,255,0.25);
}
.panel--charcoal .btn-ghost:hover {
  background: rgba(255,255,255,0.08);
}

/* Distribution de sévérité (barres horizontales) */
.severity-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 0.78rem; }
.severity-row .label { width: 56px; font-family: var(--font-mono); opacity: 0.85; }
.severity-row .track { flex: 1; height: 8px; border-radius: 999px; background: var(--recess-track); overflow: hidden; }
.severity-row .fill { height: 100%; border-radius: 999px; background: var(--charcoal); }
.severity-row .count { width: 22px; text-align: right; font-family: var(--font-mono); font-weight: 600; }

/* Timeline historique */
.timeline-item {
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-decoration: none;
  color: inherit;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-item .cve { font-family: var(--font-mono); font-size: 0.82rem; font-weight: 600; }
.timeline-item .meta { font-size: 0.72rem; color: #AEB29F; margin-top: 2px; }
.timeline-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px;
}

/* Compteurs incidents (badge carré) */
.count-tile {
  background: var(--recess);
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
}
.count-tile .n { font-family: var(--font-mono); font-weight: 700; font-size: 1.15rem; }
.count-tile .l { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.75; }

/* ---------------------------------------------------------------------- */
/* Formulaire                                                              */
/* ---------------------------------------------------------------------- */
.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.field-input, .field-select {
  width: 100%;
  border: 1.5px solid var(--line);
  background: var(--field-bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--ink);
}
.field-input:focus, .field-select:focus {
  outline: none;
  border-color: var(--charcoal);
}

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  border: none;
  cursor: pointer;
  transition: transform .08s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--charcoal); color: #fff; }
.btn-coral { background: var(--coral); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1.5px solid var(--line); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---------------------------------------------------------------------- */
/* Badges de décision / statut                                            */
/* ---------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-family: var(--font-mono);
}
.badge-urgent    { background: var(--coral);   color: #fff; }
.badge-mitigate  { background: var(--mustard); color: var(--mustard-ink); }
.badge-accept    { background: var(--olive);   color: var(--olive-ink); }
.badge-scheduled { background: var(--charcoal);color: #fff; }
.badge-kev       { background: var(--coral-dark); color: #fff; }
.badge-neutral   { background: var(--panel-2); color: var(--ink-soft); border: 1px solid var(--line); }

/* ---------------------------------------------------------------------- */
/* Cadran radial (signature) — SVG généré en JS/PHP                       */
/* ---------------------------------------------------------------------- */
.gauge-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.gauge-score { font-family: var(--font-mono); font-weight: 700; }
.gauge-caption { font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------------------------------------------------------------------- */
/* Overlay résultat                                                       */
/* ---------------------------------------------------------------------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(36,38,31,0.55);
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 40px 16px; z-index: 50;
}
.overlay-card {
  background: var(--panel);
  border-radius: var(--radius);
  max-width: 920px; width: 100%;
  padding: 28px;
}

.data-table { width: 100%; font-size: 0.85rem; border-collapse: collapse; }
.data-table th {
  text-align: left; font-family: var(--font-mono); font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft);
  border-bottom: 1px solid var(--line); padding-bottom: 6px;
}
.data-table td { padding: 7px 0; border-bottom: 1px solid var(--line); }

.callout {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.85rem;
  border-left: 4px solid;
}
.callout-warn  { background: #FBF3D6; border-color: var(--mustard-dark); color: #5A4C10; }
.callout-accept{ background: #EEF2E4; border-color: var(--olive); color: #3E4A2C; }
.callout-info  { background: var(--panel-2); border-color: var(--ink-soft); color: var(--ink-soft); }
.callout-ai    { background: #F0EEE0; border-color: var(--charcoal); }

/* ---------------------------------------------------------------------- */
/* Fondu de chargement — évaluation CTEM en cours                         */
/* ---------------------------------------------------------------------- */
.eval-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(21,23,28,0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 200;
  opacity: 0;
  transition: opacity .35s ease;
}
.eval-loading-overlay.visible { opacity: 1; }
.eval-loading-overlay.hidden { display: none; }

.eval-loading-mark {
  position: relative;
  width: 78px;
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.eval-loading-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(193,89,75,0.22);
  border-top-color: var(--coral);
  animation: eval-spin 1.15s linear infinite;
}
.eval-loading-logo {
  position: relative;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--charcoal);
  color: var(--coral);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: eval-pulse 1.7s ease-in-out infinite;
}
.eval-loading-wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  color: #EDEFE3;
  margin: 4px 0 0;
}
.eval-loading-status {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #B7BBA9;
  letter-spacing: 0.01em;
  min-height: 1.2em;
  margin: 0;
  animation: eval-fade-text .4s ease;
}

@keyframes eval-spin { to { transform: rotate(360deg); } }
@keyframes eval-pulse {
  0%, 100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(193,89,75,0.35); }
  50%      { transform: scale(1.07); box-shadow: 0 0 0 8px rgba(193,89,75,0); }
}
@keyframes eval-fade-text {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Le fondu reste sur la même palette charbon/coral dans les deux thèmes —
   c'est un écran de patience, pas une surface de contenu ; pas besoin de
   variante claire, il s'affiche déjà en overlay sombre par-dessus tout. */

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}

/* ============================================================================
   Surcharges mode sombre — cas que les variables seules ne peuvent pas couvrir :
   couleur de la loupe encodée en dur dans le data-URI SVG, callouts dont le
   texte est une couleur littérale (pas var()), et chips de framework à teinte
   pastel fixe qui perdraient tout contraste sur fond sombre.
   ============================================================================ */
html[data-theme="dark"] .control-search {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239BA08D' stroke-width='2'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
}

html[data-theme="dark"] .callout-warn   { background: rgba(212,188,66,0.14);  color: #E9D98F; }
html[data-theme="dark"] .callout-accept { background: rgba(141,160,108,0.16); color: #B9CBA0; }
html[data-theme="dark"] .callout-ai     { background: var(--panel-2); }

/* Chips de framework : bascule vers une teinte saturée + texte clair (plutôt
   que pastel clair + texte foncé) pour conserver le code couleur MITRE/CIS/D3FEND
   avec un contraste correct sur fond sombre. */
html[data-theme="dark"] .chip-tactic  { background: #262C36; color: #A9B4C2; border-color: #333B47; }
html[data-theme="dark"] .chip-mitre   { background: #35251F; color: #E0A99A; border-color: #4A332B; }
html[data-theme="dark"] .chip-cis     { background: #2A2440; color: #C4AEE8; border-color: #3D3358; }
html[data-theme="dark"] .chip-d3fend  { background: #1F2E22; color: #9CC2A6; border-color: #2B4230; }

/* Fond des rapports imprimés : toujours blanc, quel que soit le thème choisi
   à l'écran — on n'imprime pas un fond sombre (gaspillage d'encre, mauvaise
   lisibilité papier). Le thème sombre est une préférence d'affichage, pas
   une préférence d'impression. */
@media print {
  html[data-theme="dark"] body { background: #fff; color: #24261F; }
}

/* ---------------------------------------------------------------------- */
/* Fondu de chargement — évaluation CTEM en cours                         */
/* ---------------------------------------------------------------------- */
.eval-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(21,23,28,0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 200;
  opacity: 0;
  transition: opacity .35s ease;
}
.eval-loading-overlay.visible { opacity: 1; }
.eval-loading-overlay.hidden { display: none; }

.eval-loading-mark {
  position: relative;
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.eval-loading-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(193,89,75,0.20);
  border-top-color: var(--coral);
  animation: eval-spin 1.1s linear infinite;
}
.eval-loading-logo {
  position: relative;
  z-index: 2;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--charcoal);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  animation: eval-pulse 1.8s ease-in-out infinite;
}
/* Trois barres verticales, reprenant le logo Vallum (icône à gauche du mot-symbole) */
.eval-loading-logo span {
  display: block;
  width: 4px;
  border-radius: 2px;
  background: var(--coral);
}
.eval-loading-logo span:nth-child(1) { height: 14px; }
.eval-loading-logo span:nth-child(2) { height: 22px; }
.eval-loading-logo span:nth-child(3) { height: 18px; }

.eval-loading-wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  color: #EDEFE3;
  margin: 2px 0 0;
}
.eval-loading-status {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #B7BBA9;
  letter-spacing: 0.01em;
  min-height: 1.2em;
  margin: 0;
  animation: eval-fade-text .4s ease;
}

@keyframes eval-spin { to { transform: rotate(360deg); } }
@keyframes eval-pulse {
  0%, 100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(193,89,75,0.35); }
  50%      { transform: scale(1.06); box-shadow: 0 0 0 8px rgba(193,89,75,0); }
}
@keyframes eval-fade-text {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------------- */
/* App shell — la page ne défile pas, seules les zones internes défilent  */
/* ---------------------------------------------------------------------- */
.app-main {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 20px 24px 40px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 260px 1fr 260px;
  gap: 20px;
  align-items: start;
}
.app-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.app-col-scroll {
  /* Ancien plafond de hauteur retiré : le contenu s'étend naturellement,
     c'est la page elle-même qui défile si nécessaire — cohérent avec le
     reste de l'interface, qui n'a plus aucune hauteur figée. */
}
.panel-form {
  display: flex;
  flex-direction: column;
}
.panel-form form {
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------------- */
/* Sélecteur de contrôles — onglets, recherche, grille de cartes          */
/* ---------------------------------------------------------------------- */
.control-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.control-tab {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--field-bg);
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}
.control-tab.active { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }
.control-tab .n { opacity: 0.7; margin-left: 3px; }

.control-search {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.85rem;
  margin-bottom: 10px;
  background: var(--field-bg) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235B5F4F' stroke-width='2'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 10px center;
  background-size: 15px;
  padding-left: 34px;
}
.control-search:focus { outline: none; border-color: var(--charcoal); }

.control-list {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field-bg);
  /* Proportionnel à la fenêtre plutôt qu'une valeur fixe : une catégorie bien remplie
     (ex: Réseau, 19 contrôles) tenait à peine dans 420px, forçant un double défilement
     (panneau + liste). min() garde un plafond raisonnable sur grand écran. */
  max-height: min(600px, 62vh);
  overflow-y: auto;
  scroll-behavior: smooth;
}
/* Barre de défilement fine et neutre plutôt que la barre système, plus cohérente
   avec le reste du design system (déjà discret partout ailleurs dans l'app). */
.control-list::-webkit-scrollbar { width: 8px; }
.control-list::-webkit-scrollbar-track { background: transparent; }
.control-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.control-list::-webkit-scrollbar-thumb:hover { background: var(--ink-soft); }
.control-list { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* --- Sections repliables par catégorie --- */
.control-section { border-bottom: 1px solid var(--line); }
.control-section:last-child { border-bottom: none; }

.control-section-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--field-bg);
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 1;
}
.control-section-header:hover { background: var(--recess); }
.csh-chevron {
  font-size: 0.7rem;
  color: var(--ink-soft);
  transition: transform .15s ease;
  flex-shrink: 0;
  width: 10px;
}
.control-section.open .csh-chevron { transform: rotate(90deg); }
.csh-name { font-size: 0.85rem; font-weight: 600; flex: 1; }
.csh-count {
  font-size: 0.7rem;
  color: var(--ink-soft);
  background: var(--recess);
  padding: 1px 7px;
  border-radius: 999px;
}
.csh-selected {
  font-size: 0.7rem;
  color: #fff;
  background: var(--olive-dark);
  padding: 1px 7px;
  border-radius: 999px;
}

.control-section-body {
  display: none;
  padding: 0 12px 8px;
}
.control-section.open .control-section-body { display: block; }

/* --- Lignes compactes (remplacent les cartes) --- */
.control-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s ease;
}
.control-row:hover { background: var(--recess); }
.control-row.checked { background: var(--checked-tint); }
.control-row.core .cr-name { font-weight: 600; }
.control-row.cve-match { border-left: 3px solid var(--olive-dark); padding-left: 3px; }
.control-row.cve-match .cr-name { font-weight: 700; }
.cr-cve-badge {
  font-size: 0.62rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #fff;
  background: var(--olive-dark);
  padding: 1px 6px;
  border-radius: 999px;
  flex-shrink: 0;
}
.cr-core-badge {
  font-size: 0.62rem;
  font-family: var(--font-mono);
  color: #35618A;
  background: #EAF1FB;
  border: 1px solid #D3E3F3;
  padding: 1px 6px;
  border-radius: 999px;
  flex-shrink: 0;
}
.control-row input[type="checkbox"] { flex-shrink: 0; }
.cr-name {
  font-size: 0.82rem;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cr-tactic {
  font-size: 0.68rem;
  color: var(--ink-soft);
  flex-shrink: 0;
  display: none; /* affiché uniquement à partir de tablette, voir media query */
}
.cr-tags {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  min-width: 118px;
  justify-content: flex-end;
}
.cr-tags .chip { font-size: 0.6rem; padding: 1px 6px; }
.cr-tag-empty { color: var(--ink-soft); font-size: 0.68rem; }
.cr-reduction {
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  background: var(--charcoal);
  flex-shrink: 0;
  width: 40px;
  text-align: center;
  padding: 2px 0;
  border-radius: 999px;
}
@media (min-width: 640px) {
  .cr-tactic { display: inline; width: 110px; flex-shrink: 0; }
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
/* Chip neutre générique — utilisé notamment pour le badge "vous" (users.php, manage_users.php)
   et les contrôles suggérés (app.js) ; plus utilisé dans la grille principale depuis le passage
   aux lignes compactes ci-dessus. */
.chip-tactic   { background: #EEF1F4; color: #4B5768; border: 1px solid #DEE3E8; padding: 1px 6px; }
.chip-mitre    { background: #FBEEEC; color: #9B4A3D; border: 1px solid #F0D8D3; padding: 1px 6px; }
.chip-cis      { background: #F1ECFA; color: #6B4F9E; border: 1px solid #E1D3F2; padding: 1px 6px; }
.chip-d3fend   { background: #EAF3EC; color: #3F6B4A; border: 1px solid #D3E8D8; padding: 1px 6px; }
.chip-reduction { background: var(--charcoal); color: #fff; }
.control-empty { color: var(--ink-soft); font-size: 0.85rem; padding: 20px 0; text-align: center; }


/* ---------------------------------------------------------------------- */
/* Modale plein écran — graphe de chemin d'attaque (besoin de place)      */
/* ---------------------------------------------------------------------- */
.attack-path-modal-card {
  background: var(--panel);
  border-radius: var(--radius);
  width: 92vw;
  height: 88vh;
  max-width: 1400px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.attack-path-modal-header { flex-shrink: 0; }
.attack-path-modal-footer { flex-shrink: 0; }
#attackPathContainer {
  width: 100%;
  /* Hauteur calculée directement plutôt que via flex:1 — Vis-Network mesure
     la taille du conteneur AU MOMENT de son instanciation ; s'appuyer sur
     flex-grow peut donner une hauteur encore à 0 si le calcul de layout
     n'est pas terminé, produisant un canvas invisible. calc() est résolu
     de façon déterministe dès l'affichage du bloc. */
  height: calc(88vh - 98px);
}

/* ---------------------------------------------------------------------- */
/* Menu profil                                                             */
/* ---------------------------------------------------------------------- */
.profile-menu { position: relative; }
.profile-trigger { background: none; border: none; cursor: pointer; padding: 0; }
.profile-avatar {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--coral); color: #fff;
  font-family: var(--font-mono); font-weight: 700; font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.profile-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  min-width: 200px; box-shadow: 0 8px 24px var(--shadow);
  overflow: hidden; z-index: 100;
}
.profile-dropdown-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.profile-dropdown-header * { color: inherit; }
.profile-dropdown-header .font-mono { color: var(--ink); }
.profile-dropdown a {
  display: block; padding: 10px 14px; font-size: 0.82rem; color: var(--ink);
  text-decoration: none; border-bottom: 1px solid var(--line);
}
.profile-dropdown a:last-child { border-bottom: none; }
.profile-dropdown a:hover { background: var(--panel-2); }
