/* ARIA — Dashboard Shared Styles (modèle BrasDroit) */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bd: #7c3d0e;
  --bd-light: #92490f;
  --accent: #e07b39;
  /* Agents */
  --chercheur: #0369a1;   /* market-researcher */
  --controleur: #16a34a;  /* publisher / succès */
  --analyste: #7c3aed;    /* content-writer */
  --planificateur: #c05e1a; /* campaign-strategist */
  /* Système */
  --success: #16a34a;
  --warning: #d97706;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --sidebar-w: 240px;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Sidebar ─────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bd);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
}
.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-logo {
  display: flex; align-items: center; gap: 10px; margin-bottom: 2px;
}
.brand-diamond {
  width: 30px; height: 30px; background: rgba(255,255,255,0.15);
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: 1.5px; }
.brand-sub {
  font-size: 10px; color: rgba(255,255,255,0.45);
  letter-spacing: 0.5px; text-transform: uppercase; margin-left: 40px;
}
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: rgba(255,255,255,0.35); padding: 14px 20px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; color: rgba(255,255,255,0.65);
  text-decoration: none; font-size: 13px; font-weight: 500;
  transition: all 0.12s; border-left: 3px solid transparent; cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.11); color: #fff; border-left-color: var(--accent); }
.nav-icon { width: 18px; text-align: center; font-style: normal; font-size: 15px; }
.sidebar-footer {
  padding: 14px 20px; border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 11px; color: rgba(255,255,255,0.4);
}
.status-row { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #22c55e;
  box-shadow: 0 0 5px rgba(34,197,94,0.7);
}
.sidebar-version { font-size: 10px; color: rgba(255,255,255,0.25); }

/* ── Main ────────────────────────────────── */
.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.page-header {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 18px 32px; display: flex; align-items: flex-start; justify-content: space-between;
}
.page-title { font-size: 19px; font-weight: 700; color: var(--bd); }
.page-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.page-meta { font-size: 11px; color: var(--muted); text-align: right; }
.page-meta strong { display: block; font-size: 12px; color: var(--text); }
.content { flex: 1; padding: 24px 32px; }

