/* === Guides viewer (read-only modal) ===
   Ported from the Forecast Builder Guides modal (apps/AGP forecast engine,
   app/globals.css `.guides-*`) onto this app's tokens: --agp-navy for the
   header bar, --agp-sky-light for secondary text on navy, the slate scale,
   DM Sans / JetBrains Mono. Layout, typography, spacing, screenshot frames,
   lightbox and section separators are the same as the source component. */
:root {
    --guides-sky-soft: #E4F4FA;
    --guides-shadow: 0 1px 2px rgba(27, 43, 75, 0.04), 0 6px 18px rgba(27, 43, 75, 0.07);
}
/* Header "Guides" button: sits in .controls-right immediately left of the
   Compare To control (that row's gap is 16px; the -4px margin makes it 12px).
   Sky background with navy text, the same pair as the $000s card badges. */
.guides-open-btn { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; margin-right: -4px; border: none; border-radius: 8px; background: var(--agp-sky); color: var(--agp-navy); font-family: var(--font-sans); font-size: 13px; font-weight: 600; line-height: 1; cursor: pointer; white-space: nowrap; }
.guides-open-btn:hover { background: #63C2E1; }
.guides-open-btn:focus-visible { outline: 2px solid var(--agp-navy); outline-offset: 2px; }
.guides-modal { position: fixed; inset: 0; z-index: 300; background: rgba(27, 43, 75, 0.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.guides-modal[hidden] { display: none; }
.guides-panel { width: 92vw; max-width: 1440px; height: 90vh; background: #fff; border: 1px solid var(--slate-200); border-radius: 12px; box-shadow: var(--guides-shadow); display: flex; flex-direction: column; min-height: 0; overflow: hidden; font-family: var(--font-sans); }
.guides-head { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--slate-200); background: var(--agp-navy); color: #fff; flex-wrap: wrap; }
.guides-title { font-size: 15px; font-weight: 700; letter-spacing: 0.02em; color: #fff; }
.guides-tabs { display: inline-flex; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 6px; overflow: hidden; }
.guides-tabs button { background: transparent; border: none; color: var(--agp-sky-light); padding: 5px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: var(--font-sans); }
.guides-tabs button.on { background: #fff; color: var(--agp-navy); }
.guides-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.guides-ver { font-size: 11px; color: var(--agp-sky-light); margin-right: 6px; white-space: nowrap; }
.guides-dl { border: 1px solid rgba(255, 255, 255, 0.3); background: transparent; border-radius: 6px; padding: 5px 10px; font-weight: 600; font-size: 12px; color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap; font-family: var(--font-sans); }
.guides-dl:hover { background: rgba(255, 255, 255, 0.1); }
.guides-close { background: transparent; border: 1px solid rgba(255, 255, 255, 0.3); color: #fff; border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font-size: 12px; }
.guides-body { display: grid; grid-template-columns: 260px minmax(0, 1fr); flex: 1; min-height: 0; }
/* Contents column */
.guides-toc { overflow-y: auto; overflow-x: hidden; border-right: 1px solid var(--slate-200); padding: 12px 8px; background: var(--slate-50); }
.guides-toc button { display: block; width: 100%; text-align: left; background: transparent; border: none; border-radius: 6px; padding: 4px 10px; margin: 0 0 8px; font-size: 13px; color: var(--slate-800); cursor: pointer; font-family: var(--font-sans); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guides-toc button.lvl2 { font-weight: 700; margin-top: 8px; }
.guides-toc button.lvl3 { font-size: 12.5px; padding-left: 24px; color: var(--slate-700); }
.guides-toc button:hover { background: var(--slate-100); }
.guides-toc button.active { background: var(--guides-sky-soft); color: var(--agp-navy); }
/* Document column */
.guides-scroll { overflow-y: auto; overflow-x: hidden; min-width: 0; }
.guides-doc { max-width: 760px; padding: 24px 40px 60px; text-align: left; font-size: 14.5px; line-height: 1.65; color: var(--slate-800); }
.guides-doc > * { min-width: 0; }
.guides-doc h2 { font-size: 24px; font-weight: 600; color: var(--agp-navy); margin: 32px 0 12px; line-height: 1.25; }
.guides-doc h2 + h3 { margin-top: 12px; }
.guides-doc h2:not(:first-child) { padding-top: 40px; border-top: 1px solid var(--slate-200); margin-top: 40px; }
.guides-doc h3 { font-size: 18px; font-weight: 600; color: var(--slate-800); margin: 28px 0 8px; line-height: 1.3; }
.guides-doc h4 { font-size: 15px; font-weight: 600; margin: 20px 0 6px; }
.guides-doc p { margin: 0 0 12px; }
.guides-doc ul { margin: 0 0 12px 20px; padding: 0; }
.guides-doc ul li { margin: 0 0 6px; }
/* Numbered steps: navy circle numerals */
.guides-doc ol { list-style: none; counter-reset: step; margin: 0 0 12px; padding: 0; }
.guides-doc ol li { counter-increment: step; position: relative; padding-left: 34px; margin: 0 0 10px; }
.guides-doc ol li::before { content: counter(step); position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 50%; background: var(--agp-navy); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); }
.guides-doc code { font-family: var(--font-mono); font-size: 12.5px; background: var(--slate-100); padding: 0 4px; border-radius: 3px; }
.guides-doc pre { font-family: var(--font-mono); font-size: 11px; line-height: 1.4; background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: 6px; padding: 12px; overflow-x: auto; margin: 0 0 12px; }
/* "Where to go" / "What happens next": small-caps lead-in above the text */
.guides-doc .g-lead { margin: 0 0 14px; }
.guides-doc .g-lead-label { font-variant: small-caps; font-size: 13px; letter-spacing: 0.08em; font-weight: 700; color: var(--slate-500); margin-bottom: 2px; }
.guides-doc .g-lead p { margin: 0 0 4px; }
/* Callouts: "Before you start", "Useful to know", "Good to know", starting paths */
.guides-doc .g-box { background: var(--guides-sky-soft); border-left: 3px solid var(--agp-navy); border-radius: 0 8px 8px 0; padding: 16px; margin: 12px 0 16px; }
.guides-doc .g-box-label { font-variant: small-caps; font-size: 13px; letter-spacing: 0.08em; font-weight: 700; color: var(--agp-navy); margin-bottom: 6px; }
.guides-doc .g-box p { margin: 0 0 6px; }
.guides-doc .g-box p:last-child { margin-bottom: 0; }
/* Screenshots: full text-column width, hairline frame, caption beneath; click for the lightbox */
.guides-doc .g-shot { margin: 20px 0; padding: 0; max-width: 100%; }
.guides-doc .g-shot-btn { display: block; width: 100%; padding: 0; margin: 0; background: #fff; border: 1px solid var(--slate-200); border-radius: 8px; overflow: hidden; cursor: zoom-in; }
.guides-doc .g-shot img { display: block; width: 100%; height: auto; }
.guides-doc .g-shot figcaption { font-size: 12px; color: var(--slate-500); margin-top: 8px; }
.guides-doc .g-ph { border: 1px dashed var(--slate-300); border-radius: 8px; text-align: center; padding: 22px 12px; color: var(--slate-600); }
.guides-doc .g-ph b { display: block; margin-bottom: 4px; }
.guides-doc .g-ph span { font-size: 12px; color: var(--slate-500); }
/* Tables scroll inside their own container */
.guides-doc .g-tbl { overflow-x: auto; max-width: 100%; margin: 8px 0 16px; border: 1px solid var(--slate-200); border-radius: 8px; }
.guides-doc table { border-collapse: collapse; width: 100%; font-size: 13px; line-height: 1.5; }
.guides-doc th, .guides-doc td { text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--slate-200); }
.guides-doc tr:last-child td { border-bottom: none; }
.guides-doc th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--slate-500); background: var(--slate-50); }
/* Loading / error state inside the document column */
.guides-doc .g-status { color: var(--slate-500); font-size: 13px; padding: 20px 0; }
/* Lightbox */
.guides-lightbox { position: fixed; inset: 0; z-index: 310; background: rgba(27, 43, 75, 0.85); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.guides-lightbox[hidden] { display: none; }
.guides-lightbox img { max-width: 100%; max-height: calc(100% - 40px); border-radius: 8px; box-shadow: var(--guides-shadow); background: #fff; cursor: default; }
.guides-lightbox-cap { margin-top: 10px; font-size: 12.5px; color: var(--agp-sky-light); }
@media (max-width: 900px) { .guides-body { grid-template-columns: 1fr; } .guides-toc { display: none; } .guides-doc { padding: 20px; } }
