/* ==========================================================================
   CRM Chelly Docs — thème
   ========================================================================== */

:root {
    --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", "Cascadia Code", "Fira Code", ui-monospace, Consolas, monospace;

    --topbar-h: 60px;
    --sidebar-w: 284px;
    --toc-w: 232px;
    --content-w: 780px;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;

    /* clair */
    --bg: #ffffff;
    --bg-soft: #fafafa;
    --bg-muted: #f4f4f5;
    --bg-hover: #f0f0f2;
    --surface: #ffffff;
    --border: #e7e7ea;
    --border-strong: #d6d6db;
    --text: #18181b;
    --text-soft: #3f3f46;
    --text-muted: #71717a;

    --accent: #059669;
    --accent-strong: #047857;
    --accent-soft: #ecfdf5;
    --accent-border: #a7f3d0;
    --link: #047857;

    --shadow-sm: 0 1px 2px rgb(16 16 24 / .05);
    --shadow: 0 1px 2px rgb(16 16 24 / .04), 0 8px 24px -8px rgb(16 16 24 / .12);
    --shadow-lg: 0 24px 64px -12px rgb(16 16 24 / .28);

    /* encadrés */
    --note-bg: #eff6ff;   --note-border: #bfdbfe;   --note-fg: #1d4ed8;
    --tip-bg: #ecfdf5;    --tip-border: #a7f3d0;    --tip-fg: #047857;
    --warn-bg: #fffbeb;   --warn-border: #fde68a;   --warn-fg: #b45309;
    --danger-bg: #fef2f2; --danger-border: #fecaca; --danger-fg: #b91c1c;

    /* blocs de code : sombres dans les deux thèmes */
    --code-bg: #15151b;
    --code-head: #1c1c24;
    --code-border: #26262f;
    --code-fg: #e4e4ea;
    --code-muted: #8a8a99;

    --inline-code-bg: #f1f1f4;
    --inline-code-fg: #be185d;

    /* teintes des sections */
    --tone-blue: #2563eb;
    --tone-green: #059669;
    --tone-teal: #0d9488;
    --tone-orange: #ea580c;
    --tone-violet: #7c3aed;
    --tone-slate: #475569;
    --tone-pink: #db2777;
    --tone-amber: #d97706;

    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0d0d10;
    --bg-soft: #111115;
    --bg-muted: #18181d;
    --bg-hover: #1d1d23;
    --surface: #141418;
    --border: #232329;
    --border-strong: #31313a;
    --text: #ececf1;
    --text-soft: #c4c4cc;
    --text-muted: #8c8c98;

    --accent: #34d399;
    --accent-strong: #6ee7b7;
    --accent-soft: rgb(52 211 153 / .1);
    --accent-border: rgb(52 211 153 / .3);
    --link: #6ee7b7;

    --shadow-sm: none;
    --shadow: 0 0 0 1px rgb(255 255 255 / .02), 0 8px 24px -8px rgb(0 0 0 / .6);
    --shadow-lg: 0 24px 64px -12px rgb(0 0 0 / .8);

    --note-bg: rgb(59 130 246 / .1);   --note-border: rgb(59 130 246 / .3);   --note-fg: #93c5fd;
    --tip-bg: rgb(16 185 129 / .1);    --tip-border: rgb(16 185 129 / .3);    --tip-fg: #6ee7b7;
    --warn-bg: rgb(245 158 11 / .1);   --warn-border: rgb(245 158 11 / .3);   --warn-fg: #fcd34d;
    --danger-bg: rgb(239 68 68 / .1);  --danger-border: rgb(239 68 68 / .32); --danger-fg: #fca5a5;

    --code-bg: #101015;
    --code-head: #16161c;
    --code-border: #26262e;

    --inline-code-bg: #1e1e25;
    --inline-code-fg: #f9a8d4;

    --tone-blue: #60a5fa;
    --tone-green: #34d399;
    --tone-teal: #2dd4bf;
    --tone-orange: #fb923c;
    --tone-violet: #a78bfa;
    --tone-slate: #94a3b8;
    --tone-pink: #f472b6;
    --tone-amber: #fbbf24;

    color-scheme: dark;
}

