/* =============================================================
   Cockpit Délégation IA — Starter Kit (maquette statique)
   Thème sombre near-black + accent or, repris du cockpit réel.
   Aucune dépendance, aucun CDN. Double-clic sur index.html = ça marche.
   ============================================================= */

:root {
  /* Couleurs (thème sombre éditorial) */
  --bg-primary: #0A0A0C;
  --bg-secondary: #141414;
  --bg-card: #161616;
  --bg-card-hover: #1d1d1d;
  --bg-muted: #1a1a1a;

  --fg-primary: #f5f1e8;
  --fg-secondary: #a8a39a;
  --fg-muted: #6e6a61;

  --border: #2a2720;
  --border-strong: #3a362d;

  --accent: #e3af35;        /* or Délégation IA */
  --accent-hover: #f0c14f;
  --accent-fg: #0A0A0C;
  --accent-muted: rgba(227, 175, 53, 0.12);

  --success: #C9A24B;
  --warning: #d9a95b;
  --danger: #c9736a;
  --info: #8aa8c4;

  /* Rayons */
  --radius: 0.75rem;
  --radius-sm: 0.375rem;
  --radius-lg: 1rem;

  --font-sans: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-primary);
  color: var(--fg-primary);
  letter-spacing: -0.005em;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  letter-spacing: -0.02em;
  font-weight: 600;
  line-height: 1.2;
}

a { color: inherit; text-decoration: none; }

/* Scrollbar minimaliste */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* =============================================================
   LAYOUT — sidebar + zone principale
   ============================================================= */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-head {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #b5862a);
  color: var(--accent-fg);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-sub {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg-primary);
}

.brand-mini {
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: var(--fg-secondary);
}

.nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--fg-secondary);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
  font-family: inherit;
}

.nav-item:hover {
  background-color: var(--bg-card-hover);
  color: var(--fg-primary);
}

.nav-item.active {
  background-color: var(--bg-card-hover);
  color: var(--fg-primary);
}

/* Taille de base de TOUTE icone .ic (evite les SVG geants hors contexte). */
.ic {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.nav-item .ic {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.sidebar-foot {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.sidebar-foot .note {
  font-size: 0.72rem;
  color: var(--fg-muted);
  line-height: 1.5;
  padding: 0.25rem 0.5rem;
}

/* Zone principale */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 56px;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar .search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  background: transparent;
}

.badge-env {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.5rem;
  border-radius: 0.3rem;
  background-color: var(--accent-muted);
  color: var(--accent);
}

.content {
  flex: 1;
  padding: 2rem;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

/* Bannière démo */
.demo-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background-color: var(--accent-muted);
  border: 1px solid rgba(227, 175, 53, 0.3);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  font-size: 0.8rem;
  margin-bottom: 1.5rem;
}

/* =============================================================
   EN-TÊTES DE PAGE
   ============================================================= */
.page-eyebrow {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--fg-muted);
}

.page-title {
  margin-top: 0.25rem;
  font-size: 1.6rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.page-title .ic {
  width: 22px; height: 22px; stroke: var(--accent); fill: none; stroke-width: 2;
}

.page-desc {
  margin-top: 0.4rem;
  font-size: 0.9rem;
  color: var(--fg-secondary);
  max-width: 42rem;
}

.section-head {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.section-eyebrow {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--fg-muted);
}

.section-sub {
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: var(--fg-secondary);
}

/* =============================================================
   CARTES / KPI / GRILLES
   ============================================================= */
.grid {
  display: grid;
  gap: 1rem;
}
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.18s ease;
}

.card.link:hover {
  border-color: var(--border-strong);
  background-color: var(--bg-card-hover);
  transform: translateY(-2px);
  cursor: pointer;
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--fg-muted);
}

.kpi-icon { width: 16px; height: 16px; stroke: var(--accent); fill: none; stroke-width: 2; }

.kpi-value {
  margin-top: 0.75rem;
  font-size: 1.7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.card-meta { font-size: 0.78rem; color: var(--fg-muted); }

/* Module tile (grille de modules) */
.tile {
  display: block;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  transition: background-color 0.15s ease, transform 0.18s ease, border-color 0.18s ease;
  cursor: pointer;
}
.tile:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.tile-icon { width: 20px; height: 20px; stroke: var(--accent); fill: none; stroke-width: 2; }
.tile-label { margin-top: 0.75rem; font-size: 0.88rem; font-weight: 600; }
.tile-desc { margin-top: 0.2rem; font-size: 0.75rem; color: var(--fg-muted); }
.tile-group { margin-top: 0.75rem; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--fg-muted); }

/* =============================================================
   LISTES
   ============================================================= */
.list { list-style: none; }
.list-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--border);
}
.list-row:first-child { border-top: none; }
.list-row .title { font-size: 0.875rem; font-weight: 500; }
.list-row .detail { margin-top: 0.2rem; font-size: 0.75rem; color: var(--fg-muted); }

/* =============================================================
   BADGES / PILLS
   ============================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.badge-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

.badge-neutral { background-color: var(--bg-muted); color: var(--fg-secondary); border: 1px solid var(--border); }
.badge-progress { background-color: rgba(138,168,196,0.1); color: var(--info); border: 1px solid rgba(138,168,196,0.3); }
.badge-done { background-color: rgba(201,162,75,0.1); color: var(--success); border: 1px solid rgba(201,162,75,0.3); }
.badge-warn { background-color: rgba(217,169,91,0.1); color: var(--warning); border: 1px solid rgba(217,169,91,0.3); }
.badge-accent { background-color: var(--accent-muted); color: var(--accent); border: 1px solid rgba(227,175,53,0.3); }

.tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 0.3rem;
  color: var(--fg-secondary);
  background-color: var(--bg-muted);
}

/* Carte projet (bordure gauche colorée) */
.project-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem;
}
.project-card .meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.project-next {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: var(--fg-secondary);
  line-height: 1.45;
}
.project-next .lbl { color: var(--fg-muted); }

/* Barre de progression */
.progress {
  height: 8px;
  border-radius: 99px;
  background-color: var(--bg-muted);
  overflow: hidden;
  margin-top: 1rem;
}
.progress-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
}

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.btn-primary { background-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--fg-secondary); }
.btn-ghost:hover { background-color: var(--bg-muted); color: var(--fg-primary); }

/* Agent IA — fausse fenêtre de chat */
.chat {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
}
.bubble {
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  font-size: 0.85rem;
  line-height: 1.5;
  max-width: 85%;
  margin-bottom: 0.7rem;
}
.bubble-ai { background-color: var(--bg-muted); color: var(--fg-primary); border: 1px solid var(--border); }
.bubble-me { background-color: var(--accent-muted); color: var(--fg-primary); border: 1px solid rgba(227,175,53,0.3); margin-left: auto; }

.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--fg-muted);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.muted { color: var(--fg-muted); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

/* Animation d'apparition */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.page { animation: fade-in 0.25s ease-out; }

/* Hamburger (mobile) */
.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-secondary);
  padding: 0.4rem;
  cursor: pointer;
}
.menu-toggle .ic { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

.backdrop { display: none; }

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 920px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 60;
    box-shadow: 0 0 40px rgba(0,0,0,0.6);
  }
  .layout.nav-open .sidebar { transform: translateX(0); }
  .layout.nav-open .backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 50;
  }
  .menu-toggle { display: inline-flex; }
  .content { padding: 1.25rem; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .topbar .search span.label { display: none; }
}
