/* =========================================================
   GUIDE : bouton du header + page "How it works"
========================================================= */
.header-guide-btn {
    color: var(--accent-blue);
    border-color: rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.08);
}

.header-guide-btn:hover {
    color: var(--text-primary);
    background: rgba(56, 189, 248, 0.16);
}

.guide-page {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(3, 7, 18, 0.72);
    backdrop-filter: blur(6px);
}

.guide-page[hidden] {
    display: none;
}

.guide-shell {
    display: flex;
    flex-direction: column;
    width: min(1180px, 100%);
    height: min(92vh, 100%);
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    color: var(--text-primary);
}

.guide-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 26px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}

.guide-kicker {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-blue);
}

.guide-top h2 {
    margin: 2px 0 0;
    font-size: 1.35rem;
}

.guide-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
}

.guide-close:hover {
    color: var(--text-primary);
}

.guide-body {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    min-height: 0;
    flex: 1;
}

.guide-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 20px 14px;
    border-right: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    overflow-y: auto;
}

.guide-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
}

.guide-nav a span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-card);
    font-size: 0.72rem;
}

.guide-nav a:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.guide-nav a.active {
    color: var(--text-primary);
    background: rgba(56, 189, 248, 0.12);
}

.guide-nav a.active span {
    background: var(--accent-blue);
    color: #0b1120;
}

.guide-content {
    overflow-y: auto;
    padding: 8px 40px 60px;
    scroll-behavior: smooth;
    font-size: 0.95rem;
    line-height: 1.65;
    color: #cbd5e1;
}

.guide-section {
    max-width: 780px;
    padding: 30px 0 10px;
    border-bottom: 1px solid var(--border-subtle);
    scroll-margin-top: 10px;
}

.guide-section:last-child {
    border-bottom: none;
}

.guide-section h3 {
    margin: 0 0 8px;
    font-size: 1.3rem;
    color: var(--text-primary);
}

.guide-section h4 {
    margin: 26px 0 8px;
    font-size: 1rem;
    color: var(--text-primary);
}

.guide-section p {
    margin: 0 0 12px;
}

.guide-section b {
    color: var(--text-primary);
}

.guide-section em {
    font-style: normal;
    color: var(--accent-blue);
}

.guide-section q {
    color: #e2e8f0;
    font-style: italic;
}

.guide-section code {
    padding: 1px 6px;
    border-radius: 5px;
    background: var(--bg-card);
    color: var(--accent-blue);
    font-size: 0.85em;
}

.guide-lead {
    font-size: 1.08rem;
    color: #e2e8f0;
}

.guide-note {
    padding-left: 12px;
    border-left: 3px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Démarrage rapide */
.guide-steps {
    list-style: none;
    counter-reset: step;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 20px 0 10px;
    padding: 0;
}

.guide-steps li {
    counter-increment: step;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 16px 16px 56px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-surface);
}

.guide-steps li::before {
    content: counter(step);
    position: absolute;
    left: 16px;
    top: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-blue);
    color: #0b1120;
    font-weight: 800;
}

.guide-steps li span {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

/* Les 4 couches */
.guide-tiers {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 0;
}

.guide-tiers.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.guide-tier {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid;
    font-size: 0.86rem;
    line-height: 1.5;
}

.guide-tier b {
    font-size: 0.95rem;
}

.guide-tier.t-mobile { background: var(--node-mobile-bg); border-color: var(--node-mobile-border); }
.guide-tier.t-mobile b { color: var(--node-mobile-accent); }
.guide-tier.t-bank { background: var(--node-bank-bg); border-color: var(--node-bank-border); }
.guide-tier.t-bank b { color: var(--node-bank-accent); }
.guide-tier.t-ai { background: var(--node-ai-bg); border-color: var(--node-ai-border); }
.guide-tier.t-ai b { color: var(--node-ai-accent); }
.guide-tier.t-llm { background: var(--node-llm-bg); border-color: var(--node-llm-border); }
.guide-tier.t-llm b { color: var(--node-llm-accent); }

.guide-callout {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 16px 0;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(56, 189, 248, 0.3);
    background: rgba(56, 189, 248, 0.07);
    font-size: 0.9rem;
}

.guide-callout.lock {
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.07);
}

.guide-callout.lock > b::before {
    content: "🔒 ";
}

/* Tableaux simples */
.guide-table {
    display: flex;
    flex-direction: column;
    margin: 14px 0;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
}

.guide-table > div {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 14px;
    padding: 12px 16px;
    font-size: 0.9rem;
}

.guide-table > div + div {
    border-top: 1px solid var(--border-subtle);
}

.guide-table.compact > div {
    grid-template-columns: 130px minmax(0, 1fr);
    padding: 9px 16px;
}

/* Opérations */
.guide-ops {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}

.guide-ops > div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    padding: 11px 13px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-surface);
    font-size: 0.88rem;
}

.guide-ops q {
    flex-basis: 100%;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.guide-tag {
    padding: 1px 7px;
    border-radius: 9999px;
    font-size: 0.66rem;
    font-weight: 700;
}

.guide-tag.otp {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.guide-flow,
.guide-list {
    margin: 0 0 12px;
    padding-left: 22px;
}

.guide-flow li,
.guide-list li {
    margin: 4px 0;
}

/* Pages de configuration */
.guide-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.guide-card {
    display: flex;
    flex-direction: column;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-surface);
    font-size: 0.87rem;
    line-height: 1.55;
}

.guide-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.guide-card header b {
    font-size: 1rem;
}

.guide-card .what {
    color: #e2e8f0;
}

.guide-card ul {
    margin: 0;
    padding-left: 18px;
    color: var(--text-secondary);
}

.guide-card li {
    margin: 3px 0;
}

.guide-open {
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid rgba(56, 189, 248, 0.4);
    background: transparent;
    color: var(--accent-blue);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.guide-open:hover:not(:disabled) {
    background: rgba(56, 189, 248, 0.12);
}

.guide-open:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* FAQ */
.guide-faq {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}

.guide-faq details {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-surface);
}

.guide-faq summary {
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}

.guide-faq details p {
    margin: 0;
    padding: 0 16px 14px;
    font-size: 0.9rem;
}

/* Petit écran */
@media (max-width: 860px) {
    .guide-page { padding: 0; }
    .guide-shell { height: 100%; border-radius: 0; }
    .guide-top { padding: 14px 16px; }
    .guide-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
    .guide-nav { flex-direction: row; overflow-x: auto; padding: 10px 12px; border-right: none; border-bottom: 1px solid var(--border-subtle); }
    .guide-nav a { flex-shrink: 0; white-space: nowrap; }
    .guide-content { padding: 0 16px 40px; }
    .guide-steps, .guide-cards, .guide-tiers, .guide-tiers.three { grid-template-columns: 1fr; }
    .guide-table > div, .guide-table.compact > div { grid-template-columns: 1fr; gap: 2px; }
}
