:root {
  --ink: #172033;
  --ink-2: #5B6575;
  --ink-3: #8A94A6;
  --ground: #F2F4F8;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --line: #DCE1E8;
  --accent: #1F5FBF;
  --accent-ink: #FFFFFF;
  --accent-soft: #E6EEFA;
  --danger: #B91C1C;
  --done: #15803D;
  --done-soft: #DCFCE7;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(23, 32, 51, .06), 0 4px 16px rgba(23, 32, 51, .06);
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #E8ECF3; --ink-2: #A9B2C2; --ink-3: #7B8597;
    --ground: #0F1521; --surface: #171E2B; --surface-2: #1D2534; --line: #2B3444;
    --accent: #5B8FE0; --accent-ink: #0F1521; --accent-soft: #1C2A44;
    --done: #4ADE80; --done-soft: #14351F;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.tiny { font-size: 12px; }

/* ---- boutons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 500;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { padding: 4px 9px; font-size: 13px; }

input[type="text"], input[type="search"], input[type="date"], input[type="password"], select, textarea {
  width: 100%; padding: 7px 10px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
label.field { display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); font-weight: 500; }
label.field > * { font-size: 14px; color: var(--ink); font-weight: 400; }

/* ---- chips ---- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; line-height: 1.5; border: 1px solid transparent;
  white-space: nowrap;
}
.chip.todo { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }
.chip.done { background: var(--done-soft); color: var(--done); border-color: transparent; }
.chip.interviewed { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.contact-toggle.interview:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.contact-toggle.interview input { accent-color: var(--accent); }
.chip.later { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }
.chip.intl { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }
.zone-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg-btn { padding: 4px 10px; border: 0; background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: 13px; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.chip.person { background: var(--surface-2); border-color: var(--line); }
.contact-toggle { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; background: var(--surface-2); }
.contact-toggle input { width: 20px; height: 20px; accent-color: var(--done); margin: 0; }
.contact-toggle:has(input:checked) { border-color: var(--done); background: var(--done-soft); }
.chip.person .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--ink-3)); }
.chip.due { background: #FEF3C7; color: #92400E; }
.chip.overdue { background: #FEE2E2; color: #991B1B; }
/* ---- e-mail : niveaux de confiance A / B / C / D ---- */
.chip.mail-A { background: var(--done-soft); color: var(--done); }
.chip.mail-B { background: var(--accent-soft); color: var(--accent); }
.chip.mail-C { background: #FEF3C7; color: #92400E; }
.chip.mail-D { background: #FEE2E2; color: #991B1B; }
.chip.mail-none { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }
.email-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.email-addr { font-size: 14px; user-select: all; }
.email-input { flex: 1; min-width: 200px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--ink); font: inherit; font-size: 13px; }
body.ro .email-row .btn, body.ro .email-row + .btn { display: none; }
.help { width: 22px; height: 22px; padding: 0; justify-content: center; border-radius: 50%; border: 1px solid var(--line); font-weight: 600; color: var(--ink-2); margin-left: 6px; text-transform: none; letter-spacing: 0; }
.help[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.legend { display: grid; gap: 8px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius); font-size: 13px; line-height: 1.45; }
.legend .lg { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; }
.legend .lg.head { color: var(--ink-2); font-style: italic; }
.legend .lg .chip { justify-content: center; }
.legend .use { color: var(--ink-3); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip.due { background: #3B2F0B; color: #FCD34D; }
  :root:not([data-theme="light"]) .chip.overdue { background: #3F1414; color: #FCA5A5; }
  :root:not([data-theme="light"]) .chip.mail-C { background: #3B2F0B; color: #FCD34D; }
  :root:not([data-theme="light"]) .chip.mail-D { background: #3F1414; color: #FCA5A5; }
}

/* ---- structure ---- */
.app { display: grid; grid-template-rows: auto 1fr; height: 100dvh; overflow: hidden; }
.app > * { min-width: 0; min-height: 0; }
.topbar {
  display: flex; align-items: center; gap: 10px 16px; padding: 10px 20px; flex-wrap: wrap;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar > * { min-width: 0; }
.topbar .seg, .topbar .who, .topbar .btn { flex: 0 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .01em; }
.brand .logo { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); }
.brand .sub { color: var(--ink-3); font-weight: 400; }
.topbar .search { flex: 1 1 260px; min-width: 200px; max-width: 520px; }
.topbar .spacer { flex: 1 1 0; min-width: 0; }
@media (max-width: 900px) {
  /* Sous cette largeur la recherche prend sa propre ligne plutôt que de s'écraser. */
  .topbar { padding: 8px 12px; }
  .topbar .search { flex: 1 1 100%; max-width: none; order: 10; }
}
.who { display: flex; align-items: center; gap: 8px; }

.layout {
  display: grid; grid-template-columns: 240px 1fr; min-height: 0; min-width: 0; overflow: hidden;
}
.layout > * { min-width: 0; }
.layout.with-detail { grid-template-columns: 240px 1fr minmax(0, 460px); }
@media (max-width: 1100px) {
  .layout, .layout.with-detail { grid-template-columns: 220px 1fr; }
  .detail { position: fixed; inset: 0 0 0 auto; width: min(520px, 100%); z-index: 10; box-shadow: var(--shadow); }
}

.rail { border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding: 14px 12px; }
.rail h3 { margin: 12px 4px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; }
.rail .row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 6px 8px; border-radius: 6px; border: 0; background: transparent; cursor: pointer; text-align: left;
}
.rail .row:hover { background: var(--surface-2); }
.rail .row.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.rail .row .n { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.rail .row.active .n { color: inherit; }
.rail .swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; margin-right: 8px; }

.main { min-width: 0; overflow-y: auto; }
.list-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; background: var(--ground); border-bottom: 1px solid var(--line);
}
.list-head .count { font-family: var(--mono); color: var(--ink-2); }
.list { display: grid; gap: 0; padding: 12px 20px 40px; }
.prospect {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 12px 16px; margin-top: -1px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; text-align: left;
}
.prospect:first-child { border-radius: var(--radius) var(--radius) 0 0; margin-top: 0; }
.prospect:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.prospect:only-child { border-radius: var(--radius); }
.prospect:hover { background: var(--surface-2); }
.prospect.selected { background: var(--accent-soft); border-color: var(--accent); position: relative; z-index: 1; }
.prospect.selected .avatar { border-color: var(--accent); }
.avatar {
  position: relative; flex: none; width: 48px; height: 48px; border-radius: 50%; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
  display: grid; place-items: center; font-weight: 600; font-size: 15px; letter-spacing: .02em;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.prospect .body { min-width: 0; display: grid; gap: 2px; }
.prospect .name { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.prospect .who-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prospect .deg { flex: none; color: var(--ink-3); font-size: 11px; font-weight: 500; padding: 0 6px; border: 1px solid var(--line); border-radius: 999px; line-height: 1.5; }
.prospect .line { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prospect .line .sep { margin: 0 6px; color: var(--ink-3); }
.prospect .line b { color: var(--ink); font-weight: 500; }
.prospect .chips { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.prospect .meta { display: flex; gap: 12px; color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; }
.prospect .meta span { overflow: hidden; text-overflow: ellipsis; }

.empty { padding: 60px 20px; text-align: center; color: var(--ink-2); }
.empty h2 { margin: 0 0 8px; font-weight: 600; }

/* ---- détail ---- */
.detail { background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
.detail .head { display: flex; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.detail .head .avatar { width: 64px; height: 64px; font-size: 20px; }
.detail h2 { margin: 0; font-size: 18px; line-height: 1.25; text-wrap: balance; }
.detail .head .close { margin-left: auto; }
.detail section { padding: 14px 18px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.detail section h3 { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; }
.tabs { display: flex; gap: 2px; padding: 3px; border-radius: var(--radius); background: var(--ground); }
.tab { padding: 5px 12px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; font-weight: 500; color: var(--ink-2); }
.tab:hover { color: var(--ink); }
.tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.detail-tabs { margin: 12px 18px 0; }
.detail .notes-pane { flex: 1; border-bottom: 0; grid-template-rows: auto 1fr; }
.detail .notes-area { height: 100%; min-height: 50vh; resize: none; font-size: 14px; line-height: 1.6; padding: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.message-box { font-family: var(--font); background: var(--surface-2); }
.about { color: var(--ink-2); max-width: 65ch; white-space: pre-wrap; }
.about.context { font-size: 13px; line-height: 1.5; max-height: 60vh; overflow-y: auto; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 10px; font-size: 13px; }
.kv dt { color: var(--ink-3); margin: 0; }
.kv dd { margin: 0; }
.events { display: grid; gap: 6px; font-size: 13px; }
.events .ev { display: grid; grid-template-columns: 110px 1fr; gap: 8px; }
.events .at { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }

/* ---- login ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login form { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.login h1 { margin: 0; font-size: 20px; }
.error { color: var(--danger); font-size: 13px; }

/* ---- modales ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 21, 33, .45); display: grid; place-items: center; z-index: 20; padding: 20px; }
.modal { width: min(640px, 100%); max-height: 90vh; overflow-y: auto; background: var(--surface); border-radius: 12px; padding: 22px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.modal h2 { margin: 0; font-size: 18px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--ink-2); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop.small { padding: 14px; font-size: 13px; }
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.files li { display: grid; gap: 6px; }
.file-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-head a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-head .btn { margin-left: auto; }
.files audio { width: 100%; height: 36px; }
.tpl { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--ground); padding: 10px 16px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow); z-index: 30; }

@media (prefers-reduced-motion: no-preference) {
  .prospect, .btn { transition: background .12s ease; }
}

/* ---- lecteur synchronisé (paroles) ---- */
.modal.player { width: min(920px, 100%); height: 92vh; max-height: 92vh; overflow: hidden; grid-template-rows: auto auto auto 1fr; gap: 12px; padding: 20px 0 0; }
.player-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 0 24px; }
.player-head h2 { font-size: 20px; }
.player audio { width: calc(100% - 48px); margin: 0 24px; height: 40px; }
.player-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 0 24px; }
.player-bar .clock { min-width: 96px; font-variant-numeric: tabular-nums; }
.player-search { flex: 1; min-width: 160px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--ink); font: inherit; font-size: 13px; }
.player-bar .kbd { margin-left: auto; }
.lyrics { overflow-y: auto; overflow-x: hidden; padding: 12px 24px 45vh; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 17px; line-height: 1.7; scroll-behavior: smooth; overscroll-behavior: contain; }
.lyrics .line { display: grid; grid-template-columns: 52px 1fr; gap: 12px; margin: 0; padding: 8px 10px; border-radius: 8px; color: var(--ink-3); cursor: pointer; overflow-wrap: anywhere; transition: color .15s, background .15s; }
.lyrics .line .txt { min-width: 0; }
.lyrics .line .ts { font-size: 11px; line-height: 2.5; color: var(--ink-3); opacity: .7; font-variant-numeric: tabular-nums; }
.lyrics .line.past { color: var(--ink-2); }
.lyrics .line:hover { background: var(--surface); color: var(--ink); }
.lyrics .line.now { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); font-weight: 500; }
.lyrics .line.now .ts { color: var(--accent); opacity: 1; }
.lyrics .line.hit { box-shadow: inset 3px 0 0 var(--done); }
.lyrics .word { white-space: pre-wrap; border-radius: 3px; }
.lyrics .line.now .word.past { color: var(--ink); }
.lyrics .line.now .word.now { color: var(--accent); font-weight: 700; }
.lyrics .word:hover { text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { .lyrics { scroll-behavior: auto; } .lyrics .line { transition: none; } }

/* ---- compte en lecture seule (OUTREACH_READONLY) : le serveur refuse toute écriture, l'interface cache les commandes ---- */
.ro-chip { background: var(--accent-soft); color: var(--accent); font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
body.ro .contact-toggle, body.ro .zone-row .seg, body.ro .field input[type="date"] { pointer-events: none; opacity: .7; }
body.ro .notes-area { pointer-events: none; }
body.ro .drop, body.ro .files .file-head button, body.ro .connect-btn, body.ro .mark-btn { display: none !important; }

/* ---------- Ajout depuis LinkedIn / formulaires génériques ---------- */
div.field { display: grid; gap: 4px; }
div.field > label { font-size: 12px; color: var(--ink-2); font-weight: 500; }
div.field input, div.field textarea, div.field select { width: 100%; font: inherit; font-size: 14px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.row-inline { display: flex; gap: 8px; align-items: center; }
.row-inline input { flex: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.warn { background: #FFF7E6; border: 1px solid #F0C36D; color: #7A4B00; border-radius: 6px; padding: 8px 10px; font-size: 13px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .warn { background: #3A2A0E; border-color: #7A5A1E; color: #F5D28A; } }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.view-seg { margin-right: 6px; }

/* ---------- Matrice du problème / des opportunités ---------- */
.matrice-layout { grid-template-columns: minmax(0, 1fr); }
.matrice-layout.with-detail { grid-template-columns: minmax(0, 1fr) minmax(0, 480px); }
.matrice-main { padding: 0; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.legend-bar { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 6px 18px; border-bottom: 1px solid var(--line); align-items: center; }
.opp-badge { color: #8A5A00; font-weight: 500; }
.matrice-scroll { overflow: auto; flex: 1; min-width: 0; padding: 12px 18px 24px; overscroll-behavior: contain; }
table.matrice { border-collapse: separate; border-spacing: 4px; --rowhead-w: 260px; }
table.matrice th { font-weight: 500; font-size: 12px; color: var(--ink-2); text-align: left; vertical-align: bottom; }
/* En-têtes figés : le coin tient les deux axes, la colonne des problèmes le sien.
   Empilement : coin (4) > en-têtes de colonnes (3) > colonne des problèmes (2) > cases. */
table.matrice thead th { position: sticky; top: 0; background: var(--ground); z-index: 3; padding: 0 0 4px; min-width: 120px; max-width: 160px; }
table.matrice th.corner {
  position: sticky; left: 0; top: 0; z-index: 4;
  color: var(--ink-3); font-weight: 400; font-size: 11px;
  width: var(--rowhead-w); min-width: var(--rowhead-w); max-width: var(--rowhead-w);
  background: var(--ground); box-shadow: 1px 0 0 var(--line);
}
table.matrice th.rowhead {
  position: sticky; left: 0; z-index: 2; background: var(--ground);
  width: var(--rowhead-w); min-width: var(--rowhead-w); max-width: var(--rowhead-w);
  padding-right: 6px; box-shadow: 1px 0 0 var(--line);
}
table.matrice th.rowhead .axis-btn { white-space: normal; overflow-wrap: anywhere; }
/* Réordonnancement des lignes : poignée ⠿ (glisser-déposer) et flèches ▲▼, visibles au survol. */
table.matrice th.rowhead .rowhead-inner { display: flex; align-items: center; gap: 2px; }
table.matrice th.rowhead .rowhead-inner .axis-btn { flex: 1 1 auto; min-width: 0; }
.drag-handle { flex: 0 0 auto; cursor: grab; color: var(--ink-3); font-size: 14px; padding: 4px 2px; opacity: 0; user-select: none; }
.drag-handle:active { cursor: grabbing; }
.row-arrows { flex: 0 0 auto; display: flex; flex-direction: column; opacity: 0; }
.row-arrows .arrow { all: unset; cursor: pointer; font-size: 8px; line-height: 1; padding: 2px 4px; border-radius: 4px; color: var(--ink-3); }
.row-arrows .arrow:hover { background: var(--accent-soft); color: var(--accent); }
.row-arrows .arrow:disabled { opacity: .25; cursor: default; }
table.matrice tr:hover .drag-handle, table.matrice tr:hover .row-arrows, .drag-handle:focus-visible { opacity: 1; }
table.matrice tr.dragging { opacity: .4; }
table.matrice tr.drop-before > * { box-shadow: 0 -3px 0 0 var(--accent); }
table.matrice tr.drop-after > * { box-shadow: 0 3px 0 0 var(--accent); }
table.matrice tr.drop-before > th.rowhead, table.matrice tr.drop-after > th.rowhead { box-shadow: 1px 0 0 var(--line), 0 -3px 0 0 var(--accent); }
table.matrice tr.drop-after > th.rowhead { box-shadow: 1px 0 0 var(--line), 0 3px 0 0 var(--accent); }
.axis-btn { all: unset; cursor: pointer; display: block; width: 100%; padding: 6px 8px; border-radius: 6px; line-height: 1.25; }
.axis-btn:hover { background: var(--accent-soft); color: var(--accent); }
.axis-btn.active { background: var(--accent-soft); color: var(--accent); }
.axis-btn .n { margin-left: 6px; color: var(--ink-3); font-size: 11px; }
td.cell { position: relative; width: 120px; height: 64px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; padding: 6px 8px; vertical-align: top; transition: transform .08s; }
td.cell:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
td.cell.active { outline: 2px solid var(--accent); }
td.cell .score { font-size: 22px; font-weight: 600; line-height: 1; color: var(--ink); }
td.cell .score sub { font-size: 11px; font-weight: 500; color: var(--ink-3); margin-left: 3px; vertical-align: baseline; }
td.cell .counts { position: absolute; right: 8px; bottom: 6px; font-size: 12px; color: var(--ink-2); }
td.cell .counts i { color: var(--ink-3); font-style: normal; }
td.cell .star { position: absolute; left: 8px; bottom: 4px; color: #D69E00; font-size: 14px; }
td.cell.a0 { background: var(--surface-2); }
td.cell.a1 { background: #EEF3FA; }
td.cell.a2 { background: #E1EBF8; }
td.cell.a3 { background: #CFE0F5; }
td.cell.a4 { background: #B7D0F0; }
td.cell.a5 { background: #9CC0EA; }
td.cell.opp { border-color: #D69E00; box-shadow: inset 0 0 0 1px #D69E00; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) td.cell.a1 { background: #1A2436; } :root:not([data-theme="light"]) td.cell.a2 { background: #1E2C47; } :root:not([data-theme="light"]) td.cell.a3 { background: #22365A; } :root:not([data-theme="light"]) td.cell.a4 { background: #27416E; } :root:not([data-theme="light"]) td.cell.a5 { background: #2D4C84; } }
tr.nc-row td.nc-cell { padding: 6px 8px; }
.matrice-panel { min-width: 0; }
.matrice-panel .detail-head { display: flex; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.matrice-panel .detail-head > div { min-width: 0; flex: 1; }
.matrice-panel .detail-head h2 { margin: 0 0 4px; font-size: 17px; line-height: 1.25; }
.cell-scores select, .cell-scores textarea { width: 100%; font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.opp-flag { color: #8A5A00; background: #FFF4D6; border-radius: 6px; padding: 6px 10px; font-size: 13px; font-weight: 500; }
ul.insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
li.insight { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 5px; background: var(--surface-2); }
li.insight.rejeté { opacity: .55; }
li.insight.validé { border-color: var(--done); }
.ins-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ins-text { font-size: 14px; line-height: 1.4; }
.ins-verbatim { font-size: 13px; color: var(--ink-2); font-style: italic; }
.ins-verbatim-link { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0; margin: 0; font: inherit; font-size: 13px; font-style: italic; color: var(--ink-2); cursor: pointer; }
.ins-verbatim-link:hover, .ins-verbatim-link:focus-visible { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.ins-verbatim-t { font-style: normal; white-space: nowrap; margin-left: 6px; opacity: .75; font-variant-numeric: tabular-nums; }
.ins-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.chip.force { font-weight: 700; min-width: 22px; justify-content: center; }
.chip.force.f5, .chip.force.f4 { background: #DCE9FA; color: #1F4E96; }
.chip.force.f3 { background: #EEF3FA; color: #3B5B87; }
.chip.force.f2, .chip.force.f1, .chip.force.f0, .chip.force.fx { background: var(--surface); color: var(--ink-3); }
.chip.tiny { font-size: 11px; padding: 1px 6px; }
.chip.theme { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); }
.chip.statut.validé { background: var(--done-soft); color: var(--done); }
.chip.statut.proposé { background: #FFF4D6; color: #8A5A00; }
.chip.statut.rejeté { background: var(--surface); color: var(--ink-3); text-decoration: line-through; }
/* Matrice — colonnes « personnes » (matrice du cours) */
table.matrice tr.grouprow th.groupcell { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; text-align: center; padding: 2px 6px; border-bottom: 1px solid var(--line); background: var(--ground); }
table.matrice th.perscol { min-width: 104px; max-width: 132px; }
table.matrice th.perscol .axis-btn { font-size: 12px; }
table.matrice th.perscol .sub { display: block; font-size: 10px; color: var(--ink-3); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.cell .score sub:empty { display: none; }
.pers-force { font-size: 14px; }

/* ---- Matrice : adaptation aux écrans étroits ---- */
/* Les longs thèmes ne doivent plus élargir le panneau de droite. */
.matrice-panel .chip.theme { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.matrice-panel .ins-text, .matrice-panel .ins-verbatim, .matrice-panel .ins-verbatim-link { overflow-wrap: anywhere; }
.matrice-panel .detail-head h2 { overflow-wrap: anywhere; }

@media (max-width: 1400px) {
  table.matrice { --rowhead-w: 210px; }
  table.matrice th.perscol { min-width: 92px; max-width: 112px; }
  td.cell { width: 92px; height: 58px; }
}
@media (max-width: 1100px) {
  /* Le panneau passe en superposition : la matrice garde toute la largeur. */
  .matrice-layout, .matrice-layout.with-detail { grid-template-columns: minmax(0, 1fr); }
  .matrice-panel { position: fixed; inset: 0 0 0 auto; width: min(480px, 100%); z-index: 10; box-shadow: var(--shadow); }
  table.matrice { --rowhead-w: 168px; }
  .legend-bar { font-size: 11px; padding: 6px 12px; }
  .matrice-scroll { padding: 10px 12px 20px; }
}
@media (max-width: 720px) {
  table.matrice { --rowhead-w: 132px; border-spacing: 3px; }
  table.matrice th.perscol { min-width: 76px; max-width: 92px; }
  td.cell { width: 76px; height: 52px; }
  td.cell .score { font-size: 18px; }
  .list-head { flex-wrap: wrap; row-gap: 6px; }
}

/* Mails envoyés (fiche) */
.mail-sent { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; display: grid; gap: 8px; }
.mail-sent-head { display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.mail-sent-subject { font-weight: 500; }
.mail-sent-body { white-space: pre-wrap; font-size: 13px; line-height: 1.5; }
