/* Administration Jaikit Discussion — s'appuie sur les variables de runtime/jk.css. */

[hidden] { display: none !important; }

.adm-main { max-width: 1080px; }
.adm-card {
  background: var(--carte);
  border: 1px solid rgba(0, 0, 0, .05);
  border-radius: var(--radius);
  box-shadow: var(--ombre);
  padding: 18px;
  margin: 0 0 18px;
}
.adm-card h2, .adm-card h3 { margin: 0 0 8px; }
.adm-card h3 { font-size: 18px; }
.adm-help { color: var(--mut); font-size: 13px; line-height: 1.5; margin: 6px 0 12px; max-width: 75ch; }
.adm-help code { background: rgba(177, 151, 252, .14); padding: 2px 6px; border-radius: 6px; font-size: 12px; }
.adm-login { max-width: 520px; margin: 0 auto; }
.adm-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; margin: 0 0 12px; }
.adm-field input, .adm-field select {
  min-height: 44px; padding: 0 12px; border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, .15); background: var(--carte); color: var(--txt); font: inherit;
}
.adm-field textarea {
  padding: 10px 12px; border-radius: 10px; resize: vertical; min-height: 80px;
  border: 1px solid rgba(0, 0, 0, .15); background: var(--carte); color: var(--txt); font: inherit;
}
.adm-field small { color: var(--mut); font-weight: 400; font-size: 11px; }
.adm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; align-items: start; }
.adm-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 8px; }
.adm-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.adm-top h2 { margin: 0; }
.adm-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.adm-filter { max-width: 340px; }
.adm-count { color: var(--mut); font-size: 13px; font-weight: 400; }
.adm-table-wrap { overflow-x: auto; border-radius: 12px; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
.adm-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--mut); padding: 8px; border-bottom: 1px solid rgba(0, 0, 0, .08);
}
.adm-table td { padding: 8px; border-bottom: 1px solid rgba(0, 0, 0, .05); vertical-align: middle; }
.adm-table tr:last-child td { border-bottom: 0; }
.adm-table select { min-height: 34px; padding: 0 8px; border-radius: 8px; border: 1px solid rgba(0,0,0,.15); background: var(--carte); color: var(--txt); font: inherit; }
.adm-table .adm-user { display: flex; flex-direction: column; gap: 1px; min-width: 160px; }
.adm-table .adm-user strong { font-size: 14px; }
.adm-table .adm-user span { color: var(--mut); font-size: 11px; }
.adm-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.adm-badge.on { background: var(--vert); color: #1a3b1a; }
.adm-badge.off { background: #ffd3d3; color: #701a1a; }
.adm-badge.role { background: rgba(177, 151, 252, .2); color: var(--txt); }
.adm-badge.role-admin { background: rgba(255, 169, 77, .25); }
.adm-muted { color: var(--mut); font-size: 12px; }
.adm-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.adm-row-actions button { padding: 6px 10px; font-size: 12px; }
.adm-msg { margin: 8px 0 0; font-size: 13px; font-weight: 600; }
.adm-msg.ok { color: #2b7a2b; }
.adm-msg.err { color: #b3261e; }
.adm-status {
  position: sticky; top: 72px; z-index: 9; margin: 0 0 14px;
  padding: 10px 14px; border-radius: 12px; font-size: 13px; font-weight: 600;
  background: rgba(177, 151, 252, .18); color: var(--txt);
  border: 1px solid rgba(177, 151, 252, .3);
}
.adm-status.err { background: rgba(255, 107, 157, .16); border-color: rgba(255, 107, 157, .4); }
.adm-status.ok { background: rgba(140, 233, 154, .22); border-color: rgba(140, 233, 154, .5); }
.adm-warn {
  margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5;
  background: rgba(255, 212, 59, .22); border: 1px solid rgba(255, 169, 77, .45); color: var(--txt);
}
.adm-audit { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; }
.adm-audit li { padding: 8px 4px; border-bottom: 1px solid rgba(0, 0, 0, .06); font-size: 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.adm-audit li:last-child { border-bottom: 0; }
.adm-audit time { color: var(--mut); white-space: nowrap; font-variant-numeric: tabular-nums; }
.adm-audit .adm-audit-action { font-weight: 700; }
.adm-audit .adm-audit-details { color: var(--mut); overflow-wrap: anywhere; }
.adm-dialog {
  border: 0; border-radius: var(--radius); padding: 20px; max-width: 460px; width: calc(100% - 32px);
  background: var(--carte); color: var(--txt); box-shadow: 0 20px 60px rgba(40, 20, 60, .35);
}
.adm-dialog::backdrop { background: rgba(20, 12, 28, .55); backdrop-filter: blur(2px); }
.adm-dialog h3 { margin: 0 0 8px; }
.adm-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; margin: 4px 0 12px; }
.adm-check input { margin-top: 3px; }
body.sombre .adm-table th, body.sombre .adm-table td, body.sombre .adm-audit li { border-color: rgba(255, 255, 255, .08); }
body.sombre .adm-field input, body.sombre .adm-field select, body.sombre .adm-table select {
  background: #17121f; border-color: rgba(255, 255, 255, .16); color: var(--txt);
}
@media (max-width: 560px) {
  .adm-main { padding: 14px 12px 40px; }
  .adm-card { padding: 14px; }
  .adm-table { min-width: 640px; }
}

/* === N2 : régie narrateur === */
.adm-narr-selects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0 14px;
  align-items: start;
}
.adm-narr-code {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(177, 151, 252, .14);
  overflow-wrap: anywhere;
}
.adm-subhead { margin: 20px 0 8px; font-size: 15px; }
.adm-preview { width: 100%; margin: 4px 0 10px; }
.adm-upload-zone { display: flex; flex-direction: column; gap: 8px; }
.adm-table .adm-asset-title { display: flex; flex-direction: column; gap: 1px; min-width: 170px; }
.adm-table .adm-asset-title strong { font-size: 14px; }
.adm-table .adm-asset-title span { color: var(--mut); font-size: 11px; }
.adm-table audio { max-width: 240px; }
.adm-narr-empty { color: var(--mut); font-size: 12px; padding: 8px 4px; }
.adm-ai-settings {
  margin: 4px 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(177, 151, 252, .3);
  border-radius: 12px;
  background: rgba(177, 151, 252, .06);
}
.adm-ai-settings summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--txt); }
.adm-ai-settings .adm-grid { margin-top: 10px; }
body.sombre .adm-field textarea { background: #17121f; border-color: rgba(255, 255, 255, .16); color: var(--txt); }



/* Connexions IA + autotests */
.adm-ia-card { border: 1px solid var(--adm-line, #d8d4e6); border-radius: 12px; padding: 12px; margin: 10px 0; background: rgba(120,100,200,.04); }
.adm-ia-card.off { opacity: .6; }
.adm-ia-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.adm-ia-nom { flex: 1 1 160px; min-width: 120px; }
.adm-ia-badge { font-size: .82rem; padding: 2px 8px; border-radius: 999px; max-width: 100%; overflow-wrap: anywhere; }
.adm-ia-badge.ok { background: #e3f6e8; color: #1b6b32; }
.adm-ia-badge.ko { background: #fde6e6; color: #a12626; }
.adm-tests { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.adm-test { padding: 8px 10px; border-radius: 8px; border: 1px solid #ddd; overflow-wrap: anywhere; font-size: .92rem; }
.adm-test.ok { background: #eaf7ee; border-color: #b9e2c4; }
.adm-test.warn { background: #fff6e0; border-color: #f0d995; }
.adm-test.fail { background: #fdeaea; border-color: #f0b4b4; }
.adm-test.run { background: #eef0fb; border-color: #cfd4f1; }
@media (prefers-color-scheme: dark) {
  .adm-ia-badge.ok { background: #14301c; color: #8fd9a3; } .adm-ia-badge.ko { background: #3a1818; color: #f0a0a0; }
  .adm-test.ok { background: #14301c; border-color: #2c5a3a; } .adm-test.warn { background: #3a3014; border-color: #6b5a22; }
  .adm-test.fail { background: #3a1818; border-color: #6b2c2c; } .adm-test.run { background: #1d2040; border-color: #3a3f78; }
}

/* ── Onglets + panneaux en grille (moins de scroll vertical) ─────────────────────────── */
.adm-main { max-width: 1280px; }
.adm-ctx .adm-narr-selects { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; align-items: end; }
.adm-ctx { position: sticky; top: 0; z-index: 5; backdrop-filter: blur(6px); }
.adm-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 14px; padding: 6px; border-radius: 14px; background: rgba(120, 100, 200, .08); }
.adm-tabs button { flex: 1 1 auto; border: 0; background: transparent; padding: 10px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; color: inherit; white-space: nowrap; }
.adm-tabs button:hover { background: rgba(120, 100, 200, .14); }
.adm-tabs button.on { background: linear-gradient(135deg, #7c5cff, #ff7a59); color: #fff; box-shadow: 0 4px 14px rgba(124, 92, 255, .35); }
.adm-tabbody { display: grid; grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); gap: 16px; align-items: start; }
.adm-tabbody > .adm-card { margin: 0; min-width: 0; }
.adm-tabbody > .adm-wide { grid-column: 1 / -1; }
.adm-tab-off { display: none !important; }
.adm-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.5; tab-size: 2; width: 100%; }
.adm-cheat { white-space: pre-wrap; margin: 8px 0 0; padding: 10px; border-radius: 10px; background: rgba(120, 100, 200, .08); }
@media (max-width: 560px) {
  .adm-tabbody { grid-template-columns: 1fr; }
  .adm-ctx { position: static; }
  .adm-tabs button { flex: 1 1 45%; }
}
