/* admin.css — Design system partagé du back-office mdjlabs (admin.mdjlabs.com).
   Thème « sombre raffiné » (palette GitHub-dark, contraste AA), sans-serif, pro.
   Importé par index.html (tableau de bord), conversations.html, kb.html.
   Réutilise les classes existantes — un seul endroit pour faire évoluer le style. */

:root {
  color-scheme: dark;
  /* surfaces */
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1c2230;
  --surface-hover: #1f2630;
  /* bordures */
  --line: #30363d;
  --line-2: #3d444d;
  /* texte */
  --txt: #e6edf3;
  --txt-2: #c9d1d9;
  --muted: #8b949e;
  /* accent + sémantique */
  --accent: #2f81f7;
  --accent-hover: #4d95f8;
  --accent-soft: rgba(47, 129, 247, 0.15);
  --accent-line: rgba(47, 129, 247, 0.4);
  --ok: #3fb950;
  --ok-soft: rgba(63, 185, 80, 0.15);
  --warn: #d29922;
  --warn-soft: rgba(210, 153, 34, 0.15);
  --bad: #f85149;
  --bad-soft: rgba(248, 81, 73, 0.15);
  /* divers */
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 8px 24px rgba(1, 4, 9, 0.5);
  --ring: 0 0 0 3px var(--accent-soft);
  --fs: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--fs);
  line-height: 1.5;
  background: var(--bg);
  color: var(--txt);
  display: flex;
  flex-direction: column;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ----- Scrollbars sobres ----- */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ----- Header ----- */
header.top {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: .75rem 1.3rem;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
  flex: 0 0 auto;
}
header.top h1 { font-size: .95rem; font-weight: 600; margin: 0; letter-spacing: .01em; }
header.top .who { margin-left: auto; font-size: .8rem; color: var(--muted); }

nav.modules { display: flex; gap: .25rem; font-size: .82rem; }
nav.modules a {
  color: var(--muted);
  text-decoration: none;
  padding: .35rem .7rem;
  border-radius: 7px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
nav.modules a:hover { color: var(--txt); background: var(--surface); }
nav.modules a.active { color: var(--accent); background: var(--accent-soft); }

/* ----- Layout ----- */
.layout { flex: 1 1 auto; display: grid; grid-template-columns: 360px 1fr; min-height: 0; }
.sidebar { border-right: 1px solid var(--line); overflow-y: auto; background: var(--surface); }
.main { overflow-y: auto; padding: 1.5rem 1.8rem; max-width: 920px; }
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { max-height: 38vh; }
}

/* ----- Sidebar : liste d'intents ----- */
.newbar { padding: .8rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.intent {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  border-left: 3px solid transparent;
  transition: background .12s, border-color .12s;
}
.intent:hover { background: var(--surface-hover); }
.intent.sel { background: var(--accent-soft); border-left-color: var(--accent); }
.intent.off { opacity: .55; }
.intent .q { font-size: .88rem; font-weight: 500; color: var(--txt); line-height: 1.35; }
.intent .meta { font-size: .72rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }

/* ----- Chips / badges sémantiques ----- */
.chip {
  font-size: .7rem;
  font-weight: 500;
  padding: .12rem .5rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--txt-2);
  border: 1px solid var(--line-2);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
}
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(63, 185, 80, 0.4); }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(210, 153, 34, 0.4); }
.chip.off { background: var(--bad-soft); color: var(--bad); border-color: rgba(248, 81, 73, 0.35); }

/* ----- États vides / erreurs ----- */
.placeholder { color: var(--muted); font-size: .88rem; padding: 2.5rem 1.5rem; text-align: center; }
.err { color: var(--bad); }

/* ----- Formulaires ----- */
label {
  display: block;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin: .9rem 0 .3rem;
}
input[type=text], textarea, select {
  width: 100%;
  background: var(--surface-2);
  color: var(--txt);
  border: 1px solid var(--line-2);
  border-radius: 7px;
  padding: .5rem .65rem;
  font: inherit;
  font-size: .88rem;
  transition: border-color .15s, box-shadow .15s;
}
input[type=text]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
textarea { resize: vertical; min-height: 2.6rem; line-height: 1.45; }
.row { display: flex; gap: .8rem; flex-wrap: wrap; }
.row > div { flex: 1 1 8rem; }
.inline { display: flex; gap: .7rem; align-items: flex-end; }
.inline > .grow { flex: 1 1 auto; }

/* ----- Boutons ----- */
button {
  font: inherit;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 7px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--txt);
  padding: .45rem .9rem;
  transition: background .15s, border-color .15s, opacity .15s;
}
button:hover { background: var(--surface-hover); border-color: var(--muted); }
button:focus-visible { outline: none; box-shadow: var(--ring); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger { background: transparent; color: var(--bad); border-color: rgba(248, 81, 73, 0.4); }
button.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
button.sm { padding: .32rem .7rem; font-size: .76rem; }
button:disabled { opacity: .5; cursor: default; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.1rem; }

/* ----- Cartes & sections ----- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.1rem;
}
h2.title { font-size: 1.15rem; font-weight: 600; margin: 0 0 .3rem; letter-spacing: -.01em; }
code.id { font-size: .72rem; color: var(--muted); font-family: ui-monospace, "SF Mono", Menlo, monospace; }
h3.sec {
  font-size: .76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 1.8rem 0 .8rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--line);
}
.item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: .8rem; }
.item .imeta { font-size: .7rem; color: var(--muted); display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; align-items: center; }
.hint { font-size: .72rem; color: var(--muted); margin-top: .6rem; line-height: 1.5; }

/* ----- Toast ----- */
.toast {
  position: fixed;
  bottom: 1.3rem;
  right: 1.3rem;
  padding: .7rem 1.1rem;
  border-radius: var(--radius);
  font-size: .84rem;
  font-weight: 500;
  border: 1px solid var(--line-2);
  background: var(--surface);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { border-color: rgba(63, 185, 80, 0.5); color: var(--ok); }
.toast.bad { border-color: rgba(248, 81, 73, 0.5); color: var(--bad); }
