/* ========================================
   BLOCK 2: Page-Specific CSS (pvi-admin-dashboard)
   (this page only — extracted to pvi-admin-dashboard.css at deploy)
   ======================================== */
    .pvi-admin-dashboard {
        max-width: 1320px;
        margin: 0 auto;
        padding: 1.5rem 1.5rem 3rem;
    }

    /* ----- Top action bar ---------------------------------------------- */
    .dashboard-topbar {
        background: var(--white);
        border: 1px solid var(--light-grey);
        border-radius: 8px;
        margin-bottom: 1.5rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
    }
    .dashboard-topbar-inner {
        display: flex; align-items: center; justify-content: space-between;
        gap: 1rem;
        padding: .65rem 1rem;
        flex-wrap: wrap;
    }

    /* ----- Tab strip --------------------------------------------------- */
    .pv-tabs {
        display: flex; flex-wrap: wrap; gap: .3rem;
        flex: 1 1 auto; min-width: 0;
    }
    .pv-tab {
        display: inline-flex; align-items: center; gap: .45rem;
        padding: .6rem 1rem;
        font-size: .92rem; font-weight: 500;
        color: var(--dark-grey);
        background: transparent;
        border: 1px solid transparent;
        border-radius: 6px;
        text-decoration: none;
        white-space: nowrap;
        transition: background .15s, color .15s, border-color .15s;
    }
    .pv-tab i { color: var(--mid-grey); }
    .pv-tab:hover {
        background: var(--surface);
        color: var(--dark-grey);
        text-decoration: none;
    }
    .pv-tab:hover i { color: var(--dull-blue); }
    .pv-tab.active {
        background: var(--dark-grey);
        color: var(--white);
        border-color: var(--dark-grey);
    }
    .pv-tab.active:hover { background: var(--dark-grey); color: var(--white); }
    .pv-tab.active i { color: var(--white); }

    /* Tab-strip dropdown (Manage Users) — the toggle is a .pv-tab, the menu
       reuses the Bootstrap dropdown the user-menu already relies on. */
    .pv-tab-dropdown { display: inline-flex; }
    .pv-tab.dropdown-toggle { cursor: pointer; }
    .pv-tab.dropdown-toggle::after { margin-left: .15rem; vertical-align: .15em; }
    .pv-tab-dropdown.show .pv-tab.dropdown-toggle {
        background: var(--surface);
        color: var(--dark-grey);
    }
    .pv-tab-dropdown.show .pv-tab.dropdown-toggle i { color: var(--dull-blue); }
    .pv-tab-menu { min-width: 190px; }
    .pv-tab-menu .dropdown-item {
        display: flex; align-items: center; gap: .5rem;
        font-size: .9rem;
        color: var(--dark-grey);
    }
    .pv-tab-menu .dropdown-item i { width: 1rem; text-align: center; color: var(--mid-grey); }
    .pv-tab-menu .dropdown-item:hover,
    .pv-tab-menu .dropdown-item:focus {
        background: var(--surface);
        color: var(--dark-grey);
    }
    .pv-tab-menu .dropdown-item:hover i,
    .pv-tab-menu .dropdown-item:focus i { color: var(--dull-blue); }

    /* ----- Flyouts (Reports + User menu ▸ Preferences) ------------------ */
    /* Selectors are scoped to .dropdown-menu (not .pv-tab-menu) so the same
       flyout machinery serves both the Reports tab and the user menu's
       Preferences item. Flyouts inside a right-aligned menu
       (.dropdown-menu-end) open to the LEFT — see the block after this one.

       The Reports tab is a Bootstrap dropdown (like Manage Users). Three of
       its items own a flyout selection panel; the flyout is NOT a Bootstrap
       construct — it is a custom panel shown by the .open class, per the
       CLAUDE.md ::before-arrow / .open convention. The parent <li> keeps
       position:relative so the panel anchors to it.

       Open/close is owned entirely by the page JS (.open toggled with
       hover-intent timers + click-to-pin). CSS deliberately does NOT open the
       panel on :hover — see the note above .pv-submenu::before below. */
    .dropdown-menu .pv-has-submenu { position: relative; }

    /* Submenu parent row: looks like a dropdown-item, plus a right chevron. */
    .dropdown-menu .pv-submenu-label {
        justify-content: space-between;
        cursor: pointer;
    }
    .dropdown-menu .pv-submenu-label-text {
        display: inline-flex; align-items: center; gap: .5rem;
    }
    .dropdown-menu .pv-submenu-label::after {
        content: ""; flex: 0 0 auto;
        width: .45rem; height: .45rem; margin-left: .9rem;
        border-right: 2px solid var(--mid-grey);
        border-top: 2px solid var(--mid-grey);
        transform: rotate(45deg);                 /* points right */
        transition: transform .15s, border-color .15s;
    }
    .dropdown-menu .pv-has-submenu.open > .pv-submenu-label::after,
    .dropdown-menu .pv-submenu-label:hover::after { border-color: var(--dull-blue); }

    /* The flyout panel itself. */
    .dropdown-menu .pv-submenu {
        display: none;
        position: absolute; top: -.5rem; left: 100%;
        z-index: 1001;                            /* above the dropdown-menu */
        min-width: 340px;
        padding: .85rem 1rem 1rem;
        background: var(--white);
        border: 1px solid var(--light-grey);
        border-radius: 8px;
        box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
    }
    .dropdown-menu .pv-has-submenu.open > .pv-submenu { display: block; }

    /* Why there is no `:hover > .pv-submenu { display: block }` rule here.
       A bare :hover rule tore the panel down the instant the pointer left the
       row — including when a native <select> popup pulled the pointer off the
       panel mid-selection — which is why the flyout took two or three tries
       to hold long enough to reach the View Report button. Hover is now
       handled in JS with an open delay, a generous close grace period, and a
       pinned state, all expressed through the same .open class. */

    /* Invisible hover bridge. The panel sits flush against the right edge of
       the menu, so a diagonal pointer path from the label down into the panel
       used to cross dead space and drop the hover. This strip extends the
       panel's own hover area back over the menu edge so that travel stays
       inside the panel. Kept narrow so it does not swallow clicks on the
       sibling menu rows underneath it. */
    .dropdown-menu .pv-submenu::before {
        content: "";
        position: absolute;
        top: 0; bottom: 0;
        left: -14px; width: 14px;
        background: transparent;
    }

    /* Pinned = clicked open. A pinned panel ignores pointer-leave entirely; it
       closes only on a second click of its label, Escape, a click outside, or
       the Reports menu closing. The label keeps the hover fill so it is
       obvious which row owns the open panel. */
    .dropdown-menu .pv-has-submenu.is-pinned > .pv-submenu-label {
        background: var(--surface);
        color: var(--dark-grey);
    }
    .dropdown-menu .pv-has-submenu.is-pinned > .pv-submenu-label i { color: var(--dull-blue); }
    .dropdown-menu .pv-has-submenu.is-pinned > .pv-submenu-label::after { border-color: var(--dull-blue); }

    /* Selection form inside a flyout. */
    .pv-report-form .pv-report-title,
    .pv-submenu .pv-report-title {
        margin: 0 0 .75rem;
        font-size: .95rem; font-weight: 600; color: var(--dark-grey);
    }
    .pv-report-pending {
        margin: 0; font-size: .85rem; color: var(--mid-grey); font-style: italic;
    }
    .pv-report-row {
        display: flex; align-items: center; flex-wrap: wrap; gap: .4rem;
        margin-bottom: .6rem;
    }
    .pv-report-row:last-of-type { margin-bottom: .25rem; }
    .pv-report-label {
        flex: 0 0 100%;
        font-size: .82rem; font-weight: 500; color: var(--mid-grey);
        margin-bottom: .1rem;
    }
    .pv-report-form .form-select-sm { font-size: .85rem; }
    .pv-report-row .pv-date-part { flex: 1 1 0; min-width: 0; }
    .pv-report-row .pv-report-single { flex: 1 1 100%; }
    .pv-report-actions { display: flex; justify-content: flex-end; margin-top: .25rem; }

    /* ----- Left-opening flyouts (right-aligned menus) ------------------- */
    /* The user menu is .dropdown-menu-end, flush to the page's right edge, so
       its flyouts open to the LEFT. The chevron moves to the start of the row
       and points left; the hover bridge moves to the panel's right edge. */
    .dropdown-menu-end .pv-submenu-label {
        display: flex; align-items: center;
        justify-content: flex-start;
    }
    .dropdown-menu-end .pv-submenu-label::after {
        order: -1;                                /* chevron before the text */
        margin-left: 0; margin-right: .6rem;
        transform: rotate(-135deg);               /* points left */
    }
    .dropdown-menu-end .pv-submenu {
        left: auto; right: 100%;
        min-width: 270px;
    }
    .dropdown-menu-end .pv-submenu::before {
        left: auto; right: -14px;
    }

    /* Preferences flyout content (user menu). */
    .pv-pref-check { margin-bottom: .75rem; }
    .pv-pref-check .form-check-label {
        font-size: .9rem;
        color: var(--dark-grey);
        white-space: nowrap;
    }
    .pv-pref-check .form-check-input:checked {
        background-color: var(--dull-blue);
        border-color: var(--dull-blue);
    }
    .pv-pref-check .form-check-input:focus {
        border-color: var(--dull-blue);
        box-shadow: 0 0 0 .2rem var(--focus-ring-blue);
    }

    /* Narrow screens: the topbar wraps, so the flyout drops inline under its
       parent instead of flying out sideways (which would overflow). */
    @media (max-width: 575.98px) {
        .dropdown-menu .pv-submenu {
            position: static; top: auto; left: auto; right: auto;
            min-width: 0; margin: .25rem 0 .5rem;
            box-shadow: none;
        }
        .pv-pref-check .form-check-label { white-space: normal; }
        /* Inline panel needs no travel bridge, and a static panel would
           anchor the bridge to the <li> instead — drop it. */
        .dropdown-menu .pv-submenu::before { display: none; }
    }

    /* ----- User menu --------------------------------------------------- */
    .user-menu .dropdown-toggle {
        color: var(--dark-grey);
        text-decoration: none;
        padding: .4rem .75rem;
        font-weight: 500;
    }
    .user-menu .dropdown-toggle:focus,
    .user-menu .dropdown-toggle:hover { color: var(--dull-blue); }
    .user-menu .dropdown-toggle i { margin-right: .4rem; color: var(--mid-grey); }
    .user-menu .user-name { font-weight: 500; }
    .user-menu .dropdown-menu { min-width: 180px; }

    /* ----- Main panel & content sections ------------------------------- */
    .content-section { display: none; }
    .content-section.active { display: block; }

    /* ----- Stat cards (Bootstrap-extended) ----------------------------- */
    .stat-card {
        border: 1px solid var(--light-grey);
        border-radius: 10px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
        height: 100%;
    }
    .stat-card .card-body { padding: 1.2rem 1.3rem; }
    .stat-icon {
        display: inline-flex; align-items: center; justify-content: center;
        width: 52px; height: 52px;
        border-radius: 10px;
        color: var(--white);
        font-size: 1.35rem;
        flex-shrink: 0;
    }
    .stat-number {
        font-size: 1.7rem; font-weight: 700; line-height: 1.1;
        color: var(--dark-grey);
    }
    .stat-label {
        margin-top: .15rem;
        font-size: .82rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: var(--mid-grey);
    }

    /* ----- Recent Activity --------------------------------------------- */
    .activity-item {
        display: flex; align-items: center; justify-content: space-between;
        gap: .75rem;
        padding: .85rem 1rem;
        border-radius: 6px;
        margin-bottom: .6rem;
    }
    .activity-item:last-child { margin-bottom: 0; }
    .activity-item-blue {
        background: rgba(91, 192, 222, .08);
        border-left: 3px solid var(--dull-blue);
    }
    .activity-item-green {
        background: rgba(92, 184, 92, .08);
        border-left: 3px solid var(--green);
    }
    .activity-item-info {
        background: rgba(91, 192, 222, .08);
        border-left: 3px solid var(--dull-blue);
    }

    /* ----- Dashboard upload shortcut card ------------------------------ */
    .dash-upload-cta { height: 100%; }
    .dash-upload-cta .cta-icon { color: var(--dull-blue); }

    /* ----- Folder Upload ----------------------------------------------- */
    /* Optional metadata fields above the dropzone */
    .batch-label {
        display: block;
        margin-bottom: .25rem;
        font-size: .8rem;
        font-weight: 600;
        color: var(--dark-grey);
    }
    .batch-opt {
        font-weight: 400;
        font-size: .72rem;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: var(--mid-grey);
    }
    .batch-input { margin-bottom: 1rem; }
    .batch-input:focus {
        border-color: var(--dull-blue);
        box-shadow: 0 0 0 .2rem var(--focus-ring-blue);
    }

    .upload-area {
        padding: 2rem 1rem;
        text-align: center;
        border: 2px dashed var(--light-grey);
        border-radius: 8px;
        color: var(--mid-grey);
        cursor: pointer;
        background: var(--surface);
        transition: background .15s, border-color .15s, color .15s;
    }
    .upload-area:hover,
    .upload-area:focus-visible,
    .upload-area.drag-over {
        background: rgba(91, 192, 222, .06);
        border-color: var(--dull-blue);
        color: var(--dark-grey);
        outline: none;
    }
    .upload-area:focus-visible { box-shadow: 0 0 0 .2rem var(--focus-ring-blue); }
    .upload-area i {
        color: var(--dull-blue);
        margin-bottom: .5rem;
    }
    .upload-area:hover i,
    .upload-area.drag-over i { color: var(--dull-blue); }

    /* Selected-files summary */
    .upload-filelist {
        margin-top: .85rem;
        padding: .65rem .75rem;
        background: var(--white);
        border: 1px solid var(--light-grey);
        border-radius: 6px;
        font-size: .82rem;
        color: var(--dark-grey);
    }
    .upload-filelist .filelist-head {
        font-weight: 600;
        margin-bottom: .4rem;
    }
    .upload-filelist ul {
        list-style: none;
        margin: 0;
        padding: 0;
        max-height: 9.5rem;
        overflow-y: auto;
    }
    .upload-filelist li {
        display: flex;
        justify-content: space-between;
        gap: .5rem;
        padding: .2rem 0;
        border-top: 1px solid var(--rule);
        color: var(--mid-grey);
    }
    .upload-filelist li:first-child { border-top: 0; }
    .upload-filelist .file-folder { color: var(--dark-grey); font-weight: 500; }
    .upload-filelist .file-count { white-space: nowrap; }

    /* Skipped (filtered-out) files notice — amber, advisory */
    .upload-skipped {
        margin-top: .75rem;
        padding: .55rem .75rem;
        background: var(--amber-warn-bg);
        border: 1px solid var(--amber-warn);
        border-radius: 6px;
        font-size: .8rem;
        color: var(--amber-warn-text);
    }
    .upload-skipped .skipped-head { font-weight: 600; }

    /* ----- Active-key banner ------------------------------------------- */
    /* Shown when the engine reports no active / expired key. Keys are
       created in the Encryption Keys area — never on this panel. */
    .key-banner {
        margin-bottom: 1rem;
        padding: .65rem .8rem;
        border-radius: 6px;
        font-size: .82rem;
        line-height: 1.4;
    }
    .key-banner .key-banner-head { font-weight: 600; display: block; margin-bottom: .15rem; }
    .key-banner.is-missing,
    .key-banner.is-expired {
        background: var(--amber-warn-bg);
        border: 1px solid var(--amber-warn);
        color: var(--amber-warn-text);
    }
    .key-banner.is-active {
        background: rgba(92, 184, 92, .10);
        border: 1px solid var(--green);
        color: var(--dark-grey);
    }

    /* ----- Live upload progress bar (bytes sent) ----------------------- */
    .upload-progress { margin-top: .85rem; }
    .upload-progress-head {
        display: flex; align-items: center; justify-content: space-between;
        font-size: .8rem; font-weight: 600;
        color: var(--dark-grey);
        margin-bottom: .3rem;
    }
    .upload-progress-text { color: var(--dull-blue); }
    .upload-progress-track {
        height: 10px;
        background: var(--surface);
        border: 1px solid var(--light-grey);
        border-radius: 6px;
        overflow: hidden;
    }
    .upload-progress-bar {
        height: 100%;
        width: 0;
        background: var(--dull-blue);
        border-radius: 6px 0 0 6px;
        transition: width .15s linear;
    }
    .upload-progress.is-done .upload-progress-bar { background: var(--green); }
    .upload-progress.is-done .upload-progress-text { color: var(--green); }

    /* Status / error slot */
    .upload-status {
        margin-top: .75rem;
        padding: .55rem .75rem;
        border-radius: 6px;
        font-size: .82rem;
    }
    .upload-status.is-working {
        background: rgba(91, 192, 222, .08);
        border: 1px solid var(--dull-blue);
        color: var(--dark-grey);
    }
    .upload-status.is-error {
        background: var(--dull-red-bg);
        border: 1px solid var(--dull-red);
        color: var(--dull-red);
    }
    .upload-status.is-success {
        background: rgba(92, 184, 92, .10);
        border: 1px solid var(--green);
        color: var(--dark-grey);
    }

    /* ----- In-panel upload result (created + rejected) ----------------- */
    /* Replaces the standalone /encrypt/ batch-summary page. */
    .upload-result {
        margin-top: .9rem;
        padding: .7rem .8rem;
        background: var(--white);
        border: 1px solid var(--light-grey);
        border-radius: 6px;
        font-size: .82rem;
    }
    .upload-result .result-head {
        font-weight: 600;
        color: var(--dark-grey);
        margin-bottom: .45rem;
    }
    .upload-result ul { list-style: none; margin: 0 0 .25rem; padding: 0; }
    .upload-result li {
        display: flex; justify-content: space-between; gap: .5rem;
        padding: .2rem 0;
        border-top: 1px solid var(--rule);
    }
    .upload-result li:first-child { border-top: 0; }
    .upload-result .result-created li { color: var(--dark-grey); }
    .upload-result .result-created .ok-mark { color: var(--green); }
    .upload-result .result-rejected {
        margin-top: .5rem;
        padding-top: .5rem;
        border-top: 1px dashed var(--light-grey);
    }
    .upload-result .result-rejected .rej-head { color: var(--amber-warn-text); font-weight: 600; }
    .upload-result .result-rejected li { color: var(--mid-grey); }
    .upload-result .result-rejected .rej-reason { color: var(--amber-warn-text); white-space: nowrap; }

    /* Upload button — primary green, matches save-button convention */
    .btn-upload-go {
        color: var(--white);
        background: var(--green);
        border: 1px solid var(--green);
    }
    .btn-upload-go:hover {
        color: var(--white);
        background: var(--green-hover);
        border-color: var(--green-hover);
    }
    .btn-upload-go:focus-visible {
        box-shadow: 0 0 0 .2rem var(--focus-ring-blue);
        outline: none;
    }
    .btn-upload-go:disabled {
        background: var(--mid-grey);
        border-color: var(--mid-grey);
        opacity: .55;
        cursor: not-allowed;
    }

    /* ----- Your Jobs panel --------------------------------------------- */
    .jobs-state {
        padding: 1.4rem .5rem;
        text-align: center;
        font-size: .9rem;
        color: var(--mid-grey);
    }
    .jobs-state-warn { color: var(--amber-warn-text); }

    .jobs-table-wrap { overflow-x: auto; }
    .jobs-table {
        width: 100%;
        border-collapse: collapse;
        font-size: .85rem;
    }
    .jobs-table th, .jobs-table td {
        padding: .6rem .65rem;
        text-align: left;
        vertical-align: middle;
        border-bottom: 1px solid var(--rule);
    }
    .jobs-table thead th {
        font-size: .72rem;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: var(--mid-grey);
        border-bottom: 1px solid var(--light-grey);
        white-space: nowrap;
    }
    .jobs-table th.num, .jobs-table td.num { text-align: right; }
    .jobs-table tbody tr:hover { background: var(--surface); }
    .jobs-table .job-name { font-weight: 600; color: var(--dark-grey); }
    .jobs-table .progress-col { width: 30%; min-width: 150px; }

    /* Status + key-state badges */
    .job-badge {
        display: inline-flex; align-items: center; gap: .3rem;
        padding: .15rem .5rem;
        border-radius: 999px;
        font-size: .72rem;
        font-weight: 600;
        white-space: nowrap;
    }
    .job-badge.is-complete  { background: rgba(92, 184, 92, .14);  color: var(--green-hover); }
    .job-badge.is-processing{ background: rgba(91, 192, 222, .16); color: var(--dark-grey); }
    .job-badge.is-queue     { background: var(--surface);          color: var(--mid-grey); }
    .job-badge.is-error,
    .job-badge.is-keyexpired { background: var(--dull-red-bg);      color: var(--dull-red); }
    .job-badge.is-keymissing { background: var(--amber-warn-bg);    color: var(--amber-warn-text); }
    .job-keynote { margin-left: .35rem; }

    /* Per-row progress: "X / N done" + mini bar */
    .job-progress { display: flex; flex-direction: column; gap: .25rem; }
    .job-progress-text { font-size: .76rem; color: var(--mid-grey); }
    .job-progress-track {
        height: 7px;
        background: var(--surface);
        border: 1px solid var(--light-grey);
        border-radius: 5px;
        overflow: hidden;
    }
    .job-progress-bar {
        height: 100%;
        width: 0;
        background: var(--dull-blue);
        transition: width .3s linear;
    }
    .job-progress-bar.is-complete { background: var(--green); }

    /* ----- Card chrome harmonized to PVI palette ----------------------- */
    .card { border-color: var(--light-grey); border-radius: 10px; }
    .card-header {
        background: var(--white);
        border-bottom: 1px solid var(--rule);
        padding: .9rem 1.25rem;
    }
    .card-header .card-title { color: var(--dark-grey); font-weight: 600; font-size: 1.05rem; }

    /* ----- Time-range button group ------------------------------------- */
    .btn-group .btn-outline-primary {
        color: var(--dull-blue);
        border-color: var(--dull-blue);
        background: var(--white);
    }
    .btn-group .btn-outline-primary:hover {
        color: var(--white);
        background: var(--dull-blue);
        border-color: var(--dull-blue);
    }
    .btn-group .btn-primary {
        color: var(--white);
        background: var(--dark-grey);
        border-color: var(--dark-grey);
    }
    .btn-group .btn-primary:hover {
        background: var(--dark-grey);
        border-color: var(--dark-grey);
    }

    /* Standalone outline-primary (Your Jobs Refresh) matches the group */
    .btn-outline-primary {
        color: var(--dull-blue);
        border-color: var(--dull-blue);
        background: var(--white);
    }
    .btn-outline-primary:hover {
        color: var(--white);
        background: var(--dull-blue);
        border-color: var(--dull-blue);
    }

    /* ----- Responsive -------------------------------------------------- */
    @media (max-width: 992px) {
        .dashboard-topbar-inner { gap: .5rem; padding: .55rem .7rem; }
        .pv-tab { padding: .5rem .8rem; font-size: .88rem; }
    }
    @media (max-width: 720px) {
        .pvi-admin-dashboard { padding: 1rem .85rem 2.5rem; }
        .pv-tab i { display: none; }
        .jobs-table th.num, .jobs-table td.num { text-align: left; }
    }

    @media (prefers-reduced-motion: reduce) {
        .upload-area { transition: none; }
        .upload-progress-bar,
        .job-progress-bar { transition: none; }
    }

    /* ----- View Gallery panel (under Your Jobs) ----------------------- */
    .gallery-panel { margin-top: 1.5rem; }
    .gallery-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
    .gallery-table th, .gallery-table td {
        padding: .55rem .6rem; text-align: left; vertical-align: middle;
        border-bottom: 1px solid var(--rule);
    }
    .gallery-table thead th {
        font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
        color: var(--mid-grey); font-weight: 600;
        border-bottom: 1px solid var(--light-grey);
    }
    .gallery-table tbody tr:last-child td { border-bottom: 0; }
    .gallery-table tbody tr:hover { background: var(--surface); }
    .gallery-table .gal-job { font-weight: 600; color: var(--dark-grey); }
    .gal-link {
        display: inline-flex; align-items: center; gap: .35rem;
        color: var(--dull-blue); text-decoration: none; font-weight: 500;
    }
    .gal-link:hover { text-decoration: underline; }
    .gal-link i { font-size: .85em; }

    /* ----- Full-width gallery view section ---------------------------- */
    #gallery .gallery-view { width: 100%; }
    .gallery-view-bar {
        display: flex; align-items: center; gap: 1rem;
        margin-bottom: 1.25rem; flex-wrap: wrap;
    }
    .gallery-view-title { margin: 0; font-weight: 600; color: var(--dark-grey); }
    .gallery-view-kind {
        display: inline-block; margin-left: .5rem;
        padding: .15rem .55rem; border-radius: 999px;
        font-size: .72rem; font-weight: 600;
        text-transform: uppercase; letter-spacing: .04em;
        background: rgba(91, 192, 222, .16); color: var(--dark-grey);
    }
    .gallery-view-kind.kind-analytical { background: var(--amber-warn-bg); color: var(--amber-warn-text); }
    .gallery-view-kind.kind-original   { background: var(--surface);       color: var(--mid-grey); }
    .gallery-count { color: var(--mid-grey); font-size: .85rem; margin-left: auto; }
    .gallery-grid {
        display: grid; gap: 1rem;
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    }
    .gallery-thumb {
        border: 1px solid var(--light-grey); border-radius: 8px; overflow: hidden;
        background: var(--white); box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
    }
    .gallery-thumb img { display: block; width: 100%; height: auto; background: var(--surface); }
    .gallery-thumb-cap {
        padding: .4rem .6rem; font-size: .78rem; color: var(--mid-grey);
        border-top: 1px solid var(--rule);
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