.tone-blue   { --tone: var(--tone-blue); }
.tone-green  { --tone: var(--tone-green); }
.tone-teal   { --tone: var(--tone-teal); }
.tone-orange { --tone: var(--tone-orange); }
.tone-violet { --tone: var(--tone-violet); }
.tone-slate  { --tone: var(--tone-slate); }
.tone-pink   { --tone: var(--tone-pink); }
.tone-amber  { --tone: var(--tone-amber); }

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-padding-top: calc(var(--topbar-h) + 24px);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.65;
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--link); }

kbd {
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 5px;
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    background: var(--surface);
    color: var(--text-muted);
    white-space: nowrap;
}

::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 100;
    padding: 8px 14px;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; }

/* ---------- Barre du haut ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    min-width: calc(var(--sidebar-w) - 36px);
}
.brand img { width: 28px; height: 28px; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.brand-tag {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-strong);
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    padding: 1px 8px;
    border-radius: 999px;
}

.search-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 420px;
    height: 38px;
    padding: 0 8px 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-muted);
    color: var(--text-muted);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.search-trigger:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.search-trigger span { flex: 1; text-align: left; }

.topbar-actions { margin-left: auto; display: flex; gap: 6px; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-soft);
    font-size: 17px;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

.menu-btn, .search-mobile { display: none; }

:root[data-theme="light"] .theme-dark,
:root[data-theme="dark"] .theme-light { display: none; }

/* ---------- Mise en page ---------- */

.layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
    max-width: 1480px;
    margin: 0 auto;
}

/* ---------- Menu latéral ---------- */

.sidebar {
    position: sticky;
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    height: calc(100dvh - var(--topbar-h));
    overflow-y: auto;
    padding: 20px 14px 48px 20px;
    border-right: 1px solid var(--border);
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.nav-group + .nav-group { margin-top: 22px; }

.nav-title {
    margin: 0 0 6px;
    padding: 0 10px;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
}

.sidebar ul { list-style: none; margin: 0; padding: 0; }

.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    text-decoration: none;
    font-size: 14.5px;
    line-height: 1.4;
    transition: background .12s, color .12s;
}
.sidebar a i { color: var(--tone); font-size: 15px; opacity: .9; }
.sidebar a:hover { background: var(--bg-hover); color: var(--text); }
.sidebar a.active {
    background: color-mix(in srgb, var(--tone) 11%, transparent);
    color: var(--text);
    font-weight: 600;
    box-shadow: inset 2px 0 0 var(--tone);
}

/* ---------- Contenu ---------- */

.main {
    min-width: 0;
    padding: 36px 56px 40px;
}

.main > * { max-width: var(--content-w); margin-left: auto; margin-right: auto; }

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--tone);
    margin-bottom: 10px;
}
.breadcrumb i { font-size: 10px; color: var(--text-muted); }
.breadcrumb span:last-child { color: var(--text-muted); font-weight: 500; }

/* ---------- Typographie ---------- */

.prose { color: var(--text-soft); }

.prose h1 {
    margin: 0 0 12px;
    font-size: clamp(28px, 3.4vw, 36px);
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -.025em;
    color: var(--text);
}

.prose .lead {
    margin: 0 0 36px;
    font-size: 18px;
    line-height: 1.6;
    color: var(--text-muted);
}

.prose h2 {
    margin: 52px 0 16px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
    font-size: 23px;
    line-height: 1.3;
    font-weight: 650;
    letter-spacing: -.015em;
    color: var(--text);
}
.prose .lead + h2, .prose h1 + h2 { border-top: 0; padding-top: 0; margin-top: 36px; }

.prose h3 {
    margin: 32px 0 10px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--text);
}

.prose h2, .prose h3 { position: relative; }
.prose .anchor {
    margin-left: 8px;
    font-size: .75em;
    color: var(--text-muted);
    text-decoration: none;
    opacity: 0;
    transition: opacity .15s;
}
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose .anchor:focus { opacity: 1; }
.prose .anchor:hover { color: var(--accent); }

.prose p { margin: 0 0 16px; }

.prose a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent);
    text-underline-offset: 3px;
    font-weight: 500;
}
.prose a:hover { text-decoration-color: currentColor; }

.prose strong { color: var(--text); font-weight: 600; }

.prose ul, .prose ol { margin: 0 0 18px; padding-left: 22px; }
.prose li { margin: 6px 0; }
.prose li::marker { color: var(--text-muted); }

