/* ============================================================
   EDM — Espace interne · design system
   Une seule source de vérité : tokens + layout + sidebar + contenu.
   Identité reprise des rapports PDF (br_pdf.py / weekly_recap.py).
   ============================================================ */

:root {
  /* Marque */
  --edm-marine: #0d2440;
  --edm-blue: #1f6feb;
  --edm-blue-light: #87b1ff;
  /* Statut (réservé — jamais décoratif) */
  --edm-green: #2da44e;
  --edm-orange: #f59e0b;
  --edm-red: #d1242f;
  /* Neutres */
  --edm-page: #f6f8fb;
  --edm-surface: #ffffff;
  --edm-ink: #14212e;
  --edm-ink-2: #4a5a6a;
  --edm-muted: #8494a4;
  --edm-hairline: #e3e9f0;
  --edm-row-alt: #f9fbfd;
  /* Géométrie */
  --edm-radius: 12px;
  --edm-radius-s: 8px;
  --edm-sidebar-w: 264px;
  --edm-shadow: 0 2px 10px rgba(13, 36, 64, .07);
  --edm-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --edm-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--edm-page);
  color: var(--edm-ink);
  font-family: var(--edm-font);
  font-size: 14.5px;
  line-height: 1.55;
}

/* ---------- Layout : sidebar + contenu ---------- */
.edm-layout { display: flex; min-height: 100vh; }
.edm-content { flex: 1; min-width: 0; padding: 34px 44px 60px; }
.edm-content-inner { max-width: 920px; margin: 0 auto; }
.edm-content-inner.wide { max-width: 1200px; }

/* ---------- Sidebar (marine) ---------- */
.edm-sidebar {
  width: var(--edm-sidebar-w); flex: 0 0 var(--edm-sidebar-w);
  background: var(--edm-marine); color: #fff;
  padding: 20px 12px 30px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.edm-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 10px 16px; margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  text-decoration: none; color: #fff;
}
.edm-brand .logo-chip {
  background: #fff; border-radius: 8px; padding: 4px 7px;
  display: flex; align-items: center; flex: 0 0 auto;
}
.edm-brand .logo-chip img { height: 26px; display: block; }
.edm-brand .t { font-size: 13.5px; font-weight: 650; line-height: 1.25; }
.edm-brand .t small { display: block; font-weight: 450; font-size: 11px; color: var(--edm-blue-light); }
.edm-rubrique {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .09em; color: var(--edm-blue-light);
  margin: 18px 10px 6px;
}
.edm-sidebar a.nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 7.5px 10px; border-radius: var(--edm-radius-s);
  color: rgba(255, 255, 255, .86); text-decoration: none;
  font-size: 13.5px; margin-bottom: 1px;
}
.edm-sidebar a.nav-link:hover { background: rgba(255, 255, 255, .08); }
.edm-sidebar a.nav-link.active { background: var(--edm-blue); color: #fff; font-weight: 600; }
.edm-sidebar details.section { margin: 1px 0; }
.edm-sidebar details.section > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px; border-radius: var(--edm-radius-s);
  font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, .72);
}
.edm-sidebar details.section > summary::-webkit-details-marker { display: none; }
.edm-sidebar details.section > summary::before { content: '▸'; font-size: 10px; color: var(--edm-blue-light); }
.edm-sidebar details.section[open] > summary::before { content: '▾'; }
.edm-sidebar details.section > summary:hover { background: rgba(255, 255, 255, .08); }
.edm-sidebar details.section a.nav-link { padding-left: 28px; font-size: 13px; }

/* Burger mobile */
.edm-burger {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 50;
  background: var(--edm-marine); color: #fff; border: none;
  border-radius: var(--edm-radius-s); padding: 9px 12px; font-size: 16px; cursor: pointer;
}
@media (max-width: 780px) {
  .edm-layout { flex-direction: column; }
  .edm-burger { display: block; }
  .edm-sidebar { position: fixed; z-index: 40; height: 100vh; transform: translateX(-100%);
                 transition: transform .18s ease; width: 280px; }
  .edm-sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.25); }
  .edm-content { padding: 60px 18px 40px; }
}