/* ── Cards ───────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
.card + .card { margin-top: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title {
  font-size: 13px; font-weight: 700; color: var(--bd);
  display: flex; align-items: center; gap: 7px;
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* ── KPI Grid ────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; border-top: 3px solid; }
.kpi-card.c-primary { border-top-color: var(--bd); }
.kpi-card.c-success { border-top-color: var(--controleur); }
.kpi-card.c-accent  { border-top-color: var(--planificateur); }
.kpi-value { font-size: 34px; font-weight: 800; color: var(--bd); line-height: 1; }
.kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-top: 5px; }
.kpi-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── Grid Layouts ────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }

/* ── Tags / Badges ───────────────────────── */
.tag {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px;
}
.tag-success  { background: #dcfce7; color: var(--success); }
.tag-warning  { background: #fef3c7; color: var(--warning); }
.tag-info     { background: #dbeafe; color: #1d4ed8; }
.tag-purple   { background: #ede9fe; color: var(--analyste); }
.tag-blue     { background: #e0f2fe; color: var(--chercheur); }
.tag-terra    { background: #ffedd5; color: var(--planificateur); }
.tag-navy     { background: #fde8d4; color: var(--bd); }
.tag-orange   { background: #fff7ed; color: var(--accent); }

.agent-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #fff;
}
.ab-bd           { background: var(--bd); }
.ab-chercheur    { background: var(--chercheur); }
.ab-analyste     { background: var(--analyste); }
.ab-planificateur { background: var(--planificateur); }
.ab-controleur   { background: var(--controleur); }

/* ── Pipeline ────────────────────────────── */
.pipeline { display: flex; align-items: center; overflow-x: auto; padding: 8px 0 4px; gap: 0; }
.pipe-node { display: flex; flex-direction: column; align-items: center; min-width: 80px; }
.pipe-circle {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; text-align: center; line-height: 1.3;
}
.pipe-label { font-size: 9px; color: var(--muted); text-align: center; margin-top: 6px; max-width: 72px; line-height: 1.3; }
.pipe-score { font-size: 11px; font-weight: 700; margin-top: 2px; }
.pipe-arrow { font-size: 18px; color: #cbd5e1; padding: 0 2px; flex-shrink: 0; margin-bottom: 24px; }

/* ── Score Bars ──────────────────────────── */
.score-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.score-label { font-size: 12px; color: var(--text); min-width: 130px; }
.score-track { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.score-fill { height: 100%; border-radius: 3px; }
.score-val { font-size: 12px; font-weight: 700; min-width: 42px; text-align: right; }

/* ── Tables ──────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  background: var(--bg); padding: 9px 12px; text-align: left;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.4px; color: var(--muted); border-bottom: 1px solid var(--border);
}
td { padding: 9px 12px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* ── Forms ───────────────────────────────── */
.form-section-title {
  font-size: 13px; font-weight: 700; color: var(--bd);
  margin: 22px 0 12px; padding-bottom: 7px; border-bottom: 2px solid var(--border);
  display: flex; align-items: center; gap: 7px; text-transform: uppercase; letter-spacing: 0.5px;
}
.form-section-title:first-child { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { margin-bottom: 0; }
.form-group.full { grid-column: 1 / -1; }
label {
  display: block; font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 5px;
}
input[type="text"], input[type="url"], input[type="number"], input[type="email"],
textarea, select {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; color: var(--text); background: #fff; font-family: inherit; transition: border-color 0.12s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(224,123,57,0.1);
}
textarea { resize: vertical; line-height: 1.55; }
.form-hint { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 6px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: none; text-decoration: none; transition: all 0.12s; font-family: inherit;
}
.btn-primary { background: var(--bd); color: #fff; }
.btn-primary:hover { background: var(--bd-light); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-success { background: var(--controleur); color: #fff; }
.btn-success:hover { opacity: 0.9; }
.btn-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* ── Section title ───────────────────────── */
.section-title {
  font-size: 14px; font-weight: 700; color: var(--bd);
  margin-bottom: 14px; padding-bottom: 8px; border-bottom: 2px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}

/* ── Agent Cards ─────────────────────────── */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.agent-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; border-top: 4px solid; }
.agent-name { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.agent-role { font-size: 11px; color: var(--muted); margin-bottom: 10px; line-height: 1.4; }
.agent-file { font-size: 10px; font-family: 'Courier New', monospace; background: var(--bg); padding: 3px 6px; border-radius: 4px; color: var(--muted); display: inline-block; margin-bottom: 4px; }

/* ── Tabs ────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 18px; }
.tab {
  padding: 8px 18px; font-size: 13px; font-weight: 600; color: var(--muted);
  cursor: pointer; border: none; background: none;
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.12s; font-family: inherit;
}
.tab.active { color: var(--bd); border-bottom-color: var(--bd); }
.tab:hover:not(.active) { color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Info / Warn boxes ───────────────────── */
.info-box {
  background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; padding: 11px 14px;
  font-size: 13px; color: #9a3412; margin-bottom: 18px; display: flex; gap: 9px; align-items: flex-start;
}
.info-box-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.warn-box {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 11px 14px;
  font-size: 13px; color: #92400e; margin-bottom: 18px; display: flex; gap: 9px; align-items: flex-start;
}

/* ── Modal ───────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.55);
  z-index: 200; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 24px; max-width: 720px; width: 92%; max-height: 85vh; overflow-y: auto; position: relative; }
.modal-title { font-size: 16px; font-weight: 700; color: var(--bd); margin-bottom: 6px; }
.modal-sub { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-close:hover { color: var(--text); }
.code-block {
  background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 8px;
  font-family: 'Courier New', monospace; font-size: 12px;
  white-space: pre; overflow-x: auto; overflow-y: auto; max-height: 50vh; margin-bottom: 12px; line-height: 1.5;
}

/* ── Verdict / Mission entries ───────────── */
.verdict-box { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 8px; margin-bottom: 8px; }
.vb-valide { background: #f0fdf4; border: 1px solid #86efac; }
.vb-icon { font-size: 22px; }
.vb-text { flex: 1; font-size: 12px; color: var(--text); }
.vb-label { font-size: 13px; font-weight: 700; color: var(--success); }
.vb-score { font-size: 22px; font-weight: 800; color: var(--controleur); }

.mission-entry { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; margin-bottom: 14px; border-left: 4px solid var(--bd); }
.mission-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.mission-date { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.mission-title { font-size: 15px; font-weight: 700; color: var(--bd); margin-top: 2px; }
.mission-opp { font-size: 13px; color: var(--text); margin-top: 2px; }
.mission-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.mission-link {
  font-size: 11px; font-weight: 600; padding: 4px 10px; border: 1px solid var(--border);
  border-radius: 5px; text-decoration: none; color: var(--text); background: var(--bg); transition: all 0.12s;
}
.mission-link:hover { background: var(--bd); color: #fff; border-color: var(--bd); }

/* ── Param row ───────────────────────────── */
.param-row { display: flex; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.param-row:last-child { border-bottom: none; }
.param-label { font-size: 13px; font-weight: 600; min-width: 180px; }
.param-value { font-size: 13px; color: var(--text); flex: 1; }

/* ── Crit rows (grilles) ─────────────────── */
.crit-row { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; display: flex; gap: 12px; align-items: flex-start; }
.crit-number { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; }
.crit-body { flex: 1; }
.crit-label { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.crit-detail { font-size: 12px; color: var(--muted); line-height: 1.4; }
.crit-meta { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.crit-chip { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; text-transform: uppercase; }
.chip-poids { background: #fff7ed; color: var(--planificateur); }
.chip-obligatoire { background: #fee2e2; color: #b91c1c; }

/* ── Utilities ───────────────────────────── */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.fw-bold { font-weight: 700; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; }
hr.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
code.inline { font-family: 'Courier New', monospace; background: var(--bg); padding: 1px 5px; border-radius: 3px; font-size: 12px; color: var(--bd); }