.prose hr { border: 0; border-top: 1px solid var(--border); margin: 40px 0; }

/* Code en ligne : un clic = copie */
.prose :not(pre) > code {
    font-family: var(--font-mono);
    font-size: .86em;
    padding: .15em .42em;
    border-radius: 5px;
    background: var(--inline-code-bg);
    color: var(--inline-code-fg);
    border: 1px solid color-mix(in srgb, var(--inline-code-fg) 14%, transparent);
    white-space: nowrap;
    cursor: copy;
    transition: background .12s;
}
.prose :not(pre) > code:hover { background: color-mix(in srgb, var(--inline-code-fg) 12%, var(--inline-code-bg)); }

/* Éléments d'interface du CRM : boutons, menus, onglets */
.ui {
    display: inline-block;
    padding: 0 .45em;
    border-radius: 5px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--text);
    font-size: .9em;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}
.ui i { margin-right: .3em; color: var(--text-muted); }

/* Chemin de menus : Réglages › Paramètres › API */
.path { white-space: normal; }
.path .ui + .ui { position: relative; margin-left: 1.15em; }
.path .ui + .ui::before {
    content: "›";
    position: absolute;
    left: -.9em;
    color: var(--text-muted);
    font-weight: 500;
}

/* Mise en évidence d'un terme */
.prose mark {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    color: var(--text);
    padding: 0 .2em;
    border-radius: 3px;
}

/* ---------- Encadrés ---------- */

.callout {
    display: flex;
    gap: 12px;
    margin: 20px 0;
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--note-border);
    background: var(--note-bg);
    color: var(--text-soft);
    font-size: 15px;
}
.callout > i { margin-top: 4px; color: var(--note-fg); font-size: 16px; flex: none; }
.callout > div > :last-child { margin-bottom: 0; }
.callout strong:first-child { color: var(--note-fg); }
.callout p { margin: 0 0 8px; }
.callout ul { margin: 6px 0 0; }

.callout.tip    { background: var(--tip-bg);    border-color: var(--tip-border); }
.callout.tip > i, .callout.tip strong:first-child { color: var(--tip-fg); }
.callout.warn   { background: var(--warn-bg);   border-color: var(--warn-border); }
.callout.warn > i, .callout.warn strong:first-child { color: var(--warn-fg); }
.callout.danger { background: var(--danger-bg); border-color: var(--danger-border); }
.callout.danger > i, .callout.danger strong:first-child { color: var(--danger-fg); }

/* ---------- Étapes numérotées ---------- */

.steps {
    list-style: none;
    counter-reset: step;
    margin: 24px 0 28px;
    padding: 0;
}
.steps > li {
    counter-increment: step;
    position: relative;
    margin: 0;
    padding: 0 0 24px 46px;
}
.steps > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    color: var(--accent-strong);
    font-size: 13.5px;
    font-weight: 700;
}
.steps > li::after {
    content: "";
    position: absolute;
    left: 14.5px;
    top: 36px;
    bottom: 6px;
    width: 1px;
    background: var(--border);
}
.steps > li:last-child { padding-bottom: 0; }
.steps > li:last-child::after { display: none; }
.steps > li > :first-child { margin-top: 3px; }
.steps > li > p:last-child { margin-bottom: 0; }
.steps .step-title { display: block; color: var(--text); font-weight: 600; margin-bottom: 4px; }

/* ---------- Captures d'écran ---------- */

.shot {
    margin: 18px 0 24px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-muted);
    overflow: hidden;
}
.shot img {
    display: block;
    width: 100%;
    height: auto;
    cursor: zoom-in;
    background: #fff;
}
.shot.narrow { max-width: 520px; }
.shot.medium { max-width: 640px; }
.shot figcaption {
    padding: 9px 14px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
    background: var(--surface);
}
.shot figcaption i { margin-right: 6px; }

/* Vidéos de démonstration (GIF) */
.shot.demo { position: relative; }
.shot.demo::after {
    content: "\25B6\00a0 Démo";
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgb(0 0 0 / .62);
    color: #fff;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .02em;
    pointer-events: none;
}

/* ---------- Tableaux ---------- */

.table-wrap {
    margin: 18px 0 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
}
.prose th {
    text-align: left;
    padding: 10px 14px;
    background: var(--bg-muted);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.prose td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.prose tr:last-child td { border-bottom: 0; }
.prose td:first-child { white-space: nowrap; }
.prose td .muted { color: var(--text-muted); font-size: 13.5px; }

.type {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text-muted);
}

.badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
    vertical-align: 1px;
    white-space: nowrap;
}
.badge.req { background: var(--danger-bg); color: var(--danger-fg); border: 1px solid var(--danger-border); }
.badge.opt { background: var(--bg-muted); color: var(--text-muted); border: 1px solid var(--border); }
.badge.new { background: var(--accent-soft); color: var(--accent-strong); border: 1px solid var(--accent-border); }

/* ---------- Endpoint API ---------- */

.endpoint {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
    font-family: var(--font-mono);
    font-size: 14px;
    overflow-x: auto;
}
.method {
    flex: none;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    font-family: var(--font-sans);
}
.method.post { background: var(--tip-bg); color: var(--tip-fg); border: 1px solid var(--tip-border); }
.method.get  { background: var(--note-bg); color: var(--note-fg); border: 1px solid var(--note-border); }
.endpoint .url { color: var(--text); white-space: nowrap; }
.endpoint .url var { font-style: normal; color: var(--accent-strong); }
.endpoint .ct {
    margin-left: auto;
    flex: none;
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-sans);
}

/* Fiche récap (clé / valeur) */
.specs {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0;
    margin: 18px 0 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 14.5px;
}
.specs dt, .specs dd { margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.specs dt { color: var(--text-muted); font-weight: 500; background: var(--bg-soft); }
.specs dd { color: var(--text); }
.specs dt:last-of-type, .specs dd:last-of-type { border-bottom: 0; }

/* ---------- Blocs de code ---------- */

.code-block {
    margin: 18px 0 24px;
    border: 1px solid var(--code-border);
    border-radius: var(--radius);
    background: var(--code-bg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.code-head {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 0 6px 0 14px;
    background: var(--code-head);
    border-bottom: 1px solid var(--code-border);
    color: var(--code-muted);
    font-size: 12.5px;
    font-weight: 500;
}
.code-head .code-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.code-tabs-bar { display: flex; flex: 1; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-left: -8px; }
.code-tab {
    position: relative;
    padding: 0 10px;
    height: 40px;
    border: 0;
    background: none;
    color: var(--code-muted);
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.code-tab:hover { color: #fff; }
.code-tab[aria-selected="true"] { color: #fff; }
.code-tab[aria-selected="true"]::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: #34d399;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    margin-left: 8px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--code-muted);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.copy-btn:hover { background: rgb(255 255 255 / .07); color: #fff; }
.copy-btn.done { color: #34d399; }

.code-block pre {
    margin: 0;
    padding: 16px 18px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--code-fg);
    tab-size: 4;
    scrollbar-width: thin;
    scrollbar-color: #3a3a46 transparent;
}
.code-block pre[hidden] { display: none; }
.code-block code { font-family: inherit; background: none; padding: 0; border: 0; color: inherit; white-space: pre; }

/* Coloration syntaxique (Prism) */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #7d8590; font-style: italic; }
.token.punctuation { color: #9aa1ab; }
.token.property, .token.tag, .token.constant, .token.symbol, .token.deleted { color: #7ee787; }
.token.boolean, .token.number { color: #79c0ff; }
.token.selector, .token.attr-name, .token.char, .token.builtin, .token.inserted { color: #7ee787; }
.token.string, .token.attr-value, .token.url { color: #a5d6ff; }
.token.operator, .token.entity { color: #ff7b72; }
.token.atrule, .token.keyword { color: #ff7b72; }
.token.function, .token.class-name { color: #d2a8ff; }
.token.regex, .token.important, .token.variable { color: #ffa657; }
.token.parameter { color: #e4e4ea; }
.token.include { color: #d2a8ff; font-weight: 600; }
.token.field { color: #ffa657; }
.token.key { color: #7ee787; }
.token.value { color: #79c0ff; }
.token.literal { color: #e4e4ea; font-weight: 600; }

/* ---------- Cartes ---------- */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin: 20px 0 28px;
}
.card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    text-decoration: none !important;
    transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card:hover { border-color: color-mix(in srgb, var(--tone, var(--accent)) 50%, var(--border)); box-shadow: var(--shadow); transform: translateY(-1px); }
.card .card-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    margin-bottom: 8px;
    border-radius: 9px;
    background: color-mix(in srgb, var(--tone, var(--accent)) 12%, transparent);
    color: var(--tone, var(--accent));
    font-size: 16px;
}
.card .card-title { color: var(--text); font-weight: 600; font-size: 15px; }
.card .card-text { color: var(--text-muted); font-size: 13.5px; font-weight: 400; line-height: 1.5; }

/* ---------- Niveaux d'habilitation ---------- */

.levels { display: grid; gap: 12px; margin: 20px 0; }
.level {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 14px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.level-num {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    color: var(--accent-strong);
    font-weight: 700;
    font-size: 18px;
}
.level h3 { margin: 2px 0 2px; font-size: 17px; }
.level h3 small { margin-left: 6px; font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.level p { margin: 0 0 6px; font-size: 14.5px; color: var(--text-muted); }
.level ul { margin: 6px 0 0; padding-left: 18px; font-size: 14.5px; }
.level li { margin: 3px 0; }

/* ---------- FAQ ---------- */

.faq { margin: 20px 0; display: grid; gap: 10px; }
.faq details {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    transition: border-color .15s;
}
.faq details[open] { border-color: var(--border-strong); box-shadow: var(--shadow); }
.faq summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    cursor: pointer;
    list-style: none;
    color: var(--text);
    font-weight: 600;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: "";
    margin-left: auto;
    flex: none;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg) translateY(-3px);
    transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(-135deg) translateX(-2px); }
.faq summary > i { color: var(--accent); }
.faq .faq-body { padding: 0 18px 8px 46px; }
.faq h2 { all: unset; }

/* ---------- Capture interactive (page d'accueil) ---------- */

.tour {
    position: relative;
    margin: 18px 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #fff;
    box-shadow: var(--shadow);
}
.tour img { display: block; width: 100%; height: auto; }
.tour .zone {
    position: absolute;
    left: var(--x); top: var(--y); width: var(--w); height: var(--h);
    border-radius: 6px;
    border: 2px solid transparent;
    transition: background .15s, border-color .15s;
}
.tour .zone:hover, .tour .zone.on {
    background: rgb(5 150 105 / .12);
    border-color: #059669;
}
.tour .pin {
    position: absolute;
    left: 2px;
    top: 2px;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #059669;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 0 0 2px #fff, 0 2px 6px rgb(0 0 0 / .3);
    pointer-events: none;
}
.tour .zone .tip {
    position: absolute;
    left: 50%;
    top: calc(100% + 6px);
    transform: translateX(-50%);
    z-index: 2;
    padding: 4px 9px;
    border-radius: 6px;
    background: #18181b;
    color: #fff;
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s;
}
.tour .zone:hover .tip, .tour .zone.on .tip { opacity: 1; }
.tour .zone.tip-in .tip { top: 12px; }
.tour .zone.tip-left .tip { left: auto; right: 0; transform: none; }
.tour .zone.tip-right .tip { left: 0; transform: none; }

.legend {
    list-style: none;
    padding: 0 !important;
    margin: 0 0 28px !important;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 2px 12px;
    font-size: 14px;
}
.legend li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 !important;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    cursor: default;
}
.legend li:hover, .legend li.on { background: var(--bg-hover); color: var(--text); }
.legend b {
    flex: none;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    color: var(--accent-strong);
    font-size: 11px;
}

/* ---------- Bas de page ---------- */

.pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 64px;
}
.pager-link {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s;
}
.pager-link:hover { border-color: var(--accent-border); box-shadow: var(--shadow); }
.pager-link.next { text-align: right; grid-column: 2; }
.pager-label { font-size: 12.5px; color: var(--text-muted); }
.pager-title { font-weight: 600; color: var(--text); }

.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
}

/* ---------- Sommaire de droite ---------- */

.toc { padding: 36px 20px 0 8px; }
.toc-inner { position: sticky; top: calc(var(--topbar-h) + 36px); max-height: calc(100vh - var(--topbar-h) - 72px); overflow-y: auto; }
.toc-title {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
}
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a {
    display: block;
    margin-left: -1px;
    padding: 4px 0 4px 14px;
    border-left: 2px solid transparent;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13.5px;
    line-height: 1.45;
    transition: color .12s, border-color .12s;
}
.toc a.lvl-3 { padding-left: 26px; font-size: 13px; }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--accent-strong); border-left-color: var(--accent); font-weight: 500; }
.toc.empty .toc-inner { display: none; }

/* ---------- Recherche ---------- */

dialog { color: inherit; }
dialog::backdrop { background: rgb(9 9 11 / .5); backdrop-filter: blur(3px); }

.search-dialog {
    width: min(640px, calc(100vw - 24px));
    margin: 10vh auto auto;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}
.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
}
.search-input-wrap input {
    flex: 1;
    height: 56px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 16px;
}
.search-input-wrap input::-webkit-search-cancel-button { display: none; }
.search-results { list-style: none; margin: 0; padding: 8px; max-height: min(60vh, 480px); overflow-y: auto; }
.search-results li { margin: 0; }
.search-results a {
    display: block;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-soft);
}
.search-results a[aria-selected="true"] { background: var(--accent-soft); outline: 1px solid var(--accent-border); }
.search-results .r-path { display: block; font-size: 12px; color: var(--text-muted); }
.search-results .r-title { display: block; font-weight: 600; color: var(--text); }
.search-results .r-snippet { display: block; margin-top: 2px; font-size: 13.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results mark { background: color-mix(in srgb, var(--accent) 25%, transparent); color: inherit; border-radius: 2px; }
.search-results .empty { padding: 28px 12px; text-align: center; color: var(--text-muted); font-size: 14px; }
.search-footer {
    display: flex;
    gap: 16px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}
.search-footer kbd { margin-right: 3px; }

/* ---------- Zoom ---------- */

.lightbox {
    max-width: 96vw;
    max-height: 94vh;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    overflow: visible;
}
.lightbox img { display: block; max-width: 96vw; max-height: 94vh; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-lg); }
.lightbox-close {
    position: fixed;
    top: 16px;
    right: 16px;
    background: rgb(0 0 0 / .6);
    color: #fff;
}
.lightbox-close:hover { background: rgb(0 0 0 / .8); color: #fff; }

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 60;
    transform: translate(-50%, 16px);
    padding: 8px 14px;
    border-radius: 999px;
    background: #18181b;
    color: #fff;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast i { color: #34d399; margin-right: 6px; }

/* ---------- Responsive ---------- */

@media (max-width: 1240px) {
    .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
    .toc { display: none; }
    .main { padding: 32px 40px 40px; }
}

@media (max-width: 900px) {
    :root { --topbar-h: 56px; }
    .topbar { padding: 0 12px; gap: 8px; }
    .menu-btn, .search-mobile { display: inline-grid; }
    .search-trigger { display: none; }
    .brand { min-width: 0; }

    .layout { grid-template-columns: minmax(0, 1fr); }

    .sidebar {
        position: fixed;
        top: var(--topbar-h);
        left: 0;
        bottom: 0;
        z-index: 35;
        width: min(320px, 86vw);
        height: auto;
        background: var(--bg);
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: var(--shadow-lg);
    }
    body.nav-open .sidebar { transform: none; }
    .sidebar-backdrop {
        position: fixed;
        inset: var(--topbar-h) 0 0 0;
        z-index: 34;
        background: rgb(9 9 11 / .45);
    }
    body.nav-open { overflow: hidden; }

    .main { padding: 24px 16px 32px; }
    .prose .lead { font-size: 17px; }
    .prose h2 { font-size: 21px; margin-top: 40px; }
    .steps > li { padding-left: 40px; }
    .endpoint .ct { display: none; }
    .specs { grid-template-columns: 1fr; }
    .specs dt { border-bottom: 0; padding-bottom: 2px; }
    .specs dd { padding-top: 2px; }
    .faq .faq-body { padding-left: 18px; }
    .tour .pin { width: 14px; height: 14px; font-size: 8px; }
    .pager { grid-template-columns: 1fr; }
    .pager-link.next { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
    .topbar, .sidebar, .toc, .pager, .copy-btn { display: none !important; }
    .layout { display: block; }
    .main { padding: 0; }
}

/* Icône seule dans un élément d'interface */
.ui i:only-child { margin: 0; }
/* Bouton vert du CRM (menu client, menu principal) */
.ui.btn-green { background: #198754; border-color: #157347; color: #fff; }
.ui.btn-green i { color: #fff; }