/* ---------- Titres & texte (contenu + markdown) ---------- */
.edm-md h1, .edm-content h1 {
  font-size: 26px; font-weight: 750; color: var(--edm-marine);
  letter-spacing: -.01em; margin: 0 0 6px; line-height: 1.25;
}
.edm-md h2 {
  font-size: 19px; font-weight: 700; color: var(--edm-marine);
  margin: 30px 0 12px; padding-bottom: 6px;
  border-bottom: 1px solid var(--edm-hairline);
}
.edm-md h3 { font-size: 15.5px; font-weight: 650; margin: 22px 0 8px; }
.edm-md p, .edm-md li { line-height: 1.65; }
.edm-md a, .edm-content a { color: var(--edm-blue); text-decoration: none; }
.edm-md a:hover, .edm-content a:hover { text-decoration: underline; }
.edm-md blockquote {
  margin: 14px 0; padding: 10px 16px;
  border-left: 3px solid var(--edm-blue-light);
  background: var(--edm-surface); border-radius: 0 var(--edm-radius-s) var(--edm-radius-s) 0;
  color: var(--edm-ink-2);
}
.edm-md blockquote p { margin: 0; }
.edm-md code {
  background: #eef3f9; border: 1px solid var(--edm-hairline); border-radius: 5px;
  padding: 1px 6px; font-size: 12.5px; font-family: var(--edm-mono); color: var(--edm-marine);
}
.edm-md pre {
  background: var(--edm-marine); color: #dce7f5;
  border-radius: var(--edm-radius-s); padding: 14px 16px;
  overflow-x: auto; font-size: 12.5px; line-height: 1.5;
}
.edm-md pre code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; }
.edm-md hr { border: none; border-top: 1px solid var(--edm-hairline); margin: 26px 0; }
.edm-md img { max-width: 100%; }
.edm-md ul, .edm-md ol { padding-left: 24px; }

/* Tables markdown & contenu */
.edm-md .table-wrap { overflow-x: auto; margin: 14px 0; border: 1px solid var(--edm-hairline);
                      border-radius: var(--edm-radius-s); background: var(--edm-surface); }
.edm-md table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.edm-md th {
  background: var(--edm-marine); color: #fff; text-align: left;
  font-weight: 600; padding: 9px 14px; font-size: 12.5px; white-space: nowrap;
}
.edm-md td { padding: 8px 14px; border-top: 1px solid #eef2f7; vertical-align: top; }
.edm-md tr:nth-child(even) td { background: var(--edm-row-alt); }

/* ---------- Composants ---------- */
.edm-card {
  background: var(--edm-surface); border: 1px solid var(--edm-hairline);
  border-radius: var(--edm-radius); overflow: hidden;
}
.edm-tile {
  background: var(--edm-surface); border: 1px solid var(--edm-hairline);
  border-radius: var(--edm-radius); padding: 16px 18px;
}
.edm-tile .k { font-size: 12px; color: var(--edm-muted); font-weight: 600; }
.edm-tile .v { font-size: 26px; font-weight: 750; color: var(--edm-marine); margin: 4px 0 2px; }
.edm-tile .d { font-size: 12.5px; color: var(--edm-ink-2); }
.edm-up { color: var(--edm-green); font-weight: 600; }
.edm-down { color: var(--edm-red); font-weight: 600; }

a.edm-bigcard {
  display: block; background: var(--edm-surface); border: 1px solid var(--edm-hairline);
  border-radius: var(--edm-radius); padding: 18px; text-decoration: none; color: var(--edm-ink);
  transition: border-color .12s, box-shadow .12s;
}
a.edm-bigcard:hover { border-color: var(--edm-blue); box-shadow: var(--edm-shadow); text-decoration: none; }
.edm-bigcard .ico { font-size: 22px; }
.edm-bigcard .t { font-weight: 650; font-size: 15px; color: var(--edm-marine); margin: 8px 0 4px; }
.edm-bigcard .d { font-size: 13px; color: var(--edm-ink-2); line-height: 1.5; }

.edm-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px;
  background: var(--edm-surface); border: 1px solid var(--edm-hairline);
  border-radius: 999px; font-size: 13px; font-weight: 600;
}
.edm-status {
  width: 18px; height: 18px; border-radius: 50%; color: #fff;
  font-size: 12px; font-weight: 700; text-align: center; line-height: 18px; flex: 0 0 auto;
}
.edm-status.ok { background: var(--edm-green); }
.edm-status.warn { background: var(--edm-orange); color: var(--edm-ink); }
.edm-status.error { background: var(--edm-red); }

.edm-sub { color: var(--edm-muted); font-size: 14px; margin: 0 0 24px; }
.edm-section-label {
  font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--edm-ink-2); margin: 30px 0 12px; font-weight: 700;
}
.edm-foot {
  margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--edm-hairline);
  color: var(--edm-muted); font-size: 12.5px;
}

/* Selects & inputs (pages KPI) */
.edm-select, select.edm {
  padding: 8px 12px; border: 1px solid var(--edm-hairline); border-radius: var(--edm-radius-s);
  font-size: 13px; background: var(--edm-surface); color: var(--edm-ink);
  cursor: pointer; font-family: var(--edm-font);
}
