/* ===========================================================================
   BizCoRa - Documentation (espace de doc premium, type SaaS / Google Cloud)
   Chrome dedie : topbar + sidebar (sommaire) + contenu + sommaire de page.
   S'appuie sur les tokens de theme.css (charge avant). Self-contained sinon.
   =========================================================================== */
:root {
  --doc-brand: var(--brand-500, #4361EE);
  --doc-brand-d: var(--brand-700, #3f37c9);
  --doc-ink: #0f172a;
  --doc-ink-soft: #475569;
  --doc-muted: #64748b;
  --doc-line: #e7eaf0;
  --doc-bg: #ffffff;
  --doc-bg-soft: #f7f9fc;
  --doc-bg-rail: #fbfcfe;
  --doc-radius: 14px;
  --doc-sidebar-w: 290px;
  --doc-toc-w: 232px;
  --doc-topbar-h: 62px;
  --doc-shadow: 0 10px 30px rgba(15,23,42,.08), 0 2px 8px rgba(15,23,42,.04);
  --doc-font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.docs * { box-sizing: border-box; }
.docs { margin: 0; font-family: var(--doc-font); color: var(--doc-ink); background: var(--doc-bg);
  -webkit-font-smoothing: antialiased; line-height: 1.6; }
.docs a { color: var(--doc-brand-d); text-decoration: none; }
.docs a:hover { text-decoration: underline; }

/* ---------- Topbar ---------- */
.doc-topbar {
  position: sticky; top: 0; z-index: 50; height: var(--doc-topbar-h);
  display: flex; align-items: center; gap: 18px; padding: 0 20px;
  background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--doc-line);
}
.doc-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; color: var(--doc-ink); white-space: nowrap; }
.doc-brand img { height: 30px; width: auto; }
.doc-brand .ra { color: var(--doc-brand); }
.doc-brand .tag { font-weight: 700; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--doc-muted); padding-left: 8px; border-left: 1px solid var(--doc-line); margin-left: 4px; }
.doc-topbar .spacer { flex: 1; }
.doc-topbar .top-links { display: flex; align-items: center; gap: 18px; font-weight: 600; font-size: .92rem; }
.doc-topbar .top-links a { color: var(--doc-ink-soft); }
.doc-lang { display: inline-flex; gap: 4px; border: 1px solid var(--doc-line); border-radius: 999px; padding: 3px; }
.doc-lang a { font-size: .78rem; font-weight: 700; color: var(--doc-muted); padding: 3px 9px; border-radius: 999px; }
.doc-lang a.is-active { background: var(--doc-brand); color: #fff; }
.doc-burger { display: none; border: 1px solid var(--doc-line); background: #fff; border-radius: 10px; width: 40px; height: 40px; align-items: center; justify-content: center; cursor: pointer; }
.doc-burger svg { width: 22px; height: 22px; stroke: var(--doc-ink); }

/* ---------- Search ---------- */
.doc-search { position: relative; flex: 0 1 460px; }
.doc-search input {
  width: 100%; height: 42px; border: 1px solid var(--doc-line); border-radius: 12px;
  padding: 0 14px 0 42px; font-size: .95rem; font-family: inherit; color: var(--doc-ink);
  background: var(--doc-bg-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 13px center;
}
.doc-search input:focus { outline: none; border-color: var(--doc-brand); box-shadow: 0 0 0 3px rgba(67,97,238,.15); background-color: #fff; }
.doc-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 600 .72rem var(--doc-font); color: var(--doc-muted); background: #fff; border: 1px solid var(--doc-line); border-radius: 6px; padding: 2px 6px; }
.doc-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; max-height: 60vh; overflow: auto;
  background: #fff; border: 1px solid var(--doc-line); border-radius: 14px; box-shadow: var(--doc-shadow);
  padding: 6px; display: none; z-index: 60;
}
.doc-results.open { display: block; }
.doc-results .r {
  display: block; padding: 10px 12px; border-radius: 10px; color: var(--doc-ink);
}
.doc-results .r:hover, .doc-results .r.active { background: var(--doc-bg-soft); text-decoration: none; }
.doc-results .r .rt { font-weight: 700; font-size: .92rem; }
.doc-results .r .rc { font-size: .76rem; color: var(--doc-brand-d); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.doc-results .r .rs { font-size: .84rem; color: var(--doc-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.doc-results .empty { padding: 16px; color: var(--doc-muted); font-size: .9rem; text-align: center; }
.doc-results mark { background: rgba(255,183,3,.35); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- Layout ---------- */
.doc-shell { display: grid; grid-template-columns: var(--doc-sidebar-w) minmax(0,1fr) var(--doc-toc-w); align-items: start; max-width: 1500px; margin: 0 auto; }
@media (max-width: 1180px) { .doc-shell { grid-template-columns: var(--doc-sidebar-w) minmax(0,1fr); } .doc-toc { display: none; } }
@media (max-width: 880px) { .doc-shell { grid-template-columns: 1fr; } .doc-burger { display: inline-flex; } }

/* ---------- Sidebar (sommaire) ---------- */
.doc-sidebar {
  position: sticky; top: var(--doc-topbar-h); align-self: start;
  height: calc(100vh - var(--doc-topbar-h)); overflow-y: auto;
  border-right: 1px solid var(--doc-line); background: var(--doc-bg-rail);
  padding: 22px 14px 60px;
}
.doc-sidebar .nav-home { display: block; font-weight: 800; color: var(--doc-ink); padding: 8px 12px; border-radius: 10px; margin-bottom: 6px; }
.doc-sidebar .nav-home:hover { background: #fff; text-decoration: none; }
.doc-cat { margin-top: 16px; }
.doc-cat > .cat-title { font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--doc-muted); padding: 6px 12px; display: flex; align-items: center; gap: 8px; }
.doc-cat > .cat-title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--doc-brand); opacity: .6; }
.doc-cat .nav-link {
  display: block; font-size: .9rem; color: var(--doc-ink-soft); padding: 7px 12px 7px 28px; border-radius: 9px; position: relative;
}
.doc-cat .nav-link:hover { background: #fff; color: var(--doc-ink); text-decoration: none; }
.doc-cat .nav-link.is-active { background: rgba(67,97,238,.10); color: var(--doc-brand-d); font-weight: 700; }
.doc-cat .nav-link.is-active::before { content: ""; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 3px; height: 16px; border-radius: 3px; background: var(--doc-brand); }

/* overlay mobile */
.doc-sidebar-backdrop { display: none; position: fixed; inset: var(--doc-topbar-h) 0 0 0; background: rgba(15,23,42,.45); z-index: 39; }
@media (max-width: 880px) {
  .doc-sidebar { position: fixed; top: var(--doc-topbar-h); left: 0; width: 320px; max-width: 88vw; z-index: 40; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--doc-shadow); }
  .doc-sidebar.open { transform: translateX(0); }
  body.doc-nav-open .doc-sidebar-backdrop { display: block; }
}

/* ---------- Contenu ---------- */
.doc-main { min-width: 0; padding: 36px clamp(20px, 4vw, 56px) 90px; }
.doc-breadcrumb { font-size: .82rem; color: var(--doc-muted); margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.doc-breadcrumb a { color: var(--doc-muted); }
.doc-breadcrumb .sep { opacity: .5; }
.doc-article { max-width: 820px; }
.doc-article h1 { font-size: clamp(1.8rem, 3.4vw, 2.5rem); line-height: 1.15; letter-spacing: -.01em; margin: 0 0 12px; color: var(--doc-ink); }
.doc-lead { font-size: 1.12rem; color: var(--doc-ink-soft); margin: 0 0 22px; }
.doc-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 26px; }
.role-badge { font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--doc-line); color: var(--doc-ink-soft); background: #fff; }
.role-badge.all { color: #1f7a6f; border-color: rgba(42,157,143,.4); background: rgba(42,157,143,.08); }
.role-badge.admin { color: var(--doc-brand-d); border-color: rgba(67,97,238,.4); background: rgba(67,97,238,.08); }

.doc-section { margin-top: 38px; scroll-margin-top: calc(var(--doc-topbar-h) + 16px); }
.doc-section > h2 { font-size: 1.32rem; line-height: 1.3; margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--doc-line); color: var(--doc-ink); display: flex; align-items: center; gap: 10px; }
.doc-section > h2 .ic { width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; background: rgba(67,97,238,.1); color: var(--doc-brand-d); flex: 0 0 auto; }
.doc-section > h2 .ic svg { width: 15px; height: 15px; }
.doc-section p { margin: 0 0 12px; color: var(--doc-ink-soft); }
.doc-section.steps ol { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.doc-section.steps li { counter-increment: step; position: relative; padding: 0 0 14px 44px; }
.doc-section.steps li::before { content: counter(step); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--doc-brand), var(--doc-brand-d)); color: #fff; font-weight: 800; font-size: .9rem; display: grid; place-items: center; }
.doc-section.list ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.doc-section.list li { position: relative; padding-left: 26px; color: var(--doc-ink-soft); }
.doc-section.list li::before { content: ""; position: absolute; left: 4px; top: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--doc-brand); }
.doc-callout { border: 1px solid var(--doc-line); border-left: 4px solid var(--doc-brand); background: var(--doc-bg-soft); border-radius: 12px; padding: 14px 16px; margin: 0 0 12px; }
.doc-callout.warn { border-left-color: #E63946; background: #fdf2f3; }
.doc-callout .ct { font-weight: 800; margin-bottom: 4px; color: var(--doc-ink); }
.doc-section.errors .err { border: 1px solid var(--doc-line); border-radius: 12px; padding: 12px 14px; margin: 0 0 10px; background: #fff; }
.doc-section.errors .err .msg { font-weight: 800; color: #b42318; }
.doc-section.errors .err .sol { color: var(--doc-ink-soft); font-size: .92rem; margin-top: 4px; }

.doc-pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 54px; padding-top: 22px; border-top: 1px solid var(--doc-line); }
.doc-pager a { flex: 1; border: 1px solid var(--doc-line); border-radius: 12px; padding: 14px 16px; }
.doc-pager a:hover { border-color: var(--doc-brand); text-decoration: none; box-shadow: var(--doc-shadow); }
.doc-pager .dir { font-size: .74rem; color: var(--doc-muted); text-transform: uppercase; letter-spacing: .06em; }
.doc-pager .ttl { font-weight: 700; color: var(--doc-ink); }
.doc-pager .next { text-align: right; }

/* ---------- TOC (sur cette page) ---------- */
.doc-toc { position: sticky; top: var(--doc-topbar-h); align-self: start; height: calc(100vh - var(--doc-topbar-h)); overflow-y: auto; padding: 36px 18px; }
.doc-toc .toc-title { font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--doc-muted); margin-bottom: 10px; }
.doc-toc a { display: block; font-size: .85rem; color: var(--doc-muted); padding: 5px 10px; border-left: 2px solid var(--doc-line); }
.doc-toc a:hover { color: var(--doc-ink); text-decoration: none; }
.doc-toc a.is-active { color: var(--doc-brand-d); border-left-color: var(--doc-brand); font-weight: 600; }

/* ---------- Landing (sommaire general) ---------- */
.doc-hero { padding: 56px clamp(20px,5vw,64px) 30px; max-width: 1100px; margin: 0 auto; text-align: center; }
.doc-hero .eyebrow { font-size: .8rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--doc-brand-d); }
.doc-hero h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; margin: 12px 0 14px; letter-spacing: -.02em; }
.doc-hero p { font-size: 1.15rem; color: var(--doc-ink-soft); max-width: 720px; margin: 0 auto 26px; }
.doc-hero .doc-search { margin: 0 auto; flex-basis: 600px; max-width: 90%; }
.doc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 18px; max-width: 1200px; margin: 10px auto 80px; padding: 0 clamp(20px,4vw,40px); }
.doc-card { border: 1px solid var(--doc-line); border-radius: var(--doc-radius); padding: 22px; background: #fff; transition: box-shadow .15s, border-color .15s, transform .15s; }
.doc-card:hover { box-shadow: var(--doc-shadow); border-color: rgba(67,97,238,.4); transform: translateY(-2px); text-decoration: none; }
.doc-card .c-ic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, var(--doc-brand), var(--doc-brand-d)); color: #fff; margin-bottom: 12px; }
.doc-card .c-ic svg { width: 22px; height: 22px; }
.doc-card h3 { margin: 0 0 6px; font-size: 1.08rem; color: var(--doc-ink); }
.doc-card p { margin: 0 0 10px; font-size: .9rem; color: var(--doc-muted); }
.doc-card .c-count { font-size: .78rem; font-weight: 700; color: var(--doc-brand-d); }

.doc-footer { border-top: 1px solid var(--doc-line); padding: 26px 20px; text-align: center; color: var(--doc-muted); font-size: .86rem; }
.doc-footer a { color: var(--doc-ink-soft); }

@media print { .doc-topbar, .doc-sidebar, .doc-toc, .doc-pager, .doc-burger { display: none !important; } .doc-shell { display: block; } }
