/* Leonardo Library -- shared collapsible page header.
   Every Library shelf and every Research detail page shows the same thing when
   you land on it: the Leonardo icon band, one slim summary row, and the list.
   The stat band, the action buttons and the group-by controls all live behind
   an Options wedge; the Research banner's question / status / tags live behind
   a wedge of their own. Chrome shows when you ask for it and gives the screen
   back when you don't.

   Canonical home for .qm-toolbar / .qm-options / .optbtn -- the per-shelf
   stylesheets used to each carry their own copy. Load this AFTER the shelf
   stylesheet. */

/* ---- the stat band, now collapsible ------------------------------------- */
.qm-stats.lh-collapsible,
.db-stats.lh-collapsible { display: none; }
.qm-stats.lh-collapsible.open,
.db-stats.lh-collapsible.open { display: flex; }

/* ---- slim always-on toolbar --------------------------------------------- */
.qm-toolbar, .db-toolbar {
    display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; flex: 0 0 auto;
    padding: 7px 10px; background: #fff; box-sizing: border-box;
    border-bottom: 1px solid var(--qm-line, #e6e8ef);
}
.qm-toolbar .lbl, .db-toolbar .lbl {
    font-size: 12px; color: var(--qm-muted, #6b7280);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* The summary doubles as a tap target -- the whole line opens the panel. */
.lh-summary {
    flex: 1 1 auto; min-width: 0; cursor: pointer;
    font-size: 12px; font-weight: 600; color: var(--qm-muted, #6b7280);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    background: none; border: none; padding: 4px 0; text-align: left; font-family: inherit;
}
.lh-summary:empty { visibility: hidden; }

.qm-toolbar .optbtn, .db-toolbar .optbtn {
    margin-left: auto; flex: 0 0 auto; padding: 7px 12px;
}
.qm-toolbar .optbtn .chev, .db-toolbar .optbtn .chev {
    font-size: 11px; color: var(--qm-muted, #6b7280); transition: transform .15s;
}
.qm-toolbar .optbtn.open, .db-toolbar .optbtn.open {
    background: var(--qm-accent-soft, #f3f1fd); border-color: #d7d0f7;
}
.qm-toolbar .optbtn.open .chev, .db-toolbar .optbtn.open .chev { transform: rotate(180deg); }

/* ---- the collapsible options panel -------------------------------------- */
.qm-options, .db-options { display: none; }
.qm-options.open, .db-options.open {
    display: block; flex: 0 0 auto;
    max-height: 52vh; overflow-y: auto;             /* never crowd the list off screen */
    background: #fff; border-bottom: 1px solid var(--qm-line, #e6e8ef);
}
.qm-options .qm-groupbar { border-top: 1px solid var(--qm-line, #e6e8ef); }
.db-options .db-groupbar { border-top: 1px solid var(--qm-line, #e6e8ef); }
.qm-options .qm-actions, .db-options .db-actions { border-bottom: none; }

/* ---- Research detail banner (program / project) ------------------------- */
/* The title row and the wedge always show; the question, the status pills and
   the topic tags fold away. */
.pw-banner-detail { display: none; }
.pw-banner-detail.open { display: block; }

.pw-banner-wedge {
    flex: 0 0 auto; align-self: flex-start;
    font: inherit; font-size: 11px; font-weight: 700; line-height: 1;
    letter-spacing: .4px; text-transform: uppercase;
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(255,255,255,.10); color: #e7e4fb;
    border: 1px solid rgba(255,255,255,.22); border-radius: 999px;
    padding: 7px 11px; cursor: pointer;
    transition: background .12s;
}
.pw-banner-wedge:hover { background: rgba(255,255,255,.20); }
.pw-banner-wedge .chev { font-size: 10px; transition: transform .15s; }
.pw-banner-wedge.open .chev { transform: rotate(180deg); }

/* Collapsed, the banner is one tight title row. */
.pw-banner.lh-collapsed .pw-banner-inner { padding-bottom: 10px; }
.pw-banner.lh-collapsed .pw-title { font-size: 17px; }

/* ---- Lazy loading switch (Story 2393) ---------------------------------- */
/* Rides in the Options group bar beside Expand all, so the shelf gains no row.
   Lit when on, which is the default. */
.qm-groupbar .ll-toggle.on, .db-groupbar .ll-toggle.on {
    border-color: #c9a227; color: #7a5f00; background: #fdf6dd;
}
.qm-groupbar .ll-toggle .ic, .db-groupbar .ll-toggle .ic { opacity: .85; }

/* A band whose cards have not been built yet holds this placeholder. It takes
   no room -- the band header already carries the name and the count. */
.ll-pending { display: none; }
