/* ============================================================
   Cockpit d'agents IA — feuille de style (autonome, sans CDN)
   ============================================================ */

:root {
  --bg:        #f4f6fb;
  --surface:   #ffffff;
  --sidebar:   #0f172a;
  --sidebar-2: #1e293b;
  --ink:       #1e293b;
  --ink-soft:  #64748b;
  --line:      #e2e8f0;
  --brand:     #2563eb;
  --brand-ink: #1d4ed8;
  --ok:        #059669;
  --warn:      #d97706;
  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 1px 2px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.06);
  --shadow-sm: 0 1px 2px rgba(15,23,42,.08);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }

/* ---------- Bandeau démonstration ------------------------- */
.demo-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: 30px; display: flex; align-items: center; justify-content: center;
  gap: 8px; font-size: 12.5px; font-weight: 600; letter-spacing: .2px;
  color: #92400e; background: #fef3c7; border-bottom: 1px solid #fde68a;
}
.demo-banner .dot { width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; }

/* ============================================================
   ÉCRAN DE CONNEXION
   ============================================================ */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 60px 20px 20px;
  background:
    radial-gradient(1200px 600px at 15% -10%, #dbeafe 0%, transparent 55%),
    radial-gradient(1000px 500px at 110% 10%, #ede9fe 0%, transparent 50%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 420px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
  padding: 36px 32px; text-align: center;
}
.login-logo {
  width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 18px;
  display: grid; place-items: center; font-size: 26px; color: #fff;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  box-shadow: 0 8px 20px rgba(37,99,235,.35);
}
.login h1 { font-size: 22px; margin: 0 0 6px; }
.login .sub { color: var(--ink-soft); font-size: 14px; margin: 0 0 26px; }
.sso-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 13px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; font-size: 15px; font-weight: 600; color: var(--ink);
  transition: box-shadow .15s ease, transform .05s ease, border-color .15s;
}
.sso-btn:hover { box-shadow: var(--shadow-sm); border-color: #cbd5e1; }
.sso-btn:active { transform: translateY(1px); }
.ms-logo { width: 20px; height: 20px; display: inline-grid;
  grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; }
.ms-logo i { display: block; }
.ms-logo i:nth-child(1) { background: #f25022; }
.ms-logo i:nth-child(2) { background: #7fba00; }
.ms-logo i:nth-child(3) { background: #00a4ef; }
.ms-logo i:nth-child(4) { background: #ffb900; }
.login .fineprint { margin-top: 22px; font-size: 12px; color: var(--ink-soft); }

/* ============================================================
   MISE EN PAGE APPLICATIVE
   ============================================================ */
.app { display: none; }
.app.active { display: block; }

.layout { display: flex; min-height: 100vh; padding-top: 30px; }

/* ---------- Barre latérale -------------------------------- */
.sidebar {
  width: 250px; flex: 0 0 250px; background: var(--sidebar); color: #cbd5e1;
  position: fixed; top: 30px; bottom: 0; left: 0; z-index: 40;
  display: flex; flex-direction: column; transition: transform .25s ease;
}
.sidebar-head { padding: 20px 18px 14px; display: flex; align-items: center; gap: 11px; }
.sidebar-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  font-size: 18px; color: #fff; background: linear-gradient(135deg,#2563eb,#7c3aed);
}
.sidebar-title { font-weight: 700; color: #fff; font-size: 15px; line-height: 1.2; }
.sidebar-title small { display: block; font-weight: 500; color: #94a3b8; font-size: 11.5px; }

.nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 13px; border: none; border-radius: 10px; background: transparent;
  color: #cbd5e1; font-size: 14.5px; text-align: left; transition: background .15s, color .15s;
}
.nav-item .ic { width: 20px; text-align: center; font-size: 16px; }
.nav-item:hover { background: var(--sidebar-2); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(37,99,235,.4); }

.sidebar-user {
  margin: 10px 12px 16px; padding: 12px; border-radius: 12px; background: var(--sidebar-2);
  display: flex; align-items: center; gap: 11px;
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 38px; display: grid; place-items: center;
  font-weight: 700; color: #fff; font-size: 14px;
  background: linear-gradient(135deg,#0891b2,#2563eb);
}
.sidebar-user .u-name { color: #fff; font-size: 13.5px; font-weight: 600; }
.sidebar-user .u-role { color: #94a3b8; font-size: 12px; }
.logout {
  margin-left: auto; background: transparent; border: none; color: #94a3b8; font-size: 16px;
}
.logout:hover { color: #fff; }

/* ---------- Zone principale ------------------------------- */
.main { flex: 1; margin-left: 250px; min-width: 0; }
.topbar {
  position: sticky; top: 30px; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 26px; background: rgba(244,246,251,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.burger {
  display: none; width: 40px; height: 40px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; font-size: 18px;
}
.topbar h2 { font-size: 19px; margin: 0; }
.topbar .crumb { color: var(--ink-soft); font-size: 13px; }
.content { padding: 26px; max-width: 1200px; }

.overlay {
  display: none; position: fixed; inset: 30px 0 0 0; background: rgba(15,23,42,.45); z-index: 35;
}
.overlay.show { display: block; }

/* ---------- Composants génériques ------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.section-title { font-size: 15px; font-weight: 700; margin: 0 0 14px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600; color: #fff;
}
.badge .bd { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.85); }

/* ============================================================
   ÉCRAN CATALOGUE
   ============================================================ */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; align-items: center; }
.search {
  flex: 1; min-width: 220px; display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
  box-shadow: var(--shadow-sm);
}
.search input { border: none; outline: none; flex: 1; font-size: 14.5px; background: transparent; color: var(--ink); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff;
  font-size: 13px; font-weight: 600; color: var(--ink-soft); transition: all .15s;
}
.chip:hover { border-color: #cbd5e1; }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
}
.agent-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s;
  display: flex; flex-direction: column; gap: 12px;
}
.agent-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #cbd5e1; }
.agent-card .ac-top { display: flex; align-items: center; gap: 12px; }
.agent-icon {
  width: 46px; height: 46px; border-radius: 12px; flex: 0 0 46px; display: grid; place-items: center;
  font-size: 24px; background: #eff6ff;
}
.agent-card h3 { font-size: 15.5px; margin: 0; }
.agent-card .ac-desc { color: var(--ink-soft); font-size: 13.5px; margin: 0; flex: 1; }
.agent-card .ac-foot { display: flex; align-items: center; justify-content: space-between; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 10px;
  border: 1px solid var(--brand); background: var(--brand); color: #fff; font-weight: 600; font-size: 13.5px;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--brand-ink); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: #fff; color: var(--brand); }
.btn.ghost:hover { background: #eff6ff; }
.btn.subtle { background: #fff; color: var(--ink-soft); border-color: var(--line); }
.btn.subtle:hover { background: #f8fafc; color: var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.empty { text-align: center; color: var(--ink-soft); padding: 50px 20px; font-size: 14px; }

/* ============================================================
   ÉCRAN WIZARD
   ============================================================ */
.wizard { max-width: 820px; }
.stepper { display: flex; align-items: center; margin-bottom: 24px; }
.step { display: flex; align-items: center; flex: 1; }
.step:last-child { flex: 0; }
.step .num {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px; display: grid; place-items: center;
  font-size: 13.5px; font-weight: 700; background: #fff; border: 2px solid var(--line); color: var(--ink-soft);
  transition: all .2s;
}
.step .lbl { font-size: 12.5px; color: var(--ink-soft); margin-left: 8px; white-space: nowrap; }
.step .bar { height: 3px; flex: 1; background: var(--line); margin: 0 10px; border-radius: 3px; transition: background .3s; }
.step.done .num { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.active .num { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 0 0 4px rgba(37,99,235,.18); }
.step.done .bar { background: var(--ok); }

.wizard-body { padding: 24px; }
.wizard-body h3 { margin: 0 0 4px; font-size: 17px; }
.wizard-body .hint { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 20px; }

.pick-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); }
.pick {
  display: flex; gap: 12px; align-items: center; padding: 14px; border: 2px solid var(--line);
  border-radius: 12px; background: #fff; text-align: left; transition: all .15s;
}
.pick:hover { border-color: #cbd5e1; }
.pick.sel { border-color: var(--brand); background: #eff6ff; }
.pick .pi { font-size: 22px; }
.pick .pt { font-weight: 600; font-size: 14px; }
.pick .ps { font-size: 12px; color: var(--ink-soft); }

.dropzone {
  border: 2px dashed #cbd5e1; border-radius: 14px; padding: 34px; text-align: center;
  background: #f8fafc; color: var(--ink-soft); transition: all .15s; cursor: pointer;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: #eff6ff; color: var(--brand-ink); }
.dropzone .dz-ic { font-size: 34px; }
.file-list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; font-size: 13.5px;
}
.file-row .fi { font-size: 18px; }
.file-row .fmeta { color: var(--ink-soft); font-size: 12px; }
.file-row .fx { margin-left: auto; color: var(--ink-soft); background: none; border: none; font-size: 15px; }
.file-row .fx:hover { color: #ef4444; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.field select, .field input[type="text"], .field textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; font-family: inherit; color: var(--ink); background: #fff; outline: none;
}
.field select:focus, .field input:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.field textarea { resize: vertical; min-height: 84px; }
.toggle-row { display: flex; gap: 10px; flex-wrap: wrap; }

.recap { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.recap-row { display: flex; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.recap-row:last-child { border-bottom: none; }
.recap-row .rk { width: 160px; flex: 0 0 160px; color: var(--ink-soft); }
.recap-row .rv { font-weight: 600; }

.result {
  border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 24px;
}
.result .result-head { display: flex; align-items: center; gap: 10px; color: var(--ok); font-weight: 700; margin-bottom: 6px; }
.result h4 { margin: 12px 0 2px; font-size: 17px; }
.result .r-meta { color: var(--ink-soft); font-size: 12.5px; margin-bottom: 16px; }
.result h5 { margin: 18px 0 6px; font-size: 14.5px; color: var(--brand-ink); }
.result p { margin: 0 0 8px; font-size: 14px; }
.result ul { margin: 4px 0 8px; padding-left: 20px; font-size: 14px; }
.result li { margin-bottom: 5px; }
.result .r-foot { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--ink-soft); font-style: italic; }

.wizard-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 24px; border-top: 1px solid var(--line);
}

/* ============================================================
   ÉCRAN HISTORIQUE + ANALYTICS
   ============================================================ */
.hist-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 18px; align-items: start; }

.table-wrap { overflow-x: auto; }
table.exec { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.exec th, table.exec td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.exec th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-soft); font-weight: 700; }
table.exec tbody tr:hover { background: #f8fafc; }
table.exec .agent-cell { display: flex; align-items: center; gap: 8px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; }
.status .sd { width: 8px; height: 8px; border-radius: 50%; }
.status.ok { color: var(--ok); } .status.ok .sd { background: var(--ok); }
.status.run { color: var(--warn); } .status.run .sd { background: var(--warn); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:.35;} }

.analytics { display: flex; flex-direction: column; gap: 18px; }
.chart-card { padding: 18px; }
.chart-card h4 { margin: 0 0 16px; font-size: 14px; }

/* Barres horizontales (par équipe) */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 108px 1fr 40px; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-track { height: 10px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; width: 0; transition: width .8s ease; }
.bar-val { text-align: right; font-weight: 700; font-size: 12.5px; }

/* Colonnes (7 jours) */
.cols { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 8px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.col .col-bar {
  width: 100%; max-width: 34px; border-radius: 8px 8px 0 0; height: 0;
  background: linear-gradient(180deg,#3b82f6,#2563eb); transition: height .8s ease;
}
.col .col-lbl { font-size: 11.5px; color: var(--ink-soft); }
.col .col-val { font-size: 11px; font-weight: 700; color: var(--brand-ink); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 18px; }
.kpi { padding: 16px; }
.kpi .k-val { font-size: 24px; font-weight: 800; }
.kpi .k-lbl { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .hist-grid { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .burger { display: grid; place-items: center; }
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .content { padding: 18px; }
  .topbar { padding: 12px 16px; }
  .kpis { grid-template-columns: 1fr; }
  .recap-row .rk { width: 120px; flex-basis: 120px; }
  .step .lbl { display: none; }
}
