/* =============================================================
   api-portal.css
   Global styles for the BQ API Documentation portal.
   Renamed from api-docs.css — sidebar-specific rules have been
   extracted to api-sidebar.css.
   ============================================================= */

:root {
    --api-header-height: 56px;
    --api-sidebar-width: 260px;

    --api-bg: #ffffff;
    --api-surface: #ffffff;
    --api-surface-alt: #f9fafb;
    --api-border: #e2e8f0;
    --api-border-dark: #cbd5e1;

    --api-text-main: #0f172a;
    --api-text-muted: #475569;
    --api-text-light: #94a3b8;

    /* Code Syntax Colors */
    --api-code-bg: #111b27;
    --api-code-text: #e3eaf2;
    --api-code-key: #6cb8e6;
    --api-code-string: #91d076;
    --api-code-number: #e6d37a;
    --api-code-null: #e9ae7e;
    --api-code-method: #e6d37a;

    --api-font-sans: 'Inter', 'Inter Fallback', 'Inter Fallback R', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --api-font-mono: 'Fira Code', 'Fira Code Fallback', ui-monospace, SFMono-Regular, Consolas, monospace;

    /* ---- Type scale ------------------------------------------------------
       Every font-size in this stylesheet and in the 24 page templates now
       resolves through these ten tokens, so the whole portal is retuned
       from this one block. The templates reference them from their inline
       style attributes (`font-size: var(--fs-sm)`), which is the only way an
       inline declaration can answer a breakpoint: the media query further
       down redefines the token and every inline style follows it.

       Before this, nothing set a font-size on <body>, so any paragraph or
       list the templates had not styled inline fell through to the browser
       default of 16px while the card and table copy beside it was hardcoded
       at 13px. The same role also drifted between pages — h3 appeared at
       13/14/15/16/17 and 18px, h4 at 14 and 16, h2 at 18/20/22 and 24.

       The values: these are dense reference pages, so body copy sits at 15px
       rather than the 16px long-form reading standard, 14px covers text
       inside cards and param tables, and 13px the dense response grids. The
       hero paragraph under the h1 runs at that same 15px — it is set apart by
       its width and its muted colour, and does not need a size of its own.
       Nothing carrying a sentence goes below 13px — 12px and under are for
       labels, badges and uppercase column heads only. */
    --fs-h1:    32px;
    --fs-h2:    22px;
    --fs-h3:    17px;
    --fs-h4:    15px;
    --fs-body:  15px;   /* prose: p, li, the hero paragraph, the main column */
    --fs-sm:    14px;   /* card copy, param tables, secondary prose */
    --fs-xs:    13px;   /* dense response tables, inline code */
    --fs-label: 12px;   /* meta lines, captions, column heads */
    --fs-badge: 11px;   /* pills and small uppercase labels */
    --fs-micro: 10px;   /* method badges only */
    --fs-mono:  13px;   /* code blocks */
}

/* Tablet / large phone. 991px is where layout.php already flips the portal to
   its mobile shell, so the h1 steps down here rather than waiting for 640px.
   This block must stay above the 640px one: both match at phone widths and
   the later declaration is the one that wins. */
@media (max-width: 991px) {
    :root { --fs-h1: 28px; }
}

/* Only the headings and the mono blocks shrink on a phone. Body copy holds at
   15px: a narrow screen is a reason to keep text legible, not to shrink it,
   and the 13/16px collision this scale replaces is what actually made these
   pages read badly at 375px. */
@media (max-width: 640px) {
    :root {
        --fs-h1:   26px;
        --fs-h2:   20px;
        --fs-h3:   16px;
        --fs-mono: 12px;
    }
}

* { box-sizing: border-box; }

body.bq-api-body {
    margin: 0;
    padding: 0;
    font-family: var(--api-font-sans);
    /* Without this the page inherited the browser's 16px default, which is why
       an unstyled paragraph rendered a full 3px larger than the card copy next
       to it. Everything now starts from the scale. */
    font-size: var(--fs-body);
    line-height: 1.65;
    background: var(--api-bg);
    color: var(--api-text-main);
    -webkit-font-smoothing: antialiased;
}

/* Base type layer for content the templates leave unstyled. Wrapped in :where()
   so the whole selector carries zero specificity from the class — every
   component rule below and every inline style in the templates still wins, and
   this only catches what would otherwise fall through to a browser default
   (16px copy, 24px h2, 18px h3). */
:where(.api-content-inner) h2 { font-size: var(--fs-h2); line-height: 1.3; }
:where(.api-content-inner) h3 { font-size: var(--fs-h3); line-height: 1.35; }
:where(.api-content-inner) h4 { font-size: var(--fs-h4); line-height: 1.4; }
:where(.api-content-inner) p,
:where(.api-content-inner) li { font-size: var(--fs-body); line-height: 1.7; }
:where(.api-content-inner) code { font-size: var(--fs-xs); }

/* =========================================
   1. GLOBAL HEADER
   ========================================= */
