/* =================================================================
   Playlist Hub — three-zone unified tool
   Replaces both Playlist Builder and My Playlists floating window.
   Zones: rail (saved playlists) | library (browse) | active (edit).
   ================================================================= */

/* ---- Overlay shell — full-viewport tool ---- */
#pg-hub-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--pg-z-overlay, 9100);
    display: none;
    background: var(--pg-surface, #fff);
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--pg-font-ui, system-ui, -apple-system, BlinkMacSystemFont, sans-serif);
}
#pg-hub-overlay.is-open { display: flex; }

#pg-hub-dock {
    width: 100%;
    height: 100%;
    background: var(--pg-surface, #fff);
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--pg-text-primary, #1a242d);
}

/* WP admin bar offset — same pattern the tools panel uses */
body.admin-bar #pg-hub-overlay { top: 32px; }
@media screen and (max-width: 782px) {
    body.admin-bar #pg-hub-overlay { top: 46px; }
}

/* ---- Topbar ---- */
.pg-hub-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: var(--pg-blue, #1E4F75);
    color: var(--pg-white, #fff);
    flex-shrink: 0;
}
.pg-hub-title {
    font-size: var(--pg-text-lg, 16px);
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--pg-white, #fff);
}
.pg-hub-close,
button.pg-hub-close {
    background: transparent !important;
    border: none !important;
    color: var(--pg-white, #fff) !important;
    font-size: var(--pg-text-2xl, 24px);
    line-height: 1;
    cursor: pointer;
    padding: 0 4px !important;
    opacity: 0.85;
    transition: opacity 0.15s;
    box-shadow: none !important;
}
.pg-hub-close:hover { opacity: 1; }

/* ---- Body: three-zone grid with two drag-resizers between zones.
   Zone widths live in CSS vars so the resizer JS can update them
   inline; defaults match the previous fixed layout. Middle zone is
   the flex column that absorbs leftover space. */
.pg-hub-body {
    /* Default: three equal columns. The resizer JS overrides these
       vars with explicit pixel widths when the user drags a divider
       (persisted to localStorage), so users with a saved layout keep
       theirs while fresh installs (or anyone who clears the saved
       widths) get clean thirds. */
    --pg-hub-rail-w: 1fr;
    --pg-hub-edit-w: 1fr;
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: var(--pg-hub-rail-w) 6px minmax(0, 1fr) 6px var(--pg-hub-edit-w);
    gap: 0;
    background: var(--pg-bg, #f5f7f9);
}

/* Drag handles between the three zones — flat 6px column with a
   subtle blue tint on hover/active. Cursor signals it's draggable;
   :focus-visible mirrors the active state for keyboard users. */
.pg-hub-resizer {
    cursor: col-resize;
    background: transparent;
    border-left: 1px solid var(--pg-border, #d8dde4);
    border-right: 1px solid var(--pg-border, #d8dde4);
    position: relative;
    z-index: 1;
    transition: background-color 0.12s ease;
    user-select: none;
}
.pg-hub-resizer:hover,
.pg-hub-resizer:focus-visible,
.pg-hub-resizer.is-dragging {
    background: rgba(30, 79, 117, 0.18);
    outline: none;
}
/* While dragging, paint the global cursor and disable text selection
   so the user can sweep across the whole window without snags. */
.pg-hub-body.is-resizing,
.pg-hub-body.is-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}

.pg-hub-zone {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--pg-surface, #fff);
    border-right: 1px solid var(--pg-border, #d8dde4);
}
.pg-hub-zone:last-child { border-right: none; }

.pg-hub-zone__head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--pg-border, #d8dde4);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pg-hub-zone__title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.pg-hub-zone__title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pg-text-muted, #6b7d8a);
    margin: 0;
}
.pg-hub-zone__count {
    font-size: 12px;
    color: var(--pg-text-muted, #6b7d8a);
    font-weight: 500;
}

.pg-hub-zone__body {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}
.pg-hub-zone__body::-webkit-scrollbar { width: 6px; }
.pg-hub-zone__body::-webkit-scrollbar-thumb {
    background: var(--pg-border-strong, #d0d6dc);
    border-radius: 4px;
}

.pg-hub-zone__foot {
    padding: 12px 16px;
    border-top: 1px solid var(--pg-border, #d8dde4);
    flex-shrink: 0;
    display: flex;
    gap: 8px;
}

/* ============================================================
   ZONE 1 — Saved-playlists rail (left)
   ============================================================ */
.pg-hub-rail__list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
}
.pg-hub-rail__row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px 8px 12px;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    border-left: 3px solid transparent;
}
.pg-hub-rail__row:hover {
    background: rgba(30, 79, 117, 0.06);
}
.pg-hub-rail__row.is-active {
    background: rgba(30, 79, 117, 0.1);
    border-left-color: var(--pg-blue, #1E4F75);
}
.pg-hub-rail__drag {
    cursor: grab;
    color: var(--pg-text-muted, #6b7d8a);
    font-size: 14px;
    flex-shrink: 0;
    user-select: none;
    line-height: 1;
}
.pg-hub-rail__drag:active { cursor: grabbing; }
.pg-hub-rail__name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--pg-text-primary, #1a242d);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* Single-click on the name enters rename mode (text-cursor signals
       it's editable). !important here defeats the row's cursor:pointer
       inheriting via specificity. */
    cursor: text !important;
}
.pg-hub-rail__row.is-active .pg-hub-rail__name {
    color: var(--pg-blue, #1E4F75);
    font-weight: 600;
}
/* Inline-editable title input replaces the span when editing */
.pg-hub-rail__name-input {
    flex: 1 1 auto;
    min-width: 0;
    font: inherit;
    font-size: 16px;
    font-weight: 500;
    padding: 4px 6px;
    border: 1px solid var(--pg-blue, #1E4F75);
    border-radius: 4px;
    background: var(--pg-surface, #fff);
    color: var(--pg-text-primary, #1a242d);
    outline: none;
    caret-color: var(--pg-blue, #1E4F75);
}

.pg-hub-rail__count {
    font-size: 13px;
    color: var(--pg-text-muted, #6b7d8a);
    flex-shrink: 0;
    margin-right: 4px;
    font-variant-numeric: tabular-nums;
}

/* Inline action buttons on each rail row — print / share / export / delete.
   Drop-shaped buttons share the same baseline geometry; per-button hover
   colors below give each a distinct affordance. */
.pg-hub-rail__action,
button.pg-hub-rail__action {
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    padding: 5px !important;
    border-radius: 4px !important;
    color: var(--pg-text-muted, #6b7d8a) !important;
    width: 32px !important;
    height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
    transition: color 0.12s, background 0.12s;
    box-shadow: none !important;
    font-size: 14px !important;
    line-height: 1 !important;
}
.pg-hub-rail__action svg { width: 18px; height: 18px; }
.pg-hub-rail__print:hover,
.pg-hub-rail__share:hover,
.pg-hub-rail__export:hover {
    color: var(--pg-blue, #1E4F75) !important;
    background: rgba(30, 79, 117, 0.08) !important;
}
.pg-hub-rail__delete:hover {
    color: #c0392b !important;
    background: rgba(192, 57, 43, 0.1) !important;
}

.pg-hub-rail__empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--pg-text-muted, #6b7d8a);
    font-size: 13px;
    line-height: 1.5;
}

.pg-hub-rail__newbtn {
    width: 100%;
    padding: 10px 12px !important;
    background: var(--pg-surface, #fff) !important;
    color: var(--pg-blue, #1E4F75) !important;
    border: 1px dashed var(--pg-border-strong, #d0d6dc) !important;
    border-radius: var(--pg-radius-md, 6px) !important;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
    box-shadow: none !important;
}
.pg-hub-rail__newbtn:hover {
    border-color: var(--pg-blue, #1E4F75) !important;
    background: rgba(30, 79, 117, 0.04) !important;
}

/* ==========================================================
   Songbook print modal — prefs-popup styling
   Brand-blue header band, body with grouped sections (uppercase
   small-caps titles), label-left/control-right rows, collapsible
   "Customize" section that hides the granular options until the
   user expands them.
   ========================================================== */
.pg-hub-modal--songbook .pg-hub-modal__card {
    width: min(560px, calc(100vw - 32px));
    max-height: min(90vh, 820px);
    padding: 0;          /* header / body / foot manage their own padding */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pg-hub-songbook-head {
    padding: 16px 22px;
    background: var(--pg-blue, #1E4F75);
    color: var(--pg-white, #fff);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.pg-hub-songbook-head__title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--pg-white, #fff);
    margin: 0;
    line-height: 1.2;
}
.pg-hub-songbook-head__close {
    background: transparent !important;
    border: none !important;
    color: var(--pg-white, #fff) !important;
    font-size: 24px;
    line-height: 1;
    padding: 4px 10px !important;
    cursor: pointer;
    border-radius: var(--pg-radius-sm, 4px);
    transition: background 0.12s;
}
.pg-hub-songbook-head__close:hover { background: rgba(255, 255, 255, 0.14) !important; }

.pg-hub-songbook-body {
    padding: 18px 22px 8px;
    overflow-y: auto;
    flex: 1 1 auto;
}
.pg-hub-songbook-body::-webkit-scrollbar { width: 6px; }
.pg-hub-songbook-body::-webkit-scrollbar-thumb { background: var(--pg-border-strong, #d0d6dc); border-radius: 6px; }

.pg-hub-songbook-hint {
    font-size: 12.5px;
    color: var(--pg-text-muted, #6b7d8a);
    line-height: 1.45;
    margin: 0 0 16px;
    font-style: italic;
}

/* Identity row — label-left / control-right grid (mirrors prefs-popup
   .pg-prefs-row). */
.pg-hub-songbook-row {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 12px;
    align-items: center;
    padding: 7px 0;
    border-top: 1px solid var(--pg-border-light, #ebeff3);
}
.pg-hub-songbook-row:first-of-type { border-top: none; }
.pg-hub-songbook-row__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--pg-text-primary, #1a242d);
}
.pg-hub-songbook-input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--pg-border-strong, #d0d6dc);
    border-radius: var(--pg-radius-md, 6px);
    background: var(--pg-surface, #fff);
    color: var(--pg-text-primary, #1a242d);
    font: inherit;
    font-size: 13px;
    box-sizing: border-box;
}
.pg-hub-songbook-input:focus {
    border-color: var(--pg-blue, #1E4F75);
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 79, 117, 0.12);
}
.pg-hub-songbook-input--num { width: 64px; }
.pg-hub-songbook-input--auto { width: auto; }

/* Disclosure toggle — chevron rotates on open. */
.pg-hub-songbook-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--pg-blue, #1E4F75);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 0;
    margin: 6px 0 0;
}
.pg-hub-songbook-toggle:hover { text-decoration: underline; }
.pg-hub-songbook-toggle__chevron {
    display: inline-block;
    transition: transform 0.15s;
    font-size: 12px;
}
.pg-hub-songbook-toggle[aria-expanded="true"] .pg-hub-songbook-toggle__chevron {
    transform: rotate(90deg);
}

.pg-hub-songbook-advanced {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--pg-border-light, #ebeff3);
}

/* Sections (mirror prefs-popup .pg-prefs-section) */
.pg-hub-songbook-section {
    margin-bottom: 16px;
}
.pg-hub-songbook-section:last-child { margin-bottom: 0; }
.pg-hub-songbook-section__title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--pg-text-muted, #6b7d8a);
    margin: 0 0 8px 0;
}
.pg-hub-songbook-section__note {
    font-size: 12px;
    color: var(--pg-text-muted, #6b7d8a);
    margin: -4px 0 8px 0;
    font-style: italic;
}
.pg-hub-songbook-section__body {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 18px;
    align-items: center;
}

/* Compact form atoms used inside section bodies. */
.pg-hub-songbook-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--pg-text-primary, #1a242d);
    cursor: pointer;
}
.pg-hub-songbook-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--pg-text-primary, #1a242d);
}

/* Segmented toggle group — mirrors prefs-popup .pg-prefs-toggle-group.
   Each option is a button; the active one paints brand-blue with white
   text. */
.pg-hub-songbook-toggle-group {
    display: inline-flex;
    background: var(--pg-surface-sunken, #f4f6f8);
    border: 1px solid var(--pg-border, #d8dde4);
    border-radius: var(--pg-radius-md, 6px);
    padding: 2px;
    gap: 2px;
    flex-shrink: 0;
}
.pg-hub-songbook-toggle-group--full {
    display: flex;
    width: 100%;
}
.pg-hub-songbook-toggle-group--full .pg-hub-songbook-toggle-btn {
    flex: 1 1 0;
    min-width: 0;
}
.pg-hub-songbook-toggle-btn,
button.pg-hub-songbook-toggle-btn {
    background: transparent !important;
    border: none !important;
    color: var(--pg-text-primary, #1a242d) !important;
    font: inherit;
    font-size: 12.5px;
    font-weight: 500;
    /* Fixed minimum width so binary toggles (Yes/No, Letters/Numbers,
       Inline/Above) all line up at a consistent size; longer labels
       grow naturally past it. */
    min-width: 50px;
    padding: 5px 10px !important;
    border-radius: var(--pg-radius-sm, 4px) !important;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    box-shadow: none !important;
    white-space: nowrap;
    text-align: center;
}
.pg-hub-songbook-toggle-btn:hover {
    background: rgba(30, 79, 117, 0.08) !important;
}
.pg-hub-songbook-toggle-btn.is-active,
.pg-hub-songbook-toggle-btn[aria-pressed="true"] {
    background: var(--pg-blue, #1E4F75) !important;
    color: var(--pg-white, #fff) !important;
    font-weight: 600;
}
.pg-hub-songbook-toggle-btn:disabled,
.pg-hub-songbook-toggle-group.is-disabled .pg-hub-songbook-toggle-btn {
    cursor: not-allowed !important;
    opacity: 0.45;
    pointer-events: none;
}
.pg-hub-songbook-toggle-group.is-disabled {
    opacity: 0.55;
}

/* Section heading inside the modal body — small uppercase grey caps
   with a hairline rule above. Same shape the prefs popup uses, so
   when we mirror this design there it's a one-class transplant. */
.pg-hub-songbook-section__title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--pg-text-muted, #6b7d8a);
    margin: 18px 0 4px;
    padding-top: 12px;
    border-top: 1px solid var(--pg-border-light, #ebeff3);
}
.pg-hub-songbook-section__title:first-of-type {
    margin-top: 16px;
}

/* Row inside a section: label-left / control-right. */
.pg-hub-songbook-row.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}
.pg-hub-songbook-row .pg-hub-songbook-input--num {
    width: 64px;
    text-align: center;
    padding: 6px 8px;
    font-size: 13px;
}

/* Multi-control row — drops the 96px-label-then-control grid for a
   flex layout that packs multiple controls horizontally. Used for
   Cover/Date/Font, Show-chords + Position, Letters/Numbers + Capo,
   and Beats + Repeats. Children are individual <label> .pg-hub-
   songbook-row__pair groupings (label + control glued together) or
   bare control elements (segmented group, select). */
.pg-hub-songbook-row--multi {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px 22px;
    padding: 9px 0;
    grid-template-columns: none;   /* defeat the row grid */
}
.pg-hub-songbook-row__pair {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}
.pg-hub-songbook-row__pair.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}
.pg-hub-songbook-row__pair .pg-hub-songbook-row__label {
    font-size: 13px;
    color: var(--pg-text-primary, #1a242d);
    font-weight: 500;
}
.pg-hub-songbook-row__pair input[type="number"] {
    width: 56px;
}

/* Native select used for Capo (one input among 4 options is much
   cleaner than a 4-button strip). Compact width + custom chevron
   to match the rest of the modal. */
.pg-hub-songbook-input--select {
    width: 200px;
    padding: 6px 28px 6px 10px;
    background: var(--pg-surface, #fff);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236b7d8a' stroke-width='3'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}

/* iOS-style toggle switch — used for binary on/off settings (Cover,
   Date, Show chords, Show beats, Show repeats). Labelled by the
   .pg-hub-songbook-row__label sibling; an off-screen .pg-hub-switch__sr
   span carries an accessible name for the input itself. Class names
   are deliberately neutral (.pg-hub-switch, not …-songbook-…) so we
   can drop the same component into the prefs popup without renaming. */
.pg-hub-switch {
    display: inline-block;
    position: relative;
    cursor: pointer;
    width: 38px;
    height: 22px;
    flex-shrink: 0;
}
.pg-hub-switch input {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}
.pg-hub-switch__track {
    position: absolute;
    inset: 0;
    background: var(--pg-border-strong, #d0d6dc);
    border-radius: 11px;
    transition: background 0.15s ease;
}
.pg-hub-switch__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: left 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.pg-hub-switch input:checked + .pg-hub-switch__track {
    background: var(--pg-blue, #1E4F75);
}
.pg-hub-switch input:checked + .pg-hub-switch__track .pg-hub-switch__thumb {
    left: 18px;
}
.pg-hub-switch input:focus-visible + .pg-hub-switch__track {
    box-shadow: 0 0 0 3px rgba(30, 79, 117, 0.18);
}
.pg-hub-switch input:disabled {
    cursor: not-allowed;
}
.pg-hub-switch input:disabled + .pg-hub-switch__track {
    opacity: 0.55;
}
/* Visually hidden text — accessible name for screen readers. */
.pg-hub-switch__sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.pg-hub-songbook-foot {
    padding: 14px 22px;
    border-top: 1px solid var(--pg-border, #d8dde4);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

/* Rail row action popover (Print + Export submenus) */
.pg-hub-popover {
    position: fixed;
    z-index: 9300;
    background: var(--pg-surface, #fff);
    border: 1px solid var(--pg-border, #d8dde4);
    border-radius: var(--pg-radius-md, 6px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.15);
    padding: 6px 0;
    min-width: 180px;
    font-size: 13px;
    display: none;
}
.pg-hub-popover.is-open { display: block; }
.pg-hub-popover__item,
.pg-hub-popover button.pg-hub-popover__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 8px 14px !important;
    background: transparent !important;
    border: none !important;
    color: var(--pg-text-primary, #1a242d) !important;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: 13px;
    box-shadow: none !important;
}
.pg-hub-popover__item:hover {
    background: rgba(30, 79, 117, 0.06) !important;
}
.pg-hub-popover__item--danger { color: var(--pg-danger, #b91c1c) !important; }
.pg-hub-popover__item--danger:hover { background: rgba(185, 28, 28, 0.06) !important; }
.pg-hub-popover__caret { font-size: 11px; color: var(--pg-text-muted, #6b7d8a); }
.pg-hub-popover__sep { height: 1px; margin: 4px 0; background: var(--pg-border, #d8dde4); }

/* ============================================================
   ZONE 2 — Library browser (middle)
   ============================================================ */
.pg-hub-lib__search {
    position: relative;
}
.pg-hub-lib__search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--pg-text-muted, #6b7d8a);
    pointer-events: none;
}
.pg-hub-lib__search input {
    width: 100%;
    padding: 9px 12px 9px 34px !important;
    border: 1px solid var(--pg-border-strong, #d0d6dc) !important;
    border-radius: var(--pg-radius-md, 6px) !important;
    font-size: 14px;
    color: var(--pg-text-primary, #1a242d) !important;
    background: var(--pg-surface, #fff) !important;
    box-sizing: border-box;
    outline: none;
}
.pg-hub-lib__search input:focus-visible {
    border-color: var(--pg-blue, #1E4F75) !important;
    box-shadow: var(--pg-focus-ring, 0 0 0 3px rgba(30,79,117,0.15)) !important;
}

.pg-hub-lib__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.pg-hub-lib__pill,
button.pg-hub-lib__pill {
    padding: 5px 10px !important;
    border: 1px solid var(--pg-border-strong, #d0d6dc) !important;
    background: var(--pg-surface, #fff) !important;
    color: var(--pg-text-primary, #1a242d) !important;
    border-radius: 999px !important;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    box-shadow: none !important;
}
.pg-hub-lib__pill:hover { border-color: var(--pg-blue, #1E4F75) !important; }
.pg-hub-lib__pill.is-active {
    background: var(--pg-blue, #1E4F75) !important;
    color: var(--pg-white, #fff) !important;
    border-color: var(--pg-blue, #1E4F75) !important;
}

.pg-hub-lib__bandfilter {
    width: 100%;
    padding: 6px 10px !important;
    border: 1px solid var(--pg-border-strong, #d0d6dc) !important;
    border-radius: var(--pg-radius-md, 6px) !important;
    font-size: 13px;
    background: var(--pg-surface, #fff) !important;
    color: var(--pg-text-primary, #1a242d) !important;
    box-sizing: border-box;
    outline: none;
}

.pg-hub-lib__bulk {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 4px;
}
.pg-hub-lib__check-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    color: var(--pg-text-secondary, #4a5568);
    user-select: none;
}
.pg-hub-lib__check-all input { margin: 0; cursor: pointer; }

.pg-hub-lib__list-wrap {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
}
.pg-hub-lib__list {
    flex: 1 1 auto;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 4px 0;
    min-width: 0;
}
.pg-hub-lib__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    transition: background 0.1s;
    border-bottom: 1px solid rgba(216, 221, 228, 0.5);
}
.pg-hub-lib__row:hover { background: rgba(30, 79, 117, 0.05); }
.pg-hub-lib__row-check {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}
.pg-hub-lib__row-text {
    flex: 1 1 auto;
    min-width: 0;
}
.pg-hub-lib__row-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--pg-text-primary, #1a242d);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}
.pg-hub-lib__row-meta {
    font-size: 11.5px;
    color: var(--pg-text-muted, #6b7d8a);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pg-hub-lib__row-add,
button.pg-hub-lib__row-add {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    background: var(--pg-surface, #fff) !important;
    color: var(--pg-blue, #1E4F75) !important;
    border: 1px solid var(--pg-border-strong, #d0d6dc) !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
    line-height: 1 !important;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s, border-color 0.12s, transform 0.1s;
    box-shadow: none !important;
    padding: 0 !important;
}
.pg-hub-lib__row-add:hover {
    background: var(--pg-blue, #1E4F75) !important;
    color: var(--pg-white, #fff) !important;
    border-color: var(--pg-blue, #1E4F75) !important;
}
.pg-hub-lib__row.is-staged .pg-hub-lib__row-add {
    background: var(--pg-green, #53A96B) !important;
    color: var(--pg-white, #fff) !important;
    border-color: var(--pg-green, #53A96B) !important;
}

.pg-hub-lib__empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--pg-text-muted, #6b7d8a);
    font-size: 13px;
}

/* ============================================================
   ZONE 3 — Active-edit panel (right)
   ============================================================ */
.pg-hub-edit__title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pg-hub-edit__title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--pg-text-primary, #1a242d);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: text !important;
    padding: 4px 6px;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: border-color 0.12s, background 0.12s;
}
.pg-hub-edit__title:hover {
    background: rgba(30, 79, 117, 0.04);
    border-color: var(--pg-border, #d8dde4);
}
.pg-hub-edit__title-input {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 18px;
    font-weight: 700;
    padding: 4px 6px;
    border: 1px solid var(--pg-blue, #1E4F75);
    border-radius: 4px;
    background: var(--pg-surface, #fff);
    color: var(--pg-text-primary, #1a242d);
    outline: none;
    caret-color: var(--pg-blue, #1E4F75);
    font-family: inherit;
}
.pg-hub-edit__sub {
    font-size: 12px;
    color: var(--pg-text-muted, #6b7d8a);
    margin: 0;
    line-height: 1.4;
}

.pg-hub-edit__list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
}
.pg-hub-edit__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(216, 221, 228, 0.5);
    background: var(--pg-surface, #fff);
}
.pg-hub-edit__drag {
    cursor: grab;
    color: var(--pg-text-muted, #6b7d8a);
    font-size: 14px;
    flex-shrink: 0;
    user-select: none;
    line-height: 1;
    padding: 0 2px;
}
.pg-hub-edit__drag:active { cursor: grabbing; }
.pg-hub-edit__row.sortable-ghost {
    opacity: 0.4;
    background: rgba(30, 79, 117, 0.08);
}
.pg-hub-edit__row.sortable-chosen { background: rgba(30, 79, 117, 0.04); }

.pg-hub-edit__num {
    font-size: 12px;
    color: var(--pg-text-muted, #6b7d8a);
    width: 22px;
    flex-shrink: 0;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.pg-hub-edit__text {
    flex: 1 1 auto;
    min-width: 0;
}
.pg-hub-edit__row-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--pg-text-primary, #1a242d);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}
.pg-hub-edit__row-meta {
    font-size: 11.5px;
    color: var(--pg-text-muted, #6b7d8a);
    margin-top: 2px;
}

/* Placeholder row — same geometry as a song row but with editable
   title + key inputs, italic + grey accent so users see "this isn't
   from the catalog." */
.pg-hub-edit__row--placeholder {
    background: rgba(30, 79, 117, 0.025);
}
.pg-hub-edit__row--placeholder .pg-hub-edit__num {
    font-style: italic;
}
.pg-hub-edit__row-input,
input.pg-hub-edit__row-input {
    font-family: inherit;
    font-size: 14px;
    font-style: italic;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 4px;
    padding: 4px 6px;
    color: var(--pg-text-primary, #1a242d);
    outline: none;
    min-width: 0;
    box-sizing: border-box;
}
.pg-hub-edit__row-input--title { width: 100%; }
.pg-hub-edit__row-input--key {
    width: 56px;
    flex-shrink: 0;
    text-align: center;
    font-style: normal;
    font-weight: 600;
    color: var(--pg-blue, #1E4F75);
}
.pg-hub-edit__row-input:hover,
.pg-hub-edit__row-input:focus {
    background: var(--pg-surface, #fff);
    border-color: var(--pg-border-strong, #d0d6dc);
}
.pg-hub-edit__row-input:focus {
    border-color: var(--pg-blue, #1E4F75);
    box-shadow: 0 0 0 2px rgba(30, 79, 117, 0.1);
}

/* Set-break row — full-width divider, all-caps centered label,
   subtle dotted rule above and below. */
.pg-hub-edit__break {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px;
    background: transparent;
    position: relative;
}
.pg-hub-edit__break::before,
.pg-hub-edit__break::after {
    content: '';
    flex: 1 1 auto;
    border-top: 1px dashed var(--pg-border-strong, #d0d6dc);
    align-self: center;
    height: 0;
}
.pg-hub-edit__break .pg-hub-edit__drag {
    margin-right: 4px;
}
.pg-hub-edit__break-label,
input.pg-hub-edit__break-label {
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--pg-text-muted, #6b7d8a);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 6px 10px;
    text-align: center;
    width: 110px;
    flex-shrink: 0;
    outline: none;
    box-sizing: border-box;
}
.pg-hub-edit__break-label:hover,
.pg-hub-edit__break-label:focus {
    background: var(--pg-surface, #fff);
    border-color: var(--pg-border-strong, #d0d6dc);
}
.pg-hub-edit__break-label:focus {
    border-color: var(--pg-blue, #1E4F75);
    box-shadow: 0 0 0 2px rgba(30, 79, 117, 0.1);
}
.pg-hub-edit__break.sortable-ghost { opacity: 0.4; }
.pg-hub-edit__break.sortable-chosen { background: rgba(30, 79, 117, 0.04); }
.pg-hub-edit__remove,
button.pg-hub-edit__remove {
    width: 24px !important;
    height: 24px !important;
    background: transparent !important;
    color: var(--pg-text-muted, #6b7d8a) !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer;
    font-size: 16px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
    transition: color 0.1s, background 0.1s;
    box-shadow: none !important;
    padding: 0 !important;
}
.pg-hub-edit__remove:hover {
    color: var(--pg-danger, #b91c1c) !important;
    background: rgba(185, 28, 28, 0.06) !important;
}

.pg-hub-edit__empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--pg-text-muted, #6b7d8a);
    font-size: 13px;
    line-height: 1.5;
}

/* Active-edit panel toolbar buttons */
.pg-hub-btn,
button.pg-hub-btn {
    padding: 8px 14px !important;
    border-radius: var(--pg-radius-md, 6px) !important;
    border: 1px solid var(--pg-border-strong, #d0d6dc) !important;
    background: var(--pg-surface, #fff) !important;
    color: var(--pg-text-primary, #1a242d) !important;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    font-family: inherit;
    box-shadow: none !important;
}
.pg-hub-btn:hover { border-color: var(--pg-blue, #1E4F75) !important; }
.pg-hub-btn--primary,
button.pg-hub-btn--primary {
    background: var(--pg-blue, #1E4F75) !important;
    color: var(--pg-white, #fff) !important;
    border-color: var(--pg-blue, #1E4F75) !important;
}
.pg-hub-btn--primary:hover { background: var(--pg-blue-hover, #163d5a) !important; }
.pg-hub-btn--ghost,
button.pg-hub-btn--ghost {
    background: transparent !important;
    border-color: transparent !important;
    color: var(--pg-text-secondary, #4a5568) !important;
}
.pg-hub-btn--ghost:hover {
    background: rgba(0,0,0,0.04) !important;
    border-color: transparent !important;
}
.pg-hub-btn--sm { padding: 6px 10px !important; font-size: 12px; }
.pg-hub-btn:disabled,
button.pg-hub-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================================
   Save modal (nested)
   ============================================================ */
.pg-hub-modal {
    position: fixed;
    inset: 0;
    z-index: 9400;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 25, 36, 0.5);
    padding: 24px;
}
.pg-hub-modal.is-open { display: flex; }
.pg-hub-modal__card {
    background: var(--pg-surface, #fff);
    border-radius: var(--pg-radius-xl, 14px);
    box-shadow: var(--pg-shadow-modal, 0 20px 60px rgba(0,0,0,0.25));
    width: 100%;
    max-width: 440px;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.pg-hub-modal__head {
    padding: 14px 18px;
    background: var(--pg-blue, #1E4F75);
    color: var(--pg-white, #fff);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.pg-hub-modal__title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--pg-white, #fff);
}
.pg-hub-modal__body {
    padding: 18px;
    overflow-y: auto;
    flex: 1 1 auto;
}
.pg-hub-modal__foot {
    padding: 12px 18px;
    border-top: 1px solid var(--pg-border, #d8dde4);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}
.pg-hub-modal__label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--pg-text-muted, #6b7d8a);
    margin-bottom: 6px;
}
.pg-hub-modal__input {
    width: 100%;
    padding: 10px 12px !important;
    border: 1px solid var(--pg-border-strong, #d0d6dc) !important;
    border-radius: var(--pg-radius-md, 6px) !important;
    font-size: 14px;
    color: var(--pg-text-primary, #1a242d) !important;
    background: var(--pg-surface, #fff) !important;
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
}
.pg-hub-modal__input:focus-visible {
    border-color: var(--pg-blue, #1E4F75) !important;
    box-shadow: var(--pg-focus-ring, 0 0 0 3px rgba(30,79,117,0.15)) !important;
}

/* Visibility radio group inside Share modal */
.pg-hub-vis {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.pg-hub-vis__opt {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1.5px solid var(--pg-border, #d8dde4);
    border-radius: var(--pg-radius-md, 6px);
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
}
.pg-hub-vis__opt:hover { border-color: var(--pg-blue, #1E4F75); }
.pg-hub-vis__opt input { margin: 3px 0 0; }
.pg-hub-vis__opt.is-active {
    border-color: var(--pg-blue, #1E4F75);
    background: rgba(30, 79, 117, 0.04);
}
.pg-hub-vis__opt.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.pg-hub-vis__opt-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--pg-text-primary, #1a242d);
    line-height: 1.2;
}
.pg-hub-vis__opt-desc {
    font-size: 12px;
    color: var(--pg-text-muted, #6b7d8a);
    line-height: 1.4;
    margin-top: 2px;
}

.pg-hub-share__hint {
    font-size: 12.5px;
    color: var(--pg-text-muted, #6b7d8a);
    line-height: 1.45;
    margin: 14px 0 6px;
}
.pg-hub-share__url {
    display: flex;
    gap: 8px;
    margin-top: 0;
}
.pg-hub-share__url input { font-size: 12.5px; }

/* Toast */
.pg-hub-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9500;
    background: rgba(20, 30, 42, 0.95);
    color: #fff;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s, transform 0.18s;
}
.pg-hub-toast.is-on {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* ============================================================
   Mobile / narrow — bottom sheet for rail; library + edit stack
   ============================================================ */
@media (max-width: 900px) {
    #pg-hub-overlay { padding: 0; }
    #pg-hub-dock { border-radius: 0; max-width: none; }
    .pg-hub-body {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
    }
    .pg-hub-zone { border-right: none; border-bottom: 1px solid var(--pg-border, #d8dde4); }
    /* Resizers are desktop-only — no col-resize when the layout stacks. */
    .pg-hub-resizer { display: none; }

    /* Rail collapses to bottom sheet (handle + scrolling list) */
    .pg-hub-zone--rail {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 60vh;
        background: var(--pg-surface, #fff);
        border-top: 1px solid var(--pg-border, #d8dde4);
        box-shadow: 0 -8px 24px rgba(0,0,0,0.1);
        transform: translateY(calc(100% - 48px));
        transition: transform 0.22s ease-out;
        z-index: 10;
        border-bottom: none;
    }
    .pg-hub-zone--rail.is-open { transform: translateY(0); }
    .pg-hub-zone--rail .pg-hub-zone__head {
        cursor: pointer;
        padding: 12px 16px;
        position: relative;
    }
    .pg-hub-zone--rail .pg-hub-zone__head::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: var(--pg-border-strong, #d0d6dc);
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
    }

    /* Library + edit stacked, edit collapses to fixed footer-card */
    .pg-hub-zone--lib { display: flex; }
    .pg-hub-zone--edit {
        max-height: 240px;
    }

    /* Library and edit zones leave space for the rail handle */
    .pg-hub-body { padding-bottom: 48px; }
}

/* ============================================================
   SETLIST PRINT (browser-print path)
   Off-screen <table> shell + sibling fixed-foot. Activated by
   toggling body.pg-hub-setlist-print while window.print() runs.
   Mirrors pg-chord-manager-new.php's #pg-cm-print-shell pattern.
   ============================================================ */
#pg-hub-setlist-print-shell {
    position: absolute;
    left: -10000px;
    top: 0;
    width: 210mm;
    font-family: 'Source Serif 4', Charter, Georgia, serif;
    color: #111;
    line-height: 1.5;
    box-sizing: border-box;
    /* Body content sits between fixed head + foot — page-margin via
       padding on the body class (see @media print rules). */
    padding: 0 12mm;
}
.pg-hub-setlist-print-head-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8mm;
    padding-bottom: 2mm;
    margin-bottom: 4mm;
    border-bottom: 0.5pt solid #999;
}
.pg-hub-setlist-print-title-stack {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1mm;
}
.pg-hub-setlist-print-title {
    font: 600 28pt 'Source Serif 4', Charter, Georgia, serif;
    color: #111;
    line-height: 1.1;
    margin: 0;
}
.pg-hub-setlist-print-title-count {
    font: 400 16pt 'Source Serif 4', Charter, Georgia, serif;
    color: #666;
    margin-left: 0.25em;
    white-space: nowrap;
}
.pg-hub-setlist-print-date {
    font: italic 11pt 'Source Serif 4', Charter, Georgia, serif;
    color: #555;
}
.pg-hub-setlist-print-head-logo {
    flex: 0 0 auto;
    height: 12mm;
    width: auto;
    max-width: 40mm;
}
.pg-hub-setlist-print-notes {
    font: italic 12pt 'Source Serif 4', Charter, Georgia, serif;
    color: #444;
    margin: 0 0 6mm;
}
.pg-hub-setlist-print-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: var(--pg-hub-setlist-fontsize, 22px);
}
.pg-hub-setlist-print-list li {
    padding: 0.25em 0;
    break-inside: avoid;
    page-break-inside: avoid;
    display: flex;
    align-items: baseline;
    gap: 0.5em;
}
.pg-hub-setlist-print-num {
    font-variant-numeric: tabular-nums;
    color: #555;
    flex: 0 0 2.4em;
    text-align: right;
}
/* Title fills the row and stays on a single line. JS shrink-to-fit
   (fitTitlesToWidth) reduces per-title font size when intrinsic
   width exceeds the available column. min-width: 0 defeats the
   flex-min-content default so the layout can give the title less
   than its content width. No text-overflow: ellipsis — we'd rather
   shrink than show "…". */
.pg-hub-setlist-print-song-title {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
}
/* Key pinned right — flex: 0 0 auto so it never shrinks; the title
   takes whatever's left of the row. Aligns all keys in a clean
   right column instead of trailing each title at variable position. */
.pg-hub-setlist-print-list .pg-hub-setlist-print-key {
    color: #888;
    font-weight: 600;
    margin-left: 0.5em;
    flex: 0 0 auto;
}

/* Placeholder line — italic title to mark non-catalog songs. */
.pg-hub-setlist-print-placeholder .pg-hub-setlist-print-song-title {
    font-style: italic;
    color: #444;
}

/* Set-break divider — sits BETWEEN per-set <ol>s (not inside one),
   so `page-break-before: always` reliably triggers (sibling-of-list
   placement avoids Chrome's table-cell page-break suppression). */
.pg-hub-setlist-print-break {
    page-break-before: always;
    break-before: page;
    text-align: center;
    font-size: var(--pg-hub-setlist-fontsize, 22px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #444;
    margin: 0;
    padding: 0.6em 0;
    border-top: 1pt solid #999;
    border-bottom: 1pt solid #999;
}

/* ============================================================
   SONGBOOK PRINT (multi-song chord-chart + lyrics)
   ============================================================ */
#pg-hub-songbook-print-shell {
    position: absolute;
    left: -10000px;
    top: 0;
    width: 8.5in;
    font-family: 'Source Serif 4', Charter, Georgia, serif;
    color: #111;
    box-sizing: border-box;
}
.pg-hub-songbook-cover {
    text-align: center;
    padding: 1.4in 0.6in 0.6in;
    box-sizing: border-box;
}
/* Hero brand stamp (pick over wordmark). */
.pg-hub-songbook-cover__brand {
    width: 70mm;
    max-width: 100%;
    height: auto;
    margin: 0 auto 24mm;
    display: block;
}
.pg-hub-songbook-cover__title {
    font: 700 38pt 'Source Serif 4', Charter, Georgia, serif;
    color: #111;
    line-height: 1.1;
    margin: 0 0 12mm;
}
.pg-hub-songbook-cover__subtitle {
    font: italic 16pt 'Source Serif 4', Charter, Georgia, serif;
    color: #444;
    margin: 0 0 14mm;
}
.pg-hub-songbook-cover__presenter {
    font: 500 14pt 'Source Serif 4', Charter, Georgia, serif;
    color: #333;
    margin: 0 0 6mm;
}
.pg-hub-songbook-cover__date {
    font: italic 12pt 'Source Serif 4', Charter, Georgia, serif;
    color: #666;
    margin: 0 0 30mm;
}

/* Per-song <table>: thead + tbody + tfoot. Browsers auto-repeat
   thead at the top and tfoot at the bottom of every page that this
   table spans, which is exactly what we need for songs that wrap to
   page 2+. Same trick the on-page chord-manager print uses. */
table.pg-hub-songbook-song {
    width: 100%;
    border-collapse: collapse;
    box-sizing: border-box;
    page-break-inside: auto;
    break-inside: auto;
}
table.pg-hub-songbook-song > thead { display: table-header-group; }
table.pg-hub-songbook-song > tfoot { display: table-footer-group; }
table.pg-hub-songbook-song > thead > tr > td { padding: 12mm 12mm 0; vertical-align: top; }
table.pg-hub-songbook-song > tbody > tr > td { padding: 0 12mm 4mm; vertical-align: top; }
table.pg-hub-songbook-song > tfoot > tr > td { padding: 0 12mm 6mm; vertical-align: bottom; }
.pg-hub-songbook-song__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8mm;
    padding-bottom: 2mm;
    margin-bottom: 6mm;
    border-bottom: 0.5pt solid #999;
}
.pg-hub-songbook-song__title {
    font: 600 22pt 'Source Serif 4', Charter, Georgia, serif;
    color: #111;
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
}
.pg-hub-songbook-song__logo {
    height: 9mm;
    width: auto;
    flex-shrink: 0;
    opacity: 0.9;
}
.pg-hub-songbook-song__missing {
    font-style: italic;
    color: #999;
}
.pg-hub-songbook-song__foot {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 8mm;
    padding-top: 3mm;
    border-top: 0.5pt solid #999;
    font: italic 8.5pt 'Source Serif 4', Charter, Georgia, serif;
    color: #555;
}
.pg-hub-songbook-song__foot-meta { line-height: 1.45; }
.pg-hub-songbook-song__foot-meta div + div { margin-top: 0.5mm; }
.pg-hub-songbook-song__foot-right {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1mm;
}
.pg-hub-songbook-song__foot-host { flex-shrink: 0; }
.pg-hub-songbook-song__foot-page {
    font: 600 11pt 'Source Serif 4', Charter, Georgia, serif;
    font-style: normal;
    color: #222;
    line-height: 1;
}

/* ---- Table of contents page ----
   Lives between cover and first song, on its own page. Single-column
   listing of song titles with page numbers right-aligned, tied
   together by dot leaders. Multi-page TOC overflows naturally — the
   <ol> just continues onto a second sheet. */
.pg-hub-songbook-toc {
    padding: 1.1in 0.9in 0.6in;
    box-sizing: border-box;
    page-break-after: always;
    break-after: page;
}
.pg-hub-songbook-toc__title {
    font: 600 24pt 'Source Serif 4', Charter, Georgia, serif;
    color: #111;
    text-align: center;
    margin: 0 0 14mm;
    letter-spacing: 0.02em;
}
.pg-hub-songbook-toc__list {
    list-style: none;
    counter-reset: pg-hub-toc;
    margin: 0;
    padding: 0;
    font: 500 13pt 'Source Serif 4', Charter, Georgia, serif;
    color: #222;
}
.pg-hub-songbook-toc__item {
    counter-increment: pg-hub-toc;
    display: flex;
    align-items: baseline;
    gap: 4mm;
    padding: 1.6mm 0;
}
.pg-hub-songbook-toc__item::before {
    content: counter(pg-hub-toc) ".";
    font-variant-numeric: tabular-nums;
    color: #777;
    flex-shrink: 0;
    min-width: 9mm;
}
.pg-hub-songbook-toc__title-cell {
    flex-shrink: 0;
}
.pg-hub-songbook-toc__leader {
    flex: 1 1 auto;
    border-bottom: 0.6pt dotted #999;
    transform: translateY(-3pt);
    margin: 0 2mm;
    min-width: 6mm;
}
.pg-hub-songbook-toc__page {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    color: #222;
    min-width: 8mm;
    text-align: right;
}

/* ---- Songbook lyrics body (vocal pages) ----
   pg_cm_new_render_sections produces HTML with these classes:
   .chorus-indent, .pg-chord-inline, .pg-chord-above (with chord-row +
   lyric-row siblings), .pg-chord-provisional. Chord-manager.css styles
   them on song pages, but it isn't loaded on hub print so we restate
   the rules we need here, scoped to body.pg-hub-songbook-print.

   Font size is driven by --pg-hub-songbook-fontsize, set either at
   body level (modal's font-size input) or on a single <table>
   (per-song shrink when content overflows one page). 22px default
   fallback matches the modal default.

   !important is load-bearing: chord-manager.php's injected style
   block sets font-size with !important on the same selectors
   (e.g. `.pg-cm-pane-lyrics #chords-display.mode-inline { font-size:
   15px !important }`). Without our own !important, the var is
   overridden silently — the table's --pg-hub-songbook-fontsize has
   no rendered effect, so the JS shrink-to-fit loop's measurements
   never change and per-song shrink becomes a no-op. */
body.pg-hub-songbook-print #chords-display {
    font-family: 'Source Serif 4', Charter, Georgia, serif;
    font-size: var(--pg-hub-songbook-fontsize, 22px) !important;
    line-height: 1.55;
    color: #111;
}
body.pg-hub-songbook-print #chords-display.mode-inline {
    font-size: var(--pg-hub-songbook-fontsize, 22px) !important;
}
body.pg-hub-songbook-print .pg-cm-pane-chart .pg-cm-chart {
    font-size: var(--pg-hub-songbook-fontsize, 22px) !important;
}
body.pg-hub-songbook-print #chords-display p {
    margin: 0 0 0.5em;
}
body.pg-hub-songbook-print #chords-display p.chorus-indent {
    margin-left: 2em;
    color: #333;
}
body.pg-hub-songbook-print .pg-chord-inline {
    color: #1E4F75;
    font-weight: 600;
    font-family: 'Fira Mono', 'Courier New', monospace;
    font-size: 0.92em;
    margin: 0 0.05em;
}
/* Bracket pseudo-elements — chord-manager.php's CSS adds these on song
   pages; we restate them here so vocal-only songbooks (which skip the
   chord-manager entirely) still get visible [G] / [Am] brackets. */
body.pg-hub-songbook-print .pg-chord-inline::before {
    content: '[';
    color: rgba(30, 79, 117, 0.45);
    font-weight: 500;
}
body.pg-hub-songbook-print .pg-chord-inline::after {
    content: ']';
    color: rgba(30, 79, 117, 0.45);
    font-weight: 500;
}
body.pg-hub-songbook-print .pg-chord-above {
    color: #1E4F75;
    font-weight: 600;
    font-family: 'Fira Mono', 'Courier New', monospace;
    font-size: 0.92em;
}
body.pg-hub-songbook-print .pg-chord-provisional { color: #888; }
body.pg-hub-songbook-print .chord-row {
    font-family: 'Fira Mono', 'Courier New', monospace;
    color: #1E4F75;
    line-height: 1.2;
    margin-bottom: 1px;
    white-space: pre-wrap;
}
body.pg-hub-songbook-print .lyric-row {
    line-height: 1.45;
    margin-bottom: 4px;
}

@media print {
    html:has(body.pg-hub-songbook-print),
    body.pg-hub-songbook-print {
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    body.pg-hub-songbook-print {
        background: #fff !important;
        color: #111 !important;
    }
    body.pg-hub-songbook-print #wpadminbar { display: none !important; }
    body.pg-hub-songbook-print > *:not(#pg-hub-songbook-print-shell) {
        display: none !important;
    }
    body.pg-hub-songbook-print #pg-hub-songbook-print-shell {
        position: static !important;
        left: auto !important;
        top: auto !important;
        display: block !important;
        margin: 0 !important;
        width: auto !important;
    }
    /* Each song-table starts on its own page (after the cover or after
       the previous song). thead + tfoot auto-repeat on page wrap. */
    body.pg-hub-songbook-print table.pg-hub-songbook-song--break {
        page-break-before: always;
        break-before: page;
    }
    body.pg-hub-songbook-print .pg-hub-songbook-cover {
        page-break-after: always;
        break-after: page;
    }
    /* Pin the per-song <tfoot> to the bottom of the page. Push the
       table to nearly the full Letter portrait height so the tfoot is
       hugged to the bottom edge. 10.85in leaves ~4mm of safety against
       print-render drift. Combined with the trimmed tfoot td bottom
       padding (6mm), the meta line sits within ~10mm of the page edge.

       Stretch the tbody row to absorb the table's extra height. macOS
       Chromium / Safari redistribute a table's min-height surplus into
       the tbody row implicitly, so the tfoot pins to the page bottom.
       Windows Chrome/Edge don't redistribute reliably — they size the
       tbody to its content and let the tfoot float right after, leaving
       a visible gap before the page bottom. Explicit height:100% on
       the tbody row + cell forces the stretch on every browser. */
    body.pg-hub-songbook-print table.pg-hub-songbook-song {
        min-height: 10.85in;
    }
    body.pg-hub-songbook-print table.pg-hub-songbook-song > tbody,
    body.pg-hub-songbook-print table.pg-hub-songbook-song > tbody > tr,
    body.pg-hub-songbook-print table.pg-hub-songbook-song > tbody > tr > td {
        height: 100%;
    }
    /* Reveal the cloned panes — chord-manager hides them by default. */
    body.pg-hub-songbook-print .pg-cm-pane {
        display: block !important;
    }
    /* Hide chord-manager's own ribbon / popovers / audio panel that
       came along with the per-post HTML — we only kept the inner pane
       in the shell, but defensive in case stragglers leak in. */
    body.pg-hub-songbook-print .pg-cm-ribbon,
    body.pg-hub-songbook-print .pg-cm-pop,
    body.pg-hub-songbook-print .pg-cm-pane-side,
    body.pg-hub-songbook-print .pg-cm-arr-section {
        display: none !important;
    }
}

@media print {
    /* When setlist print is active, lock html + body to natural content
       height — without these resets, theme/admin-bar styles can leak a
       min-height: 100% (or similar) and force a phantom blank second
       page after the shell. */
    html:has(body.pg-hub-setlist-print),
    body.pg-hub-setlist-print {
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
    }
    body.pg-hub-setlist-print {
        background: #fff !important;
        color: #111 !important;
        /* Reserve space at top + bottom for the position:fixed running
           header + footer (which repeat per page). 30mm top clears the
           ~14mm head + a divider; 18mm bottom clears the foot. */
        padding: 30mm 0 18mm !important;
    }
    body.pg-hub-setlist-print #wpadminbar { display: none !important; }
    /* Hide every other body child while the setlist shell + sibling
       fixed head/foot print. */
    body.pg-hub-setlist-print > *:not(#pg-hub-setlist-print-shell):not(.pg-hub-setlist-print-fixed-head):not(.pg-hub-setlist-print-fixed-foot) {
        display: none !important;
    }
    body.pg-hub-setlist-print #pg-hub-setlist-print-shell {
        position: static !important;
        left: auto !important;
        top: auto !important;
        display: block !important;
        margin: 0 !important;
    }
    body.pg-hub-setlist-print .pg-hub-setlist-print-fixed-head,
    body.pg-hub-setlist-print .pg-hub-setlist-print-fixed-foot {
        margin: 0 !important;
    }
    /* Running header — pinned at top:6mm of every printed page. */
    .pg-hub-setlist-print-fixed-head {
        position: fixed;
        top: 6mm;
        left: 12mm;
        right: 12mm;
        background: #fff;
        z-index: 10;
    }
    .pg-hub-setlist-print-fixed-foot {
        position: fixed;
        bottom: 6mm;
        left: 12mm;
        right: 12mm;
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        font: italic 8.5pt 'Source Serif 4', Charter, Georgia, serif;
        color: #555;
        border-top: 0.5pt solid #999;
        padding-top: 3mm;
        background: #fff;
        z-index: 10;
    }
}
