*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Barres de défilement (thème sombre) ─────────────────────────
   Firefox : scrollbar-* ; Chromium/WebKit : ::-webkit-scrollbar. */
* {
  scrollbar-width: thin;
  scrollbar-color: #3a3a3a transparent;   /* pouce / piste */
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: #3a3a3a;
  border-radius: 6px;
  border: 2px solid var(--bg);            /* marge sombre autour du pouce */
}
*::-webkit-scrollbar-thumb:hover { background: #4a4a4a; }
*::-webkit-scrollbar-corner { background: transparent; }

:root {
  --bg:          #0f0f0f;
  --surface:     #1a1a1a;
  --surface-low: #161616;   /* barre d'actions des colonnes */
  --tile:        #222;
  --tile-hover:  #292929;
  --sunken:      #0d0d0d;    /* creux des séparateurs */
  --border:      #2a2a2a;
  --text:        #e0e0e0;
  --muted:       #777;
  --accent:      #3fa898;
  --danger:      #dc2626;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  /* Colonne flex pleine hauteur : header + onglets fixes, main remplit le
     reste. Évite de deviner la hauteur du header (ex-constante 140px). */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100dvh; }
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 2rem; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 1rem; }
.login-box form { display: flex; flex-direction: column; gap: .5rem; }
.login-box h1 { font-size: 1.4rem; color: var(--accent); }
.login-robot { width: 90px; height: 90px; object-fit: contain; align-self: center; }
.login-box input { width: 100%; padding: .6rem .8rem; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 15px; outline: none; }
.login-box input:focus { border-color: var(--border); }
.login-box button { width: 100%; padding: .65rem; background: var(--accent); border: none; border-radius: 6px; color: #fff; font-size: 15px; cursor: pointer; }
.login-box .error { color: #e57373; font-size: 13px; }

/* App */
header { display: flex; align-items: center; gap: 1rem; padding: .75rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.header-robot { width: 28px; height: 28px; object-fit: contain; }
.app-name { font-weight: 600; color: var(--accent); }
.version { font-size: 12px; color: var(--muted); }
.logout-btn { background: none; border: 1px solid #555; color: #555; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 4px; cursor: pointer; padding: 0; }
.logout-btn:hover { color: var(--danger); border-color: var(--danger); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; }

/* ── Sync status badge ──────────────────────────────────────── */
.sync-badge {
  width: 80px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 9px;
  text-align: center;
  line-height: 1.2;
  border: 1px solid;
  cursor: pointer;
  font-family: inherit;
}
.sync-badge--ok      { color: #4caf50; border-color: #4caf50; background: rgba(76,175,80,.1); }
.sync-badge--running { color: #fb8c00; border-color: #fb8c00; background: rgba(251,140,0,.1); }
.sync-badge--error   { color: var(--danger); border-color: var(--danger); background: rgba(220,38,38,.1); }
.sync-badge--none    { color: var(--muted); border-color: var(--border); background: none; }

main { padding: 0.75rem 0 0; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* ── Colonne automatique (col 4) ────────────────────────────── */
.auto-tiles {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.6rem;
  gap: 4px;
}

.auto-sep-static { cursor: default; pointer-events: none; }

.auto-tile-empty {
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.4rem 0.25rem;
}

/* ── Colonne CI/CD (7ᵉ colonne, lecture seule) ──────────────── */
.ci-tiles {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.6rem;
  gap: 4px;
}
.ci-sec-title {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.35rem 0.25rem 0.15rem;
}
.ci-tile { cursor: pointer; }
.ci-dot { cursor: default; }               /* pas de palette de couleur ici */
[data-dot].ci-dot:hover { transform: none; }

/* ── Board ─────────────────────────────────────────────────── */
/* flex:1 → le board remplit toute la hauteur restante de main, donc son bord
   bas = bas de la fenêtre, et la barre de scroll horizontale s'y plaque. */
.bm-board {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 0 0.75rem;
  overflow-x: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.bm-col {
  flex-shrink: 0;
  width: 290px;
  background: var(--surface);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,.4);
}

.bm-tiles {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.6rem;
  gap: 4px;
  flex: 1;
}

/* ── Tuile ──────────────────────────────────────────────────── */
.bm-tile {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.55rem 0.85rem;
  text-decoration: none;
  color: var(--text);
  font-size: 0.83rem;
  letter-spacing: 0.01em;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  overflow: hidden;
}
.bm-tile:hover { background: var(--tile-hover); border-color: var(--muted); color: #fff; }

.bm-tile-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--border);
  transition: transform 0.12s;
  cursor: crosshair;
}
[data-dot]:hover { transform: scale(1.3); }

.bm-tile-grab {
  width: 14px; height: 14px;
  flex-shrink: 0;
  cursor: grab;
  border-radius: 3px;
  background-image: radial-gradient(circle, #606060 1.5px, transparent 1.5px);
  background-size: 5px 5px;
  background-position: 1px 1px;
  opacity: 0.35;
  transition: opacity 0.12s;
}
.bm-tile-grab:hover { opacity: 0.75; }
.bm-tile-grab:active { cursor: grabbing; }

.bm-tile-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  padding: 0 0.25rem;
}

/* Compte à rebours du prochain épisode (colonne watch, section « en attente »).
   Le texte est posé par board.js depuis data-airing-at ; sans date → « À venir ».
   Empilé au-dessus du titre via .bm-tile-stack. */
.bm-tile-stack {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.bm-tile-stack .bm-tile-title { flex: none; max-width: 100%; }
.bm-tile-countdown {
  font-size: 0.62rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}
.bm-tile-countdown--soon { color: #fb8c00; }      /* < 24 h */
.bm-tile-countdown--out  { color: #fdd835; }      /* timer écoulé, en attente de confirmation Simkl */

/* ── Séparateur ─────────────────────────────────────────────── */
.bm-sep {
  position: relative;
  margin: 6px -0.6rem;
  background: var(--sunken);
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 0.6rem;
  cursor: grab;
}
.bm-sep:active { cursor: grabbing; }
.bm-sep::before,
.bm-sep::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 8px;
  background: var(--surface);
  pointer-events: none;
}
.bm-sep::before { top: 0; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; }
.bm-sep::after  { bottom: 0; border-top-left-radius: 6px; border-top-right-radius: 6px; }

/* ── Drag & Drop ─────────────────────────────────────────────── */
.dragging   { opacity: 0.3; pointer-events: none; }
.drop-before { box-shadow: 0 -2px 0 var(--accent); }
.drop-after  { box-shadow: 0 2px 0 var(--accent); }
.bm-tiles.drop-end { box-shadow: inset 0 -3px 0 var(--accent); }

/* ── Color palette ──────────────────────────────────────────── */
.bm-color-palette {
  position: fixed;
  z-index: 600;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px;
  width: 152px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.8);
}
.bm-color-swatch {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.1s, transform 0.1s;
}
.bm-color-swatch:hover { border-color: #fff; transform: scale(1.2); }

/* ── Context menu ───────────────────────────────────────────── */
.bm-ctx-menu {
  position: fixed;
  z-index: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  min-width: 150px;
  box-shadow: 0 6px 24px rgba(0,0,0,.8);
}
.bm-ctx-item {
  display: block;
  width: 100%;
  padding: 0.4rem 0.75rem;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
}
.bm-ctx-item:hover { background: var(--tile-hover); }
.bm-ctx-delete { color: var(--danger); }
.bm-ctx-delete:hover { background: rgba(220,38,38,.12); }

/* ── Tâche kanban + éditeur ──────────────────────────────────── */
.bm-task { cursor: pointer; }

.bm-task-modal {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.55);
}
.bm-task-box {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: min(460px, 90vw);
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,.7);
}
.bm-task-title,
.bm-task-note {
  width: 100%;
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.55rem 0.7rem;
  box-sizing: border-box;
}
.bm-task-title:focus,
.bm-task-note:focus { outline: none; border-color: var(--accent); }
.bm-task-note { min-height: 160px; resize: vertical; line-height: 1.5; }
.bm-task-actions { display: flex; justify-content: flex-end; }
.bm-task-save {
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 0.82rem;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  font-family: inherit;
}
.bm-task-save:hover { filter: brightness(1.1); }

/* ── Actions colonnes ───────────────────────────────────────── */
.bm-col-actions {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem 0.6rem 0.6rem;
  background: var(--surface-low);
}
.bm-add-tile {
  flex: 1;
  background: none;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.73rem;
  padding: 0.35rem 0;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.bm-add-tile:hover { border-color: var(--accent); color: var(--accent); }

/* ── Onglets ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  padding: 0 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 0.6rem 1.1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.tab-content { display: none; }
.tab-content.active { display: block; }
/* Home : remplit la hauteur de main pour que le board (et sa barre de scroll
   horizontale) descende pile au bas de la fenêtre. */
#tab-home.active { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }

/* ── Chat (assistant) ────────────────────────────────────────── */
.chat {
  display: flex;
  gap: 1rem;
  height: calc(100vh - 140px);
  padding: 1rem 1.5rem;
}

.chat-sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 0;
}
.chat-new {
  background: none;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.5rem;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}
.chat-new:hover { border-color: var(--accent); color: var(--accent); }
.chat-conv-list { list-style: none; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.chat-conv-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.4rem 0.5rem 0.6rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.83rem;
}
.chat-conv-item:hover  { background: var(--tile-hover); color: var(--text); }
.chat-conv-item.active { background: var(--tile);       color: var(--text); }
.chat-conv-title {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-conv-del {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.2rem 0.3rem;
  cursor: pointer;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.chat-conv-item:hover .chat-conv-del { opacity: 1; }
.chat-conv-del:hover { color: var(--danger); background: rgba(220,38,38,.12); }

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-low);
  min-height: 44px;
}
.chat-header-name { font-weight: 600; font-size: 0.9rem; }
.chat-back { display: none; background: none; border: none; color: var(--text); font-size: 1.25rem; line-height: 1; cursor: pointer; padding: 0 0.25rem; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.chat-msg { display: flex; gap: 0.6rem; max-width: 80%; align-items: flex-end; }
.chat-msg-user      { align-self: flex-end;   flex-direction: row-reverse; }
.chat-msg-assistant { align-self: flex-start; }

/* portrait carré (légèrement arrondi), sobre — pas rond/cartoon */
.chat-avatar {
  width: 30px; height: 30px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.chat-bubble {
  padding: 0.6rem 0.85rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-msg-user      .chat-bubble { background: var(--accent); color: #fff;  border-bottom-right-radius: 3px; }
.chat-msg-assistant .chat-bubble { background: var(--tile); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 3px; }

/* sélecteur d'assistant (sidebar) */
/* Sélecteur d'assistant enrichi (carte qui se déplie) */
.chat-select { display: flex; flex-direction: column; }
.chat-select-current, .chat-select-opt {
  display: flex; align-items: center; gap: 0.55rem; width: 100%;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-family: inherit; text-align: left; cursor: pointer;
  padding: 0.5rem 0.6rem; transition: border-color 0.15s, background 0.15s;
}
.chat-select-current:hover, .chat-select-opt:hover { border-color: var(--accent); }
.chat-select.open .chat-select-current {
  border-color: var(--accent);
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
}
.chat-select-avatar { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; flex-shrink: 0; background: var(--sunken); }
.chat-select-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chat-select-name { font-size: 0.85rem; font-weight: 600; }
.chat-select-desc { font-size: 0.72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-select-arrow { color: var(--muted); font-size: 0.75rem; transition: transform 0.15s; }
.chat-select.open .chat-select-arrow { transform: rotate(180deg); }
.chat-select-options { display: none; flex-direction: column; gap: 2px; margin-top: 2px; }
.chat-select.open .chat-select-options { display: flex; }
.chat-conv-avatar { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--sunken); }

/* indicateur d'outil en cours (« recherche web… ») */
.chat-status {
  align-self: flex-start;
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  padding: 0 0.2rem;
}

/* carte (poster + titre + note + lien) — sobre, carrée, thème sombre */
.chat-card {
  display: flex;
  gap: 0.7rem;
  text-decoration: none;
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: 12px;
  border-bottom-left-radius: 3px;
  padding: 0.55rem;
  max-width: 320px;
  transition: border-color 0.15s;
}
.chat-card:hover { border-color: var(--accent); }
.chat-card-poster {
  width: 54px;
  height: 78px;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.chat-card-body { display: flex; flex-direction: column; justify-content: center; gap: 0.25rem; min-width: 0; }
.chat-card-title { font-size: 0.9rem; font-weight: 600; color: var(--text); line-height: 1.3; }
.chat-card-sub   { font-size: 0.78rem; color: var(--muted); line-height: 1.35; }

/* figure (matrice SVG) */
.chat-figure {
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: 12px;
  border-bottom-left-radius: 3px;
  padding: 0.5rem;
  max-width: 560px;
  width: 100%;
}
.chat-figure svg, .chat-figure img { display: block; width: 100%; height: auto; border-radius: 6px; }

/* tableau de risques */
.chat-table-wrap {
  background: var(--tile);
  border: 1px solid var(--border);
  border-radius: 12px;
  border-bottom-left-radius: 3px;
  padding: 0.7rem 0.8rem;
  max-width: 100%;
  overflow-x: auto;
}
.chat-table-title { font-size: 0.85rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.chat-table { border-collapse: collapse; font-size: 0.78rem; width: 100%; }
.chat-table th, .chat-table td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.5rem;
  text-align: left;
  vertical-align: top;
}
.chat-table th { background: var(--surface-low); color: var(--text); font-weight: 600; white-space: nowrap; }
.chat-table td { color: var(--muted); }
.chat-table-caption { font-size: 0.72rem; color: var(--muted); font-style: italic; margin-top: 0.5rem; }

.chat-input {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--surface-low);
}
.chat-input textarea {
  flex: 1;
  resize: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.6rem 0.8rem;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  max-height: 140px;
}
.chat-input button {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  padding: 0 1.1rem;
  cursor: pointer;
  font-size: 0.9rem;
}
.chat-input button:disabled { opacity: 0.5; cursor: default; }

/* ── Reco page ──────────────────────────────────────────────── */
.reco-main { padding: 0.75rem 1.5rem 3rem; max-width: 900px; }

.reco-unconfigured {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.7;
}
.reco-unconfigured code { color: var(--accent); }

.reco-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.reco-last-sync-label { color: var(--muted); font-size: 13px; }

.reco-sync-btn {
  padding: 0.35rem 1rem;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.reco-sync-btn:disabled { opacity: 0.5; cursor: default; }

.reco-body { display: flex; flex-direction: column; gap: 2rem; }

/* ── Franchise card ─────────────────────────────────────────── */
.reco-franchise {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0.6rem;
}

.reco-franchise-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  background: var(--surface-low);
}
.reco-franchise-name { font-weight: 600; font-size: 0.9rem; flex: 1; }
.reco-franchise-right { display: flex; align-items: center; gap: 0.4rem; margin-left: auto; }
.reco-franchise-rating { color: var(--muted); font-size: 0.8rem; }

/* ── Badge ──────────────────────────────────────────────────── */
.reco-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}
.reco-badge-type  { background: var(--tile); color: var(--muted); border-color: var(--border); }
.reco-badge-added    { background: rgba(63,168,152,.18); color: var(--accent); border-color: var(--accent); }
.reco-badge-detected { background: rgba(30,136,229,.15); color: #1e88e5; border-color: #1e88e5; }
.reco-badge-err   { background: rgba(220,38,38,.15); color: var(--danger); border-color: var(--danger); }

/* ── Saison ─────────────────────────────────────────────────── */
.reco-seasons { padding: 0.3rem 0; }

.reco-season {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.9rem;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border);
}
.reco-season:last-child { border-bottom: none; }
.reco-season-new { background: rgba(63,168,152,.05); }

.reco-season-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.reco-season-title { flex: 1; color: var(--text); }
.reco-season-right { display: flex; align-items: center; gap: 0.4rem; margin-left: auto; }
.reco-season-status { color: var(--muted); font-size: 0.75rem; }

/* ── Journal ────────────────────────────────────────────────── */
.reco-stats {
  border-collapse: collapse;
  font-size: 0.83rem;
  margin-bottom: 1.5rem;
  min-width: 280px;
}
.reco-stats th, .reco-stats td {
  padding: 0.4rem 1.25rem 0.4rem 0;
  text-align: left;
}
.reco-stats th { color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--border); }
.reco-stats td:not(:first-child) { font-variant-numeric: tabular-nums; }
.reco-groups { margin-top: 1.5rem; }

.reco-empty { color: var(--muted); font-size: 0.83rem; padding: 0.5rem 0; }

/* ── Audit (onglet GRC) ─────────────────────────────────────────── */
.audit {
  display: flex;
  gap: 1rem;
  height: calc(100vh - 140px);
  padding: 1rem 1.5rem;
}
.audit-sidebar {
  width: 230px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 0;
}
.audit-new {
  background: none;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.5rem;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}
.audit-new:hover { border-color: var(--accent); color: var(--accent); }
.audit-session-list { list-style: none; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.audit-session {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.4rem 0.5rem 0.6rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.83rem;
  cursor: pointer;
}
.audit-session:hover  { background: var(--tile-hover); color: var(--text); }
.audit-session.active { background: var(--tile); color: var(--text); }
.audit-session-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-session-meta { font-size: 0.7rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.audit-session-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0.2rem; }
.audit-session-del:hover { color: var(--danger); }

.audit-reqs {
  width: 360px;
  flex-shrink: 0;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 0.4rem;
}
.audit-reqs-head { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; padding: 0.2rem 0.4rem 0.5rem; }
.audit-genall {
  background: var(--accent); border: none; border-radius: 6px; color: #fff;
  font-family: inherit; font-size: 0.75rem; padding: 0.28rem 0.7rem; cursor: pointer;
}
.audit-genall:disabled { opacity: 0.5; cursor: default; }
.audit-genall-status { font-size: 0.72rem; color: var(--muted); margin-right: auto; }
.audit-export {
  font-size: 0.75rem; color: var(--muted); text-decoration: none;
  border: 1px solid var(--border); border-radius: 6px; padding: 0.25rem 0.55rem;
}
.audit-export:hover { border-color: var(--accent); color: var(--accent); }
.audit-cat {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--accent); padding: 0.7rem 0.5rem 0.3rem; position: sticky; top: 0;
  background: var(--surface);
}
.audit-req {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.5rem; border-radius: 6px; cursor: pointer; font-size: 0.8rem;
  color: var(--text);
}
.audit-req:hover  { background: var(--tile-hover); }
.audit-req.active { background: var(--tile); box-shadow: inset 2px 0 0 var(--accent); }
.audit-req-id { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.72rem; flex-shrink: 0; width: 64px; }
.audit-req-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.audit-dot-prop { background: var(--accent); }
.audit-note {
  flex-shrink: 0; width: 18px; height: 18px; border-radius: 4px; color: #fff;
  font-size: 0.72rem; font-weight: 600; display: flex; align-items: center; justify-content: center;
}
.audit-note-0 { background: #c62828; }
.audit-note-1 { background: #ef6c00; }
.audit-note-2 { background: #f9a825; color: #0f0f0f; }
.audit-note-3 { background: #9e9d24; }
.audit-note-4 { background: #558b2f; }
.audit-note-5 { background: #2e7d32; }

.audit-detail {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 1rem 1.2rem;
  min-width: 0;
}
.audit-d-head { display: flex; align-items: baseline; gap: 0.6rem; }
.audit-d-head h3 { font-size: 0.95rem; font-weight: 600; }
.audit-d-question { color: var(--muted); font-size: 0.82rem; margin: 0.5rem 0; }
.audit-d-levels { margin: 0.4rem 0 0.8rem; font-size: 0.8rem; }
.audit-d-levels summary { cursor: pointer; color: var(--accent); }
.audit-d-levels ul { list-style: none; margin-top: 0.4rem; display: flex; flex-direction: column; gap: 0.3rem; color: var(--text); }
.audit-d-levels b { color: var(--muted); }
.audit-d-label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0.9rem 0 0.3rem; }
.audit-d-notes, .audit-d-field {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-family: inherit; font-size: 0.85rem; padding: 0.5rem 0.6rem;
  resize: vertical; outline: none;
}
.audit-d-notes:focus, .audit-d-field:focus { border-color: var(--accent); }
.audit-d-propagation {
  background: rgba(63, 168, 152, 0.06); border-color: rgba(63, 168, 152, 0.45);
  color: var(--muted); cursor: text;
}
.audit-d-tip {
  margin: 0.9rem 0 0.2rem; padding: 0.55rem 0.7rem;
  background: rgba(63, 168, 152, 0.08); border: 1px solid rgba(63, 168, 152, 0.35);
  border-left: 3px solid var(--accent); border-radius: 6px;
}
.audit-d-tip-label { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); margin-bottom: 0.25rem; }
.audit-d-tip p { font-size: 0.86rem; color: var(--text); line-height: 1.45; }
.audit-d-tip-empty { color: var(--muted); }
.audit-d-actions { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.6rem; }
.audit-btn {
  background: var(--accent); border: none; border-radius: 6px; color: #fff;
  font-family: inherit; font-size: 0.8rem; padding: 0.4rem 0.9rem; cursor: pointer;
}
.audit-btn:disabled { opacity: 0.5; cursor: default; }
.audit-btn-2 { background: none; border: 1px solid var(--border); color: var(--text); }
.audit-btn-2:hover { border-color: var(--accent); color: var(--accent); }
.audit-d-status { font-size: 0.78rem; color: var(--muted); }
.audit-d-status.ok  { color: #4caf50; }
.audit-d-status.err { color: var(--danger); }
.audit-d-note-row { display: flex; align-items: center; gap: 0.8rem; }
.audit-d-note-row .audit-d-label { margin-bottom: 0; }
.audit-d-note-row select {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-family: inherit; padding: 0.3rem 0.5rem; outline: none;
}
.audit-empty { color: var(--muted); font-size: 0.83rem; padding: 1rem; }

/* ── Supervision (coûts IA) ─────────────────────────────────────── */
.supervision { padding: 1.5rem; max-width: 1000px; }
.sup-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.2rem; }
.sup-head h2 { font-size: 1.1rem; font-weight: 600; }
.sup-total { margin-left: auto; font-size: 1.4rem; font-weight: 600; color: var(--accent); display: flex; flex-direction: column; align-items: flex-end; }
.sup-total span { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 400; }
.sup-refresh { background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); cursor: pointer; font-size: 0.95rem; padding: 0.2rem 0.5rem; }
.sup-refresh:hover { border-color: var(--accent); color: var(--accent); }
.sup-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.sup-table th { text-align: right; color: var(--muted); font-weight: 500; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--border); font-size: 0.75rem; }
.sup-table th:first-child, .sup-table th:nth-child(2) { text-align: left; }
.sup-table td { padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--border); }
.sup-num, .sup-cost { text-align: right; font-variant-numeric: tabular-nums; }
.sup-cost { color: var(--accent); font-weight: 600; }
.sup-svc { color: var(--text); }
.sup-models { color: var(--muted); font-size: 0.78rem; }
.sup-table tfoot td { font-weight: 600; border-bottom: none; border-top: 2px solid var(--border); color: var(--text); }
.sup-note { color: var(--muted); font-size: 0.72rem; margin-top: 1rem; line-height: 1.5; }
.sup-empty { color: var(--muted); font-size: 0.85rem; padding: 1.5rem; }


/* ── ToWatch (suggestions par style : romcom / isekai / sport) ──── */
.towatch { padding: 1.25rem 1.5rem; display: flex; flex-direction: column; gap: 1.2rem; }
.tw-empty { color: var(--muted); font-size: 0.85rem; padding: 1.5rem; }
.tw-style {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.7rem;
}
.tw-style-title { font-size: 1rem; font-weight: 700; margin: 0; color: var(--accent); }
.tw-bucket { display: flex; flex-direction: column; gap: 0.35rem; }
.tw-bucket-label {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
}
.tw-cards { display: flex; gap: 0.8rem; overflow-x: auto; padding-bottom: 0.2rem; }
.tw-card {
  width: 130px; flex-shrink: 0; display: flex; flex-direction: column; gap: 0.35rem;
  text-decoration: none; color: var(--text);
  background: var(--tile); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.5rem; transition: border-color 0.15s, background 0.15s;
}
.tw-card:hover { border-color: var(--accent); background: var(--tile-hover); }
.tw-poster { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 5px; background: var(--sunken); }
.tw-poster-empty { display: block; }
.tw-card-title { font-size: 0.78rem; font-weight: 500; line-height: 1.3; }
.tw-card-reason { font-size: 0.72rem; color: var(--muted); line-height: 1.35; }
.tw-plats { display: flex; flex-wrap: wrap; gap: 3px; }
.tw-plat {
  font-size: 0.62rem; line-height: 1; padding: 2px 5px; border-radius: 4px;
  background: rgba(63,168,152,.12); color: var(--accent); border: 1px solid rgba(63,168,152,.35);
}
.tw-none {
  align-self: center; color: var(--muted); font-size: 0.75rem; font-style: italic;
  padding: 0.5rem 0;
}

/* ── Responsive : header + menu (hamburger) sur mobile ──────────── */
.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; font-size: 1.05rem; line-height: 1; cursor: pointer;
  padding: 0.25rem 0.55rem; font-family: inherit;
}
.badge-short { display: none; }
.logout-mobile { display: none; }

@media (max-width: 640px) {
  header { gap: 0.5rem; padding: 0.6rem 0.8rem; }
  .version { display: none; }
  .nav-toggle { display: inline-flex; align-items: center; }
  .header-right { gap: 0.35rem; }

  /* Badges réduits à leur initiale : T / N / W */
  .badge-full { display: none; }
  .badge-short { display: inline; }
  .sync-badge { width: auto; min-width: 26px; height: 24px; padding: 0 7px; font-size: 12px; font-weight: 600; }

  .logout-desktop { display: none; }

  /* Menu déroulant : onglets + déconnexion, repliés derrière le hamburger */
  .tabs { display: none; flex-direction: column; padding: 0; }
  .tabs.open { display: flex; }
  .tab {
    width: 100%; text-align: left; padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    border-left: 3px solid transparent;
  }
  .tab.active { border-bottom-color: var(--border); border-left-color: var(--accent); }
  .logout-mobile { display: block; }
  .logout-mobile button {
    background: none; border: none; color: var(--danger);
    font: inherit; cursor: pointer; padding: 0.85rem 1rem; width: 100%; text-align: left;
  }
}

/* ── Responsive : Home (board) — une colonne plein écran, swipe ──── */
@media (max-width: 640px) {
  .bm-board {
    gap: 0; padding: 0; height: auto; min-height: 0;
    scroll-snap-type: x mandatory;           /* accrochage colonne par colonne */
    -webkit-overflow-scrolling: touch;
  }
  .bm-col, .bm-col.auto-col {
    width: 100vw; border-radius: 0; box-shadow: none;
    border-right: 1px solid var(--border);
    scroll-snap-align: start;
  }
  .bm-tile { padding: 0.75rem 0.85rem; }     /* cible tapable confortable */
  .bm-tile-grab { display: none; }           /* pas de réordonnancement */
  .bm-tile-dot { pointer-events: none; }     /* dot visible mais non cliquable */
}

/* ── Responsive : ToWatch — posters réduits pour tenir sur mobile ─── */
@media (max-width: 640px) {
  .towatch { padding: 0.8rem; gap: 0.8rem; }
  .tw-style { padding: 0.6rem; gap: 0.5rem; }
  .tw-style-title { font-size: 0.9rem; }
  .tw-cards { gap: 0.5rem; }
  .tw-card  { width: 92px; padding: 0.35rem; gap: 0.25rem; }
  .tw-card-title  { font-size: 0.7rem; }
  .tw-card-reason { font-size: 0.65rem; }
}

/* ── Responsive : Chat (onglet Assistant) — deux écrans liste ↔ conv ─ */
@media (max-width: 640px) {
  main { padding: 0; }
  .chat { flex-direction: column; gap: 0; padding: 0.5rem; height: calc(100dvh - 52px); }
  .chat-sidebar { width: 100%; flex: 1; min-height: 0; }
  .chat-main { width: 100%; }
  .chat:not(.show-conv) .chat-main { display: none; }   /* écran liste */
  .chat.show-conv .chat-sidebar { display: none; }      /* écran conversation */
  .chat-back { display: inline-flex; align-items: center; }
  .chat-input textarea { min-height: 84px; max-height: 200px; }   /* champ de saisie plus haut sur mobile */
}

/* ── Responsive : Supervision — tableau en cartes par service ─────── */
@media (max-width: 640px) {
  .supervision { padding: 0.9rem; }
  .sup-table thead { display: none; }
  .sup-table, .sup-table tbody, .sup-table tfoot, .sup-table tr, .sup-table td { display: block; }
  .sup-table tr {
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
    padding: 0.6rem 0.8rem; margin-bottom: 0.6rem;
  }
  .sup-table td {
    display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
    padding: 0.25rem 0; border: none; text-align: right;
  }
  .sup-table td::before {
    content: attr(data-label); color: var(--muted); text-align: left; flex-shrink: 0;
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em;
  }
  /* nom de service = titre de la carte */
  .sup-table td.sup-svc {
    justify-content: flex-start; font-weight: 600; font-size: 0.95rem; color: var(--text);
    padding-bottom: 0.4rem; margin-bottom: 0.3rem; border-bottom: 1px solid var(--border);
  }
  .sup-table td.sup-svc::before { content: none; }
  .sup-table tfoot td.sup-svc { color: var(--accent); }
  .sup-table tfoot td.sup-models { display: none; }   /* pas de modèle pour le total */
}

/* Lien de téléchargement dans une description d'assistant (ex. helper pentest) */
.asst-dl { color: var(--accent); text-decoration: none; }
.asst-dl:hover { text-decoration: underline; }

/* ── Cianbay — portrait décoratif Home (image statique, non interactive) ──
   position:fixed mais enfant de #tab-home → masqué d'office hors Home.
   Taille/position identiques à l'ancien widget ; plus aucune interaction. */
.cby { position: fixed; right: 0; bottom: 0; z-index: 400; pointer-events: none; }
.cby-img {
  height: min(560px, 68vh); width: auto; display: block;
  user-select: none;
  filter: drop-shadow(-6px 0 14px rgba(0,0,0,.5));
  opacity: .82;
}
@media (max-width: 640px) {
  .cby-img { height: 30vh; }
}