.api-global-header {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--api-header-height); background: var(--api-surface);
    border-bottom: 1px solid var(--api-border); z-index: 1000;
    display: flex; align-items: center;
}
.api-header-container { width: 100%; padding: 0 32px; display: flex; justify-content: space-between; align-items: center; }
.api-header-left { display: flex; align-items: center; }
.api-logo { height: 24px; display: block; }
.api-logo-text { font-family: var(--api-font-sans); font-weight: 600; font-size: 18px; color: #478bff; letter-spacing: -0.02em; margin-top: 1px; }

/* Hidden by default on desktop — acts as mobile menu overlay */
.api-header-nav { display: none; }

.api-link-bq {
    display: flex; align-items: center; gap: 4px; color: var(--api-text-muted);
    text-decoration: none; font-size: var(--fs-sm); font-weight: 500; transition: color 0.2s;
}
.api-link-bq svg { transition: transform 0.2s; }
.api-link-bq:hover { color: #478bff; }
.api-link-bq:hover svg { transform: translateX(3px); }

.api-header-actions { display: flex; align-items: center; gap: 16px; }
.api-btn-secondary { background: #fff; border: 1px solid var(--api-border-dark); color: var(--api-text-main); padding: 8px 16px; border-radius: 4px; font-weight: 600; font-size: var(--fs-sm); text-decoration: none; transition: border-color 0.2s; display: inline-flex; justify-content: center; align-items: center; }
.api-btn-secondary:hover { border-color: var(--api-text-main); }
.api-btn-primary { background: var(--api-text-main); border: 1px solid var(--api-text-main); color: #fff; padding: 8px 16px; border-radius: 4px; font-weight: 600; font-size: var(--fs-sm); text-decoration: none; transition: opacity 0.2s; display: inline-flex; justify-content: center; align-items: center; }
.api-btn-primary:hover { opacity: 0.9; }

.api-mobile-menu-btn { display: none; }
.api-mobile-only-nav { display: none; }

/* =========================================
   2. SHARED SIDEBAR / MOBILE SEARCH TRIGGER
   Note: sidebar container + nav group rules live in api-sidebar.css
   ========================================= */
.api-search-btn {
    display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 10px 14px;
    background: #ffffff; border: 1px solid var(--api-border); border-radius: 6px; color: var(--api-text-muted);
    cursor: pointer; margin-bottom: 32px; box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.api-search-btn:hover { border-color: var(--api-border-dark); }
.api-search-placeholder { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); font-weight: 500; }
.api-search-shortcut {
    background: var(--api-surface-alt); border: 1px solid var(--api-border);
    border-radius: 4px; padding: 2px 8px; font-size: var(--fs-label); font-family: var(--api-font-mono); color: var(--api-text-muted);
}

/* Method badges — used in both sidebar and mobile header nav */
/* Method badges -- ONE definition, used by the sidebar, the mobile nav and the
   endpoint box in the article body alike. Three separate hue families, so the
   verb is readable from colour alone:

     GET   indigo  read
     POST  amber   write
     WS    green   not an HTTP verb at all -- a streaming protocol

   GET kept its indigo, but it used to vanish on the active nav row, whose
   background is slate-200 (#e2e8f0): a pale indigo fill and a pale blue-grey
   fill sit at almost the same value, so the pill lost its edge exactly where
   the reader was looking. The fix is the BORDER, not the hue -- a defined
   edge holds the pill's shape on any background, where fill contrast alone
   could not.

   Every badge sits on the same rungs of its own hue -- 50 fill, 300 border,
   600/700 text -- so all three carry equal weight and none outshouts another.
   These are a deliberate step lighter than the first attempt (indigo-800 text
   on an indigo-400 border), which read as heavy and pulled the eye away from
   the page titles the nav is actually there to list. A method badge is a
   label, not a call to action.

   GET's #7c8dd1 is Piyush's pick and is intentionally softer than the rung
   would give: it measures 2.85:1 against its own fill and 2.59:1 on the
   active nav row, below the 4.5:1 WCAG AA asks for at this size. It stays
   legible because the pill's border, not its text contrast, is what carries
   the shape -- but do not treat these values as an accessible-text baseline
   to copy elsewhere. */
.api-badge { font-size: var(--fs-micro); font-weight: 700; padding: 2px 6px; border-radius: 4px; font-family: var(--api-font-mono); border: 1px solid transparent; }
.api-badge-get  { background: #eef2ff; color: #7c8dd1; border-color: #c7d2fe; }
.api-badge-post { background: #fffbeb; color: #d97706; border-color: #fde68a; }
.api-badge-ws   { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; font-size: var(--fs-micro); font-weight: 700; letter-spacing: 0.03em; }

/* Coming-soon nav items (mobile header) */
.api-nav-list a.nav-coming-soon {
    opacity: 0.55;
    cursor: default;
    pointer-events: none;
}

/* =========================================
   3. MAIN CONTENT
   ========================================= */
.api-content {
    margin-left: var(--api-sidebar-width);
    margin-top: var(--api-header-height);
    width: calc(100% - var(--api-sidebar-width));
    padding: 64px 80px 0 80px;
    min-height: calc(100vh - var(--api-header-height));
    display: flex; flex-direction: column;
}
.api-content-inner {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    flex: 1;
}

.api-page-header { margin-bottom: 48px; }
.api-page-header h1 { font-size: var(--fs-h1); font-weight: 700; margin: 0 0 16px; color: var(--api-text-main); letter-spacing: -0.01em; }
.api-description { font-size: var(--fs-body); color: var(--api-text-muted); margin: 0; line-height: 1.6; }

/* Header meta block — maintainer byline stacked over the last updated date, sits
   between the h1 and the description. Keep the spacing here rather than inline in
   the page templates so it stays tunable in one place. */
.api-page-meta { margin: 0 0 18px; }
.api-page-meta p { margin: 0; line-height: 1.5; color: var(--api-text-muted); }
.api-page-meta p:first-child { font-size: var(--fs-xs); margin-bottom: 8px; }
.api-page-meta p:last-child { font-size: var(--fs-label); }
.api-page-meta a { color: var(--api-text-main); font-weight: 600; }

/* =========================================
   4. GRID, PARAMS & CODE BLOCKS
   ========================================= */
.api-grid {
    display: flex;
    justify-content: space-between;
    gap: 80px;
    align-items: flex-start;
}
.api-grid-left { flex: 1; max-width: 650px; }
.api-grid-right { flex: 1; max-width: 550px; margin-left: auto; }

.api-grid h2 {
    font-size: var(--fs-h2); margin: 0 0 8px 0; color: var(--api-text-main);
    font-weight: 700; border-bottom: 1px solid var(--api-border); padding-bottom: 12px;
}

/* Restored Overview Page Cards */
.api-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: 20px;
    margin-bottom: 48px;
}
.api-card {
    display: block;
    background: var(--api-surface);
    border: 1px solid var(--api-border);
    border-radius: 8px;
    padding: 24px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.api-card:hover {
    border-color: #478bff;
    box-shadow: 0 8px 16px -4px rgba(0,0,0,0.05);
    transform: translateY(-2px);
}
.api-card h3 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 12px 0;
    font-size: var(--fs-h3);
    font-weight: 600;
    color: var(--api-text-main);
}
.api-card p {
    margin: 0;
    font-size: var(--fs-sm);
    color: var(--api-text-muted);
    line-height: 1.6;
}

.api-param-description { font-size: var(--fs-sm); color: var(--api-text-muted); margin: 0 0 24px 0; line-height: 1.5; }

.api-endpoint-box {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    background: #ffffff;
    border: 1px solid var(--api-border);
    padding: 10px 16px;
    border-radius: 4px;
    margin-bottom: 48px;
    font-family: var(--api-font-mono);
    font-size: var(--fs-sm);
    color: var(--api-text-main);
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.6;
}

.api-param-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.api-param-table th,
.api-param-table td { padding: 12px 0; border-bottom: 1px solid var(--api-border); text-align: left; vertical-align: top; line-height: 1.5; }
.api-param-table th { color: var(--api-text-muted); font-weight: 600; font-size: var(--fs-label); text-transform: uppercase; letter-spacing: 0.05em; padding-bottom: 12px; }
.api-param-table td:nth-child(1) { font-weight: 600; color: var(--api-text-main); padding-right: 24px; }
.api-param-table td:nth-child(2) { color: var(--api-text-muted); font-family: var(--api-font-sans); font-size: var(--fs-sm); }
.api-param-table code {
    font-family: var(--api-font-mono); font-size: var(--fs-label); background: var(--api-surface-alt);
    padding: 2px 8px; border-radius: 4px; border: 1px solid var(--api-border); color: var(--api-text-main);
}

/* A long unbreakable slug in a code pill (market-capitalization,
   free-cash-flow-annual) sets a min-content floor the table cannot shrink past,
   which pushed the whole document into horizontal scroll below ~480px. Let the
   pills break on narrow screens so the table stays inside the viewport. */
@media (max-width: 991px) {
    .api-param-table th,
    .api-param-table td { word-break: break-word; overflow-wrap: anywhere; }
    .api-param-table code { overflow-wrap: anywhere; word-break: break-word; }
}

/* --- Parameter tables as stacked cards on phones ---------------------------
   A two column parameter table on a 375px screen splits into roughly a 90px
   name column and a 235px description column, so every description wraps every
   few words and the table reads as a cramped ladder. Below 640px each row
   becomes a self contained card: the first cell (the parameter or field name)
   is promoted to a card heading, and every other cell is labelled with its
   column header. api-portal.js copies those headers onto the cells as
   data-label, since CSS cannot reach a <th> from a <td>.
   Applies to every page automatically — no per page markup. */
@media (max-width: 640px) {
    .api-param-table,
    .api-param-table tbody,
    .api-param-table tr,
    .api-param-table td { display: block; width: 100%; }

    .api-param-table thead { display: none; } /* headers move into data-label */

    .api-param-table tr {
        border: 1px solid var(--api-border);
        border-radius: 8px;
        padding: 14px 16px;
        margin-bottom: 12px;
        background: var(--api-surface);
    }
    .api-param-table tr:last-child { margin-bottom: 0; }

    .api-param-table td {
        border-bottom: 0;
        padding: 0 0 12px;
    }
    .api-param-table td:last-child { padding-bottom: 0; }

    /* Card heading: the parameter / field name. */
    .api-param-table td:first-child {
        font-size: var(--fs-h4);
        font-weight: 700;
        color: var(--api-text-main);
        padding-right: 0;
        padding-bottom: 10px;
        margin-bottom: 10px;
        border-bottom: 1px solid var(--api-border);
    }

    /* Column header rendered above each remaining cell. */
    .api-param-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: var(--fs-micro);
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.07em;
        color: var(--api-text-light);
        margin-bottom: 5px;
    }

    /* The description column carries the muted body colour on desktop via
       nth-child(2); restate it here since the cells are now blocks. */
    .api-param-table td { color: var(--api-text-muted); font-size: var(--fs-sm); line-height: 1.6; }
}

.api-code-container {
    background: var(--api-code-bg); border-radius: 6px;
    margin-bottom: 32px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    /* A <pre> holding a long unbreakable cURL URL has a large min-content width.
       overflow-x:auto on the <pre> only contains it if the ancestors are allowed
       to be narrower than that content — flex and grid children default to
       min-width:auto, so without this the floor propagates up and scrolls the
       whole page sideways instead of just the code block. */
    max-width: 100%;
    min-width: 0;
}
/* Same reason: these are flex children of .api-grid. Applied to EVERY child,
   classed or not, and at every width -- not just under 991px, where this floor
   used to live. The sidebar takes 260px out of the viewport, so the content
   column is narrow long before the viewport is: at a 1280px window the column
   is 845px, and a flex child left at the default min-width:auto cannot shrink
   below the min-content width of a long unbreakable cURL URL. It then pushed
   the whole page sideways instead of letting the <pre> scroll itself. */
.api-grid > * { min-width: 0; max-width: 100%; }
.api-code-header {
    display: flex; justify-content: space-between; align-items: center; padding: 10px 16px;
    background: var(--api-code-bg); border-bottom: 1px solid #2e3c51; color: #94a3b8;
    font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase;
    border-top-left-radius: 6px; border-top-right-radius: 6px;
}

.api-code-block {
    background: transparent; color: var(--api-code-text); padding: 16px;
    font-family: var(--api-font-mono); font-size: var(--fs-mono); overflow-x: auto;
    margin: 0; line-height: 1.6; white-space: pre-wrap;
    border-bottom-left-radius: 6px; border-bottom-right-radius: 6px;
}
.api-code-block .token.key    { color: var(--api-code-key); }
.api-code-block .token.string { color: var(--api-code-string); }
.api-code-block .token.number { color: var(--api-code-number); }
.api-code-block .token.boolean,
.api-code-block .token.null   { color: var(--api-code-null); }
.api-code-block .token.method { color: var(--api-code-method); }
.api-code-block .token.punctuation { color: var(--api-code-text); }

/* Copy button + tooltip */
.api-code-copy-btn {
    position: relative;
    overflow: visible;
    cursor: pointer;
    background: transparent;
    border: none;
    color: #6b7280;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.api-code-copy-btn:hover { color: #111827; background: #1e293b; }

/* Tooltip box */
.api-code-copy-btn::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%; left: 50%;
    transform: translateX(-50%) translateY(0px);
    background: #1f2937; color: #fff;
    padding: 6px 10px; border-radius: 6px;
    font-size: var(--fs-label); font-weight: 500; white-space: nowrap;
    opacity: 0; visibility: hidden;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none; z-index: 50;
    font-family: var(--api-font-sans);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}
/* Tooltip arrow */
.api-code-copy-btn::after {
    content: '';
    position: absolute;
    bottom: 100%; left: 50%;
    transform: translateX(-50%) translateY(4px);
    border-width: 5px; border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
    opacity: 0; visibility: hidden;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none; z-index: 50;
}
.api-code-copy-btn:hover::before,
.api-code-copy-btn.copied::before {
    opacity: 1; visibility: visible;
    transform: translateX(-50%) translateY(-8px);
}
.api-code-copy-btn:hover::after,
.api-code-copy-btn.copied::after {
    opacity: 1; visibility: visible;
    transform: translateX(-50%) translateY(-3px);
}
/* Copied success state */
.api-code-copy-btn.copied::before { background: #10b981; }
.api-code-copy-btn.copied::after  { border-color: #10b981 transparent transparent transparent; }
.api-code-copy-btn.copied         { color: #10b981; }

/* Search modal */
.api-search-overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.4); z-index: 99999; align-items: flex-start; justify-content: center; padding-top: 10vh; }
.api-search-overlay.active { display: flex; }
.api-search-modal { background: #fff; width: 100%; max-width: 640px; border-radius: 8px; overflow: hidden; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); }
.api-search-header { display: flex; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--api-border); }
.api-search-header input { flex: 1; border: none; font-size: 18px; outline: none; width: 100%; color: var(--api-text-main); }
.api-esc-hint { font-size: var(--fs-badge); font-family: var(--api-font-mono); color: var(--api-text-muted); background: var(--api-surface-alt); padding: 4px 8px; border-radius: 4px; border: 1px solid var(--api-border); }
.api-search-results { list-style: none; margin: 0; padding: 0; max-height: 400px; overflow-y: auto; }
.api-search-results li { border-bottom: 1px solid var(--api-border); }
.api-search-results li:last-child { border-bottom: none; }
.api-search-results a { display: block; padding: 16px 24px; text-decoration: none; color: var(--api-text-main); transition: background 0.1s; }
.api-search-results a:hover,
.api-search-results a.active { background: #f8fafc; }
.api-search-results .result-title { display: block; font-size: var(--fs-body); font-weight: 600; margin-bottom: 4px; }
.api-search-results .result-path  { display: block; font-size: var(--fs-label); color: var(--api-text-muted); }

/* =========================================
   5. FOOTER
   ========================================= */
.api-global-footer { border-top: 1px solid var(--api-border); padding: 32px 0; margin-top: 64px; width: 100%; max-width: 1000px; margin-left: auto; margin-right: auto; }
.api-footer-container { display: flex; justify-content: space-between; align-items: center; color: var(--api-text-muted); font-size: var(--fs-xs); }
.api-footer-links { display: flex; gap: 24px; }
.api-footer-links a { color: var(--api-text-muted); text-decoration: none; font-weight: 500; }
.api-footer-links a:hover { color: var(--api-text-main); }


/* =========================================
   6. RESPONSIVE / MOBILE
   ========================================= */
@media (min-width: 992px) {
    .api-mobile-auth-actions { display: none !important; }
    .api-header-nav { display: none !important; }
}

@media (max-width: 1200px) {
    /* align-items:flex-start is correct while this is a row (it stops the two
       columns stretching to equal height), but once the direction flips to
       column that same value sizes every child to its max-content width — so a
       block holding a long cURL <pre> ballooned to ~726px inside a 327px
       parent. Stretch is what a stacked layout wants. */
    .api-grid { flex-direction: column; gap: 40px; align-items: stretch; }
    .api-grid-left, .api-grid-right { max-width: 100%; margin-left: 0; }
    .api-grid > * { min-width: 0; max-width: 100%; }
}

@media (max-width: 991px) {
    .api-header-container { padding: 0 20px; }

    .api-mobile-menu-btn {
        display: flex; background: transparent; border: none; color: var(--api-text-main);
        cursor: pointer; padding: 8px; align-items: center; justify-content: center;
    }

    .api-global-header:has(.api-header-nav.active) .api-mobile-menu-btn {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: center;
        background-size: 20px;
    }
    .api-global-header:has(.api-header-nav.active) .api-mobile-menu-btn svg { opacity: 0; }

    .api-header-nav {
        display: none; position: fixed; top: var(--api-header-height); left: 0;
        width: 100vw; height: calc(100vh - var(--api-header-height));
        background: var(--api-surface); border-bottom: 1px solid var(--api-border);
        flex-direction: column; align-items: stretch; padding: 0 0 24px 0; gap: 0;
        box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); overflow-y: auto; z-index: 1000;
    }
    .api-header-nav.active { display: flex; }

    .api-header-actions > a { display: none !important; }

    .api-mobile-auth-actions {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
        gap: 12px;
        padding: 16px 20px;
        border-bottom: 1px solid var(--api-border);
        margin-bottom: 20px;
        width: 100%;
        box-sizing: border-box;
    }
    .api-mobile-auth-actions .api-link-bq {
        grid-column: 1 / -1;
        justify-content: center;
        margin-bottom: 4px;
    }
    .api-mobile-auth-actions .api-btn-primary,
    .api-mobile-auth-actions .api-btn-secondary {
        width: 100%;
        text-align: center;
        justify-content: center;
        box-sizing: border-box;
    }

    .api-header-nav .api-search-btn { margin: 0 20px 24px 20px; width: calc(100% - 40px); box-sizing: border-box; }
    .api-header-nav .api-nav-group  { padding: 0 20px; margin-bottom: 24px; }

    /* Hide desktop sidebar, full-width content */
    .api-sidebar  { display: none; }
    .api-content  { margin-left: 0; width: 100%; padding: 32px 24px; }
}


/* =========================================
   7. SEC PAGES — BQ COMPONENT LIBRARY
   ========================================= */

.dense-grammar-table th,
.dense-grammar-table td {
    padding: 8px 16px !important;
    font-size: var(--fs-xs) !important;
    line-height: 1.6 !important;
}

/* --- 7a. Live Endpoint Bar --- */
.bq-live-endpoint {
    display: flex; align-items: center; gap: 10px;
    background: #f8fafc; border: 1px solid var(--api-border);
    border-radius: 6px; padding: 10px 14px;
    margin-bottom: 12px; overflow: hidden;
}
.bq-live-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #22c55e; flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(34,197,94,0.15);
}
.bq-live-label {
    font-size: var(--fs-micro); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--api-text-muted); white-space: nowrap; flex-shrink: 0;
}
.bq-live-url {
    font-family: var(--api-font-mono); font-size: var(--fs-label); color: #2563eb;
    text-decoration: none; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; flex: 1; min-width: 0;
}
.bq-live-url:hover { text-decoration: underline; }

/* --- 7b. Section Layout --- */
.bq-section-divider {
    margin-top: 56px;
    border-top: 1px solid var(--api-border);
    padding-top: 48px;
}
.bq-section-title {
    font-size: var(--fs-h2); margin: 0 0 8px 0;
    color: var(--api-text-main); font-weight: 700;
}
.bq-section-desc {
    font-size: var(--fs-sm); color: var(--api-text-muted);
    margin: 0 0 24px 0; line-height: 1.65;
    /* No max-width. It was 820px inside a 1400px column, so a section
       description wrapped to a second line with ~345px of empty space beside
       it while the table or viewer directly beneath it ran the full width --
       which reads as a broken line break rather than as a measure. The hero
       paragraph has always run the full column; these now match it. */
}

/* --- 7c. Response Viewer Panel --- */
.bq-viewer-container {
    border: 1px solid var(--api-border);
    border-radius: 8px; overflow: hidden;
}
.bq-viewer-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px; padding: 15px 20px;
    border-bottom: 1px solid var(--api-border); background: #fff;
}
.bq-viewer-title-block { flex: 1; min-width: 220px; }
.bq-viewer-title-block h2 { font-size: var(--fs-h4); margin: 0 0 4px 0; color: var(--api-text-main); font-weight: 700; }
.bq-viewer-title-block p  { font-size: var(--fs-label); color: var(--api-text-muted); margin: 0; line-height: 1.5; }
.bq-viewer-title-block code { font-family: var(--api-font-mono); font-size: var(--fs-badge); background: #f1f5f9; padding: 1px 5px; border-radius: 3px; color: #374151; }
.bq-viewer-controls { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.bq-viewer-container .api-code-container { border: none; border-radius: 0; margin: 0; }
.bq-viewer-container .api-code-block    { border-radius: 0; }

/* --- 7d. Toggle Pill --- */
.bq-toggle-pill {
    display: flex; border: 1px solid var(--api-border-dark);
    border-radius: 6px; overflow: hidden;
}
.bq-toggle-pill button {
    display: flex; align-items: center; gap: 5px;
    padding: 6px 12px; font-size: var(--fs-label); font-weight: 600;
    font-family: var(--api-font-sans); cursor: pointer; border: none;
    background: #f8fafc; color: var(--api-text-muted);
    transition: background 0.15s, color 0.15s; line-height: 1;
}
.bq-toggle-pill button + button { border-left: 1px solid var(--api-border-dark); }
.bq-toggle-pill button.bq-active { background: var(--api-text-main); color: #fff; }
.bq-toggle-pill button:not(.bq-active):hover { background: #e2e8f0; color: var(--api-text-main); }
.bq-toggle-pill button svg { flex-shrink: 0; }

/* --- 7e. Metadata Stat Cards --- */
.bq-meta-stats {
    display: flex; flex-wrap: wrap; padding: 14px 20px; gap: 0;
    background: #f8fafc; border-bottom: 1px solid var(--api-border);
}
.bq-meta-stat {
    display: flex; flex-direction: column; gap: 3px;
    padding-right: 24px; margin-right: 24px;
    border-right: 1px solid var(--api-border);
}
.bq-meta-stat:last-child { border-right: none; padding-right: 0; margin-right: 0; }
.bq-meta-stat-label { font-size: var(--fs-badge); font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--api-text-light); }
.bq-meta-stat-value { font-size: var(--fs-sm); font-weight: 700; color: var(--api-text-main); }

/* --- 7f. Response Data Table --- */
.bq-table-scroll { overflow-x: auto; }

.bq-resp-table {
    width: 100%; min-width: 980px;
    border-collapse: collapse; font-size: var(--fs-xs); font-family: var(--api-font-sans);
}
.bq-resp-table thead tr { background: #f8fafc; border-bottom: 2px solid var(--api-border); }
.bq-resp-table th {
    text-align: left; padding: 9px 12px;
    font-size: var(--fs-badge); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--api-text-muted); white-space: nowrap;
}
.bq-resp-table td {
    padding: 9px 12px; vertical-align: top;
    border-bottom: 1px solid var(--api-border);
    color: var(--api-text-main); font-size: var(--fs-xs); line-height: 1.4;
}
.bq-resp-table tbody tr:last-child td { border-bottom: none; }
.bq-resp-table tbody tr:hover td { background: #fafbfd; }

.bq-table-footer-bar {
    padding: 10px 20px; background: #f8fafc;
    border-top: 1px solid var(--api-border);
    font-size: var(--fs-label); color: var(--api-text-muted); line-height: 1.5;
}
.bq-table-footer-bar code {
    font-family: var(--api-font-mono); background: #e2e8f0;
    padding: 1px 5px; border-radius: 3px; font-size: var(--fs-badge); color: var(--api-text-main);
}

/* --- 7g. Table Cell Elements --- */
.bq-accession-code {
    font-family: var(--api-font-mono); font-size: var(--fs-badge); color: #2563eb; white-space: nowrap;
}

.bq-badge-form {
    display: inline-block; padding: 2px 7px; border-radius: 4px;
    font-size: var(--fs-micro); font-weight: 700; font-family: var(--api-font-mono);
    background: #dbeafe; color: #1d4ed8; white-space: nowrap;
}
.bq-badge-10k { background: #fef3c7; color: #92400e; }
.bq-badge-10q { background: #dbeafe; color: #1d4ed8; }
.bq-badge-8k  { background: #ede9fe; color: #5b21b6; }

.bq-badge-yn  { display: inline-block; padding: 2px 7px; border-radius: 10px; font-size: var(--fs-micro); font-weight: 700; }
.bq-badge-yes { background: #dcfce7; color: #15803d; }
.bq-badge-no  { background: #f1f5f9; color: #64748b; }

.bq-items-pill {
    display: inline-block; background: #f1f5f9; border: 1px solid #e2e8f0;
    border-radius: 3px; padding: 1px 5px; font-size: var(--fs-micro);
    font-family: var(--api-font-mono); color: var(--api-text-muted);
    margin: 1px 2px 1px 0; white-space: nowrap;
}

.bq-exhibit-pill {
    display: inline-flex; align-items: center;
    background: #f0f9ff; border: 1px solid #bae6fd;
    border-radius: 3px; padding: 1px 6px; font-size: var(--fs-micro);
    font-family: var(--api-font-mono); color: #0369a1;
    margin: 1px 2px 1px 0; white-space: nowrap;
    text-decoration: none; transition: background 0.12s, border-color 0.12s;
}
.bq-exhibit-pill:hover { background: #e0f2fe; border-color: #7dd3fc; color: #0c4a6e; }

.bq-link-icon {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: var(--fs-badge); font-weight: 600; text-decoration: none;
    padding: 3px 7px; border-radius: 4px; border: 1px solid var(--api-border);
    color: var(--api-text-muted); white-space: nowrap;
    transition: background 0.12s, color 0.12s;
    margin-right: 3px; margin-bottom: 3px;
}
.bq-link-icon:hover { background: #f1f5f9; color: var(--api-text-main); }

.bq-badge-doc {
    display: inline-block; padding: 2px 7px; border-radius: 4px;
    font-size: var(--fs-micro); font-weight: 700; font-family: var(--api-font-mono); white-space: nowrap;
}
.bq-badge-primary-doc { background: #dbeafe; color: #1d4ed8; }
.bq-badge-exhibit      { background: #dcfce7; color: #15803d; }
.bq-badge-xbrl         { background: #ede9fe; color: #5b21b6; }
.bq-badge-graphic      { background: #fef3c7; color: #92400e; }
.bq-badge-xml          { background: #f1f5f9; color: #475569; }

/* --- 7h. Response Fields Reference Table --- */
.bq-fields-table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
.bq-fields-table th {
    text-align: left; padding: 9px 14px; font-size: var(--fs-badge); font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--api-text-muted); background: #f8fafc; border-bottom: 1px solid var(--api-border);
}
.bq-fields-table td {
    padding: 10px 14px; border-bottom: 1px solid var(--api-border);
    vertical-align: top; color: var(--api-text-main); line-height: 1.55;
}
.bq-fields-table tbody tr:last-child td { border-bottom: none; }
.bq-fields-table .bq-field-name {
    font-family: var(--api-font-mono); font-size: var(--fs-xs);
    color: #2563eb; font-weight: 600; white-space: nowrap;
}
.bq-fields-table .bq-field-type {
    font-family: var(--api-font-mono); font-size: var(--fs-badge);
    background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 4px;
    padding: 2px 7px; white-space: nowrap; color: var(--api-text-muted);
}

/* --- 7i. Use Case Cards --- */
.bq-use-case-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: 16px; margin-top: 8px;
}
.bq-use-case-card {
    background: #f8fafc; border: 1px solid var(--api-border);
    border-radius: 8px; padding: 18px;
}
.bq-use-case-card h4 { margin: 0 0 8px 0; font-size: var(--fs-h4); font-weight: 700; color: var(--api-text-main); }
.bq-use-case-card p  { margin: 0; font-size: var(--fs-sm); color: var(--api-text-muted); line-height: 1.6; }

/* --- 7j. Fixed 3-column grid --- */
.bq-3col-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
@media (max-width: 1100px) {
    .bq-3col-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .bq-3col-grid { grid-template-columns: 1fr; }
}

/* --- 7k. White pills inside gray info panels --- */
.bq-gray-panel .api-param-table code {
    background: #ffffff;
    border-color: #d1d5db;
}

/* =========================================
   8. CROSS-PLUGIN ENCODING FIX
   ========================================= */
.promo-features-list li::before {
    content: '\2713' !important;
}

/* =========================================
   9. LLM COPY DROPDOWN
   ========================================= */
.bq-llm-dropdown-container {
    position: relative;
    display: inline-block;
    z-index: 150;
}
.bq-llm-btn {
    display: flex; align-items: center; gap: 6px;
    background: #fff; border: 1px solid var(--api-border-dark);
    color: var(--api-text-main); padding: 6px 12px; border-radius: 6px;
    font-weight: 600; font-size: var(--fs-xs); cursor: pointer; transition: all 0.2s;
    font-family: var(--api-font-sans);
}
.bq-llm-btn:hover {
    border-color: var(--api-text-main);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.bq-llm-dropdown-menu {
    position: absolute; top: 100%; right: 0; margin-top: 8px;
    background: #fff; border: 1px solid var(--api-border);
    border-radius: 8px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    width: 250px; opacity: 0; visibility: hidden;
    transform: translateY(-5px); transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 6px;
}
.bq-llm-dropdown-menu.active {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.bq-llm-dropdown-item {
    display: flex; align-items: flex-start; gap: 12px; width: 100%;
    background: transparent; border: none; padding: 10px;
    border-radius: 6px; cursor: pointer; text-align: left;
    color: var(--api-text-main); transition: background 0.15s;
    /* A <button> does not inherit type from the page; without this it renders at
       the UA default of 13.333px, the one element on the page off the scale. */
    font-family: var(--api-font-sans); font-size: var(--fs-xs);
}
.bq-llm-dropdown-item:hover { background: #f0fdf4; }
.bq-llm-dropdown-item strong { display: block; font-size: var(--fs-xs); font-weight: 600; margin-bottom: 2px; }
.bq-llm-dropdown-item span { display: block; font-size: var(--fs-label); color: var(--api-text-muted); }
.bq-llm-dropdown-item svg { margin-top: 2px; color: #15803d; flex-shrink: 0; }

/* Header layout for pages carrying the copy button. llm-copy.js adds
   .has-llm-copy and wraps the h1, date and description in __text. Keep this
   here rather than inline in the JS, or the media query below cannot win. */
.api-page-header.has-llm-copy {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 20px;
}
.api-page-header__text { flex: 1 1 320px; min-width: 0; }

/* Stack at 991px, NOT at a phone width. 991px is where layout.php already flips
   the whole portal to mobile (hamburger nav, sidebar hidden), so anything below
   it must not keep a desktop two column header. The old 640px value left the
   641-991px band — tablets, large phones, any phone in landscape — rendering a
   32px h1 squeezed into ~60% of the line with the copy button holding the rest. */
@media (max-width: 991px) {
    .api-page-header.has-llm-copy {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-start;
        align-items: flex-start; /* button tops out level with the byline line */
        gap: 0; /* the children carry their own margins; a gap double spaces them */
    }
    /* Dissolve the wrapper so h1, meta, button and description all become flex
       items of the header itself. Without this the button can only land after
       the entire text block, which on a long hero paragraph strands it far from
       the title it belongs to. */
    .api-page-header__text { display: contents; }

    /* flex-basis 100% forces its own row, so the h1 always gets the full width. */
    /* The h1 margin is what opens the gap down to the byline. Do NOT move this to
       a top margin on the meta block: the copy button shares the meta's flex row
       and has no such margin, so the two would stop being level. */
    .api-page-header h1 {
        order: 1;
        flex: 0 0 100%;
        font-size: var(--fs-h1);
        line-height: 1.3;
        margin-bottom: 18px;
    }
    /* Gap from the last updated line down to the description. */
    .api-page-meta { margin-bottom: 20px; }
    /* The meta block: either a .api-page-meta wrapper (byline + date stacked) or,
       on pages that only carry a date, the bare first paragraph. The :not() guard
       stops the description being mistaken for the date line on the former.
       flex: 1 1 auto lets it share its row with the copy button. */
    .api-page-header__text > .api-page-meta,
    .api-page-header__text > p:first-of-type:not(.api-description) {
        order: 2;
        flex: 1 1 auto;
        min-width: 0;
        /* Any top margin here offsets the meta text against the button, which has
           none, so the two stop being level. !important because every page sets
           this margin inline (margin:4px 0 12px) and would otherwise win. */
        margin-top: 0 !important;
    }
    /* Sits on the meta row, pushed to the right edge by the auto margin and top
       aligned with the first meta line rather than stranded on its own row. */
    .bq-llm-dropdown-container {
        order: 3;
        flex: 0 0 auto;
        margin-left: auto;
        align-self: flex-start;
    }
    /* Description and anything else each take a full row, in DOM order. */
    .api-page-header__text > p {
        order: 4;
        flex: 0 0 100%;
    }
    /* The button is right aligned here, so the 250px panel keeps the inherited
       right:0 anchor and opens inward instead of off the side of the screen. */
}

@media (max-width: 640px) {
    .api-page-header h1 { font-size: var(--fs-h1); line-height: 1.25; margin-bottom: 14px; }
    .api-page-header { margin-bottom: 32px; }
}

/* =========================================
   10. MOBILE LAYOUT GUARDS  (must stay last)
   =========================================
   The page templates each hardcode their own layout inline — 3,500+ inline
   style attributes across 23 files, including 12 fixed-count grids such as
   `repeat(4, 1fr)` and `1fr 1fr` that have no mobile collapse.

   `1fr` is shorthand for `minmax(auto, 1fr)`, and `auto` resolves to
   min-content. So a four column grid on a 375px screen cannot shrink below the
   widest unbreakable word in each column, and the whole document scrolls
   sideways. Same story for flex children, whose default `min-width: auto`
   lets a long cURL URL inside a <pre> propagate its width all the way up.

   These rules fix every page centrally instead of editing each template.
   `!important` is needed only because the declarations being overridden are
   inline; nothing here would otherwise outrank a stylesheet rule. */

@media (max-width: 991px) {
    /* Reflow any inline grid to as many columns as actually fit, with a zero
       floor so a column can always shrink. */
    .api-content-inner [style*="grid-template-columns"] {
        grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)) !important;
    }
    /* Every .api-grid child, classed or not, needs the explicit zero floor. */
    .api-grid > * { min-width: 0; }
}

@media (max-width: 640px) {
    /* One column on a phone, and minmax(0, …) removes the min-content floor
       entirely rather than merely raising the breakpoint at which it bites. */
    .api-content-inner [style*="grid-template-columns"] {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}
