/* ============================================================================
   Evidence packs (FD) — standalone fire-door install evidence + packs.
   Paired with app/Views/fire_doors/evidence_packs.php + install_show.php +
   the _evidence_pack_create_modal / _install_edit_modal / _install_delete_modal
   partials + FireDoorInstallController.

   This page is built ENTIRELY from existing primitives:
     • ipi-* page header / stats / tabs / filter rail+drawer / table  → inspections_shell.css
     • card / card--surface / section-heading / file-upload-card / badge--* → style.css
     • mj-filter-actions / mj-search-btn / mj-empty-state               → fire-doors.css
   The rules below are (a) the table card-ification at 900px — a verbatim copy of
   the My Jobs block re-scoped to this page; (b) the install capture layer — a
   verbatim copy of the jobs.css fd-job-* values (otherwise scoped to
   [data-fire-door-job-modal]) re-scoped to this full page; and (c) the Phase 4
   L3 capture workspace — a desktop two-column layout + an opt-in ≤1024px touch
   stepper (ep-cap-*), built from the page's own tokens/primitives in the same
   light treatment as the inspection capture stepper. Nothing new is invented.
   ========================================================================== */

/* ── Index: pack cell ─────────────────────────────────────────────────── */
.evidence-packs-page .ep-pack-link {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid rgba(196, 149, 16, 0.3);
}
.evidence-packs-page .ep-pack-link:hover {
    border-bottom-color: var(--accent);
}
.evidence-packs-page .ep-pack-none {
    color: var(--ink-4);
    font-size: 13px;
}

/* L2: pack cell stacks the download/state + the capture-progress sub-line. */
.evidence-packs-page .ep-pack-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
}
.evidence-packs-page .ep-pack-sub {
    font-size: 11.5px;
}

/* Whole-row click affordance (L1 properties + L2 doors). */
.evidence-packs-page [data-ep-row]:hover {
    background: var(--surface-subtle);
}

/* ── Borrowed My Jobs primitives (mj-*) ───────────────────────────────────
   mj-filter-actions / mj-empty-state are scoped to .my-jobs-page in fire-doors.css,
   so the evidence pages (which reuse them) get no styling without these. The mobile
   grid for mj-filter-actions lives in the @media block below. NOTE: unlike My Jobs,
   this filter has no auto-submitting selects, so its Search submit stays visible on
   desktop (no mj-search-btn "hide on desktop" rule is wanted here). */
.evidence-packs-page .mj-filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.evidence-packs-page .mj-empty-state {
    padding-bottom: 16px;
}

/* ── L3 capture page (Phase 4 · Option C): header → stats strip → full-width
   checklist → Review & publish card. Same header→strip→list rhythm as L1/L2
   (the strip also restores the gap under the header). Built from the page's own
   primitives/tokens — no new theme. ≤1024px adds an opt-in slot stepper. ── */
.evidence-packs-page .ep-cap-workspace {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}
/* Status stat: the chip sits in the stat's value row. */
.evidence-packs-page .ep-cap-statusnum {
    display: flex;
    align-items: center;
}
/* Slim "linked to inspection" context note (replaces the old overview card). */
.evidence-packs-page .ep-cap-linked-note {
    margin: 0;
    padding: 10px 14px;
    border: 1px solid var(--rule);
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
    color: var(--ink-3);
    font-size: 13px;
}
.evidence-packs-page .ep-cap-linked-note strong { color: var(--ink-2); }

.evidence-packs-page .ep-cap-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}
/* A component goes green only once its photos are SAVED (uploaded + persisted) — so
   the cue can never claim a slot is done before its photos exist server-side. Picking
   a photo shows the amber .is-pending state below instead. (JS toggles .is-captured.) */
.evidence-packs-page .ep-cap-stage.is-captured {
    border-color: var(--success);
    box-shadow: inset 0 0 0 1px var(--success);
}
/* A photo is picked but NOT yet uploaded — amber, clearly distinct from the green
   "saved" state, so the slot never looks done before its photos are persisted. */
.evidence-packs-page .ep-cap-stage.is-pending {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

/* "Not applicable" slots (forked from the My Jobs N/A treatment, re-scoped):
   the N/A toggle + heading stay; the gallery/editor/guidance collapse away. */
.evidence-packs-page .card--surface.is-na {
    border-color: var(--rule);
    box-shadow: none;
}
.evidence-packs-page .card--surface.is-na .fd-job-slot-editor,
.evidence-packs-page .card--surface.is-na .ev-gallery,
.evidence-packs-page .card--surface.is-na .ep-cap-targets {
    display: none;
}
.evidence-packs-page .ep-na-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--ink-3);
    cursor: pointer;
    user-select: none;
}
.evidence-packs-page .ep-na-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--ink-3);
    cursor: pointer;
    flex-shrink: 0;
}
.evidence-packs-page .ep-cap-targets {
    margin: 8px 0 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.evidence-packs-page .ep-cap-targets li {
    font-size: 12px;
    color: var(--ink-3);
}
/* ── Finish card: a review + actions panel. Aligned to the design-system card
   tokens (the global .card carries a heavier legacy shadow + radius) with a proper
   header, and the primary "download pack" action lifted into a warm inset tile so it
   reads as the main CTA rather than a button stranded on a sparse full-width row. ── */
.evidence-packs-page .ep-cap-finish {
    background: var(--surface-card);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 20px 22px;
}
.evidence-packs-page .ep-cap-finish-head {
    margin-bottom: 4px;
}
.evidence-packs-page .ep-cap-finish-head h3 {
    margin: 0 0 3px;
    font-family: var(--font-display, 'Space Grotesk', sans-serif);
    font-size: 1.05rem;
    color: var(--ink);
}
.evidence-packs-page .ep-cap-finish-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 0;
    border-top: 1px solid var(--rule);
    flex-wrap: wrap;
}
/* The first action row sits directly under the header — no divider needed. (Targeted
   via the header sibling because adding the header makes :first-of-type unreliable.) */
.evidence-packs-page .ep-cap-finish-head + .ep-cap-finish-row {
    border-top: none;
    padding-top: 4px;
}
/* Primary action: the evidence-pack download, lifted into a warm inset tile. */
.evidence-packs-page .ep-cap-finish-row--pack {
    margin-top: 12px;
    padding: 14px 16px;
    border-top: none;
    border: 1px solid var(--rule);
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
}
.evidence-packs-page .ep-cap-finish-row__copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.evidence-packs-page .ep-cap-finish-row__copy strong {
    font-family: var(--font-display, 'Space Grotesk', sans-serif);
    font-size: 0.92rem;
    color: var(--ink);
}
.evidence-packs-page .ep-cap-finish-row .btn {
    flex-shrink: 0;
}

.evidence-packs-page .ep-cap-publish-details {
    margin-top: 6px;
    border-top: 1px solid var(--rule);
    padding-top: 12px;
}
.evidence-packs-page .ep-cap-publish-summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--ink-2);
}
.evidence-packs-page .ep-cap-publish {
    margin-top: 12px;
}
.evidence-packs-page [data-ep-download-pdf].is-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* ── Header "More actions" dropdown — verbatim copy of the inspection-show menu
   (inspection_show.css .show-more-actions): same class names + exact values, nothing
   new. No tokens, no dark override, no disabled-grey, no hint — so it renders
   identically to the inspection page. Disabled (no-evidence) items are
   <button aria-disabled="true" title="…"> in the markup: non-clickable (no action),
   but they keep the normal item look + the existing :hover state and show a native
   title tooltip. (Native `disabled` would have killed hover + tooltip.) ── */
.evidence-packs-page .show-more-actions {
    position: relative;
}
.evidence-packs-page .show-more-actions > summary {
    list-style: none;
    cursor: pointer;
}
.evidence-packs-page .show-more-actions > summary::-webkit-details-marker {
    display: none;
}
.evidence-packs-page .show-more-actions__panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    padding: 8px;
    border: 1px solid rgba(0, 0, 0, 0.11);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    z-index: 12;
}
.evidence-packs-page .show-more-actions:not([open]) .show-more-actions__panel {
    display: none;
}
.evidence-packs-page .show-more-actions__form {
    display: contents;
}
.evidence-packs-page .show-more-actions__item {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #3d3a34;
    font: 500 12.5px/1.4 "Inter", sans-serif;
    text-decoration: none;
    cursor: pointer;
    text-align: left;
}
.evidence-packs-page .show-more-actions__item:hover,
.evidence-packs-page .show-more-actions__item:focus {
    background: #f2efe9;
    color: #1a1815;
}
.evidence-packs-page .show-more-actions__divider {
    height: 1px;
    margin: 6px 0;
    background: rgba(0, 0, 0, 0.07);
}

.evidence-packs-page .ep-pack-status {
    margin: 6px 0 12px;
    font-size: 13px;
    color: var(--ink-3);
}
.evidence-packs-page .ep-pack-status--none {
    color: var(--ink-4);
}

.evidence-packs-page .file-field__label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-3);
    margin-bottom: 4px;
}

.evidence-packs-page .u-hide-mobile {
    display: inline;
}

/* Stepper chrome (entry / bar / nav) — hidden by default; the JS un-hides them
   only on ≤1024px (and re-hides on resize to desktop). The min-width guard below
   is a belt-and-braces so they can never show on desktop. */
.evidence-packs-page .ep-cap-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 14px;
    border: 1px solid var(--rule);
    border-radius: var(--radius-md);
    background: var(--surface-card);
}
.evidence-packs-page .ep-cap-entry__copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

/* ── Install capture layer — verbatim values from jobs.css [data-fire-door-job-modal],
   re-scoped to this full page (the jobs.css rules don't reach a non-modal page). ── */
.evidence-packs-page .fd-job-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.evidence-packs-page .fd-job-progress-header h3 { margin: 0; }

.evidence-packs-page .fd-job-progress-count {
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-display, 'Space Grotesk', sans-serif);
    color: var(--ink-3, #6b6458);
    background: var(--surface-subtle, #f2efe9);
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}
.evidence-packs-page .fd-job-progress-count.is-complete {
    color: #166534;
    background: #dcfce7;
}

.evidence-packs-page .fd-job-progress-bar {
    height: 6px;
    background: var(--rule, rgba(26, 24, 21, 0.08));
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}
.evidence-packs-page .fd-job-progress-bar__fill {
    height: 100%;
    background: var(--accent, #c49510);
    border-radius: 3px;
    transition: width 0.3s ease;
}
.evidence-packs-page .fd-job-progress-bar__fill.is-complete {
    background: #22c55e;
}
.evidence-packs-page .fd-job-ready-hint {
    font-size: 0.82rem;
    color: #166534;
    font-weight: 500;
    margin: 0 0 4px;
}

.evidence-packs-page .card--surface {
    background: var(--surface-subtle, #f2efe9);
    border: 1px solid rgba(26, 24, 21, 0.08);
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: none;
}
.evidence-packs-page .card--surface .section-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
}
.evidence-packs-page .card--surface .section-heading h4 {
    font-family: var(--font-display, 'Space Grotesk', sans-serif);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--ink, #1a1815);
    margin: 0;
}
.evidence-packs-page .card--surface .section-heading .text-muted {
    margin: 0;
    font-size: 12px;
    color: var(--ink-3, #6b6458);
}
.evidence-packs-page .card--surface .section-heading > div:last-child {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.evidence-packs-page .card--surface .badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    line-height: 1.3;
}

.evidence-packs-page .fd-job-slot-editor {
    margin-top: 10px;
    border-top: 1px solid rgba(26, 24, 21, 0.08);
    padding-top: 10px;
}
.evidence-packs-page .fd-job-slot-editor__summary {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0 8px;
}
.evidence-packs-page .fd-job-slot-editor__title {
    font-family: var(--font-display, 'Space Grotesk', sans-serif);
    font-size: 0.82rem;
    color: var(--ink-2, #3d3a34);
}
.evidence-packs-page .fd-job-slot-editor__summary .text-muted {
    font-size: 12px;
}

/* Inline action forms (a single button POSTing) must not pick up the global
   form{} card chrome — they sit inline among buttons. display:contents lets the
   button participate directly in the parent's flex layout. */
.evidence-packs-page .ep-inline-form {
    display: contents;
}

.evidence-packs-page .fd-job-evidence-form {
    margin-top: 12px;
    grid-template-columns: 1fr;
    gap: 12px;
}
.evidence-packs-page .fd-job-evidence-form label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-3, #6b6458);
}
.evidence-packs-page .fd-job-evidence-form input[type="text"] {
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(26, 24, 21, 0.14);
    font-size: 13px;
}
.evidence-packs-page .fd-job-evidence-form input[type="text"]:focus {
    border-color: rgba(196, 149, 16, 0.4);
    box-shadow: 0 0 0 3px rgba(196, 149, 16, 0.1);
    outline: none;
}
.evidence-packs-page .file-upload-card {
    border-radius: 10px;
    border-color: rgba(26, 24, 21, 0.12);
}
.evidence-packs-page .file-upload-card__action {
    border-radius: 8px;
    padding: 10px 14px;
}

/* ── Mobile stepper chrome (≤1024px): top bar (progress + pills) + bottom nav.
   Light treatment using the page's tokens — matches the inspection capture
   stepper structure without its inspection-specific coupling. ── */
.evidence-packs-page .ep-cap-bar {
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid var(--rule);
    border-radius: var(--radius-md);
    background: var(--surface-card);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.evidence-packs-page .ep-cap-bar__top {
    display: flex;
    align-items: center;
    gap: 10px;
}
.evidence-packs-page .ep-cap-bar__exit {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--rule);
    background: var(--surface-subtle);
    color: var(--ink-3);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.evidence-packs-page .ep-cap-bar__copy {
    flex: 1;
    min-width: 0;
}
.evidence-packs-page .ep-cap-bar__eyebrow {
    margin: 0;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-4);
}
.evidence-packs-page .ep-cap-bar__title {
    margin: 0;
    font-family: var(--font-display, 'Space Grotesk', sans-serif);
    font-size: 0.95rem;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.evidence-packs-page .ep-cap-bar__count {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-3);
}
.evidence-packs-page .ep-cap-bar__progress {
    height: 6px;
    background: var(--rule);
    border-radius: 3px;
    overflow: hidden;
}
.evidence-packs-page .ep-cap-bar__progressfill {
    width: 0;
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}
.evidence-packs-page .ep-cap-bar__pills {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}
.evidence-packs-page .ep-cap-bar__pills::-webkit-scrollbar { display: none; }
.evidence-packs-page .ep-cap-pill {
    flex-shrink: 0;
    min-height: 32px;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--rule);
    background: var(--surface-subtle);
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    scroll-snap-align: start;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
/* Picked-but-unsaved step — amber cue (saved "is-done" + active states out-rank it). */
.evidence-packs-page .ep-cap-pill.is-pending {
    color: var(--accent-strong);
    border-color: rgba(196, 149, 16, 0.4);
}
.evidence-packs-page .ep-cap-pill.is-done {
    color: var(--success);
    border-color: rgba(30, 122, 69, 0.3);
}
.evidence-packs-page .ep-cap-pill.is-active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-strong);
}

.evidence-packs-page .ep-cap-nav {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    gap: 10px;
    margin-top: 14px;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--rule);
    background: var(--canvas);
}
.evidence-packs-page .ep-cap-nav .btn {
    flex: 1;
    min-height: 46px;
    border-radius: 10px;
}

/* ── Create modal: locked property (L2) — read-only context, not a control ── */
.evidence-packs-modal .ep-locked-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.evidence-packs-modal .ep-locked-field__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-3);
}
.evidence-packs-modal .ep-locked-field__value {
    min-height: 40px;
    display: flex;
    align-items: center;
    padding: 8px 13px;
    border-radius: 9px;
    border: 1px solid var(--rule);
    background: var(--surface-subtle);
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 600;
}

/* ── Inspection-door picker (create modal) ────────────────────────────── */
.evidence-packs-modal .ep-door-results {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 6px;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    background: var(--surface-inset);
    padding: 4px;
}
.evidence-packs-modal .ep-door-result {
    text-align: left;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: var(--surface-card);
    color: var(--ink);
    font-size: 13px;
    cursor: pointer;
}
.evidence-packs-modal .ep-door-result:hover {
    background: var(--accent-soft);
}
.evidence-packs-modal .ep-door-result .badge {
    margin-left: 6px;
    vertical-align: middle;
}
.evidence-packs-modal .ep-door-empty {
    margin: 0;
    padding: 8px 10px;
    font-size: 12.5px;
    color: var(--ink-4);
}
.evidence-packs-modal .ep-door-selected {
    margin: 8px 0 0;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--success);
}

/* ============================================================================
   Mobile (≤900px)
   ========================================================================== */
@media (max-width: 900px) {
    .evidence-packs-page .u-hide-mobile {
        display: none;
    }

    /* Floorplans section header: stack the title above the actions and let the
       Import / Upload buttons go full-width — the global .section-heading is a
       no-wrap row, so two icon+text buttons otherwise crush/overflow on phones. */
    .evidence-packs-page .ep-floorplan-head {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .evidence-packs-page .ep-floorplan-head .floorplan-header-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
    }
    .evidence-packs-page .ep-floorplan-head .floorplan-header-actions .btn {
        width: 100%;
    }

    .evidence-packs-page .mj-filter-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .evidence-packs-page .mj-filter-actions > *:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    /* ── Index table card-ification — verbatim copy of the My Jobs block ─── */
    .evidence-packs-page .ipi-table-wrap {
        overflow-x: visible;
    }
    .evidence-packs-page .ipi-table {
        min-width: 0;
    }
    .evidence-packs-page .ipi-table,
    .evidence-packs-page .ipi-table thead,
    .evidence-packs-page .ipi-table tbody,
    .evidence-packs-page .ipi-table tr,
    .evidence-packs-page .ipi-table th,
    .evidence-packs-page .ipi-table td {
        display: block;
        width: 100%;
    }
    .evidence-packs-page .ipi-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
    .evidence-packs-page .ipi-table tbody {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .evidence-packs-page .ipi-table tr {
        border: 1px solid rgba(26, 24, 21, 0.1);
        border-radius: 10px;
        background: #ffffff;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
        padding: 6px 0;
    }
    .evidence-packs-page .ipi-table td {
        position: relative;
        padding: 7px 14px 7px 110px;
        border-bottom: 1px solid rgba(26, 24, 21, 0.06);
        text-align: left !important;
        white-space: normal;
    }
    .evidence-packs-page .ipi-table td:last-child {
        border-bottom: none;
    }
    .evidence-packs-page .ipi-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 14px;
        top: 7px;
        width: 82px;
        color: #9a9188;
        font-size: 10px;
        font-weight: 600;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }
    .evidence-packs-page .ipi-table td.ipi-actions {
        padding-left: 14px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 6px;
    }
    .evidence-packs-page .ipi-table td.ipi-actions::before {
        display: none;
    }

    /* --- Index directory: native card (grid) ---
       Scoped to the index-only class so the property-evidence detail table
       (same .evidence-packs-table class, different columns) keeps the
       label-left card-ification above. Property is the title; the three
       counts sit in a stat row; "Open" is the footer. Whole-row click
       (data-ep-row-href) is unaffected — CSS-only. */
    .evidence-packs-page .ipi-table.evidence-packs-index-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .evidence-packs-page .ipi-table.evidence-packs-index-table tr {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-areas:
            "property property property"
            "doors    progress  published"
            "actions  actions   actions";
        column-gap: 12px;
        row-gap: 12px;
        align-items: start;
        padding: 14px 16px;
        border: 1px solid rgba(26, 24, 21, 0.1);
        border-radius: 14px;
        background: #ffffff;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 16px rgba(15, 23, 42, 0.05);
    }

    .evidence-packs-page .ipi-table.evidence-packs-index-table td {
        position: static;
        padding: 0;
        border: 0;
        min-width: 0;
        text-align: left !important;
        white-space: normal;
    }

    .evidence-packs-page .ipi-table.evidence-packs-index-table td::before {
        content: attr(data-label);
        position: static;
        display: block;
        width: auto;
        margin-bottom: 3px;
        color: var(--ink-4, #9a9188);
        font-size: 9.5px;
        font-weight: 700;
        letter-spacing: 0.09em;
        text-transform: uppercase;
    }

    .evidence-packs-page .ipi-table.evidence-packs-index-table td[data-label="Property"] { grid-area: property; }
    .evidence-packs-page .ipi-table.evidence-packs-index-table td[data-label="Doors"] { grid-area: doors; }
    .evidence-packs-page .ipi-table.evidence-packs-index-table td[data-label="In progress"] { grid-area: progress; }
    .evidence-packs-page .ipi-table.evidence-packs-index-table td[data-label="Packs published"] { grid-area: published; }
    .evidence-packs-page .ipi-table.evidence-packs-index-table td.ipi-actions { grid-area: actions; }

    .evidence-packs-page .ipi-table.evidence-packs-index-table td[data-label="Property"]::before {
        display: none;
    }

    .evidence-packs-page .ipi-table.evidence-packs-index-table td[data-label="Property"] .ipi-td-insp-name {
        font-size: 15px;
        font-weight: 700;
    }

    /* Actions footer: divider + right-aligned Open */
    .evidence-packs-page .ipi-table.evidence-packs-index-table td.ipi-actions {
        margin-top: 2px;
        padding-top: 12px;
        border-top: 1px solid rgba(26, 24, 21, 0.1);
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
    }

    .evidence-packs-page .ipi-table.evidence-packs-index-table td.ipi-actions::before {
        display: none;
    }

    .evidence-packs-page .ipi-table.evidence-packs-index-table td.ipi-actions .btn {
        min-height: 40px;
    }
}

/* ============================================================================
   L3 capture: tablet/phone (≤1024px) — collapse the two columns + the stepper.
   1024px (not 900px) is intentional: tablet-first capture, matching the
   inspection capture stepper breakpoint.
   ========================================================================== */
@media (max-width: 1024px) {
    .evidence-packs-page .ep-cap-slots { grid-template-columns: 1fr; }

    /* Guided stepper active: show one stage at a time; the bar owns the progress,
       so the stats strip + checklist head + linked note step aside. */
    .evidence-packs-page.is-stepping .ipi-stats-strip,
    .evidence-packs-page.is-stepping .ep-cap-linked-note,
    .evidence-packs-page.is-stepping .ep-cap-checklist-head {
        display: none;
    }
    .evidence-packs-page.is-stepping [data-ep-cap-stage]:not(.is-active) {
        display: none !important;
    }
}

@media (min-width: 1025px) {
    /* Stepper chrome can never appear on desktop, regardless of JS state. */
    .evidence-packs-page .ep-cap-entry,
    .evidence-packs-page .ep-cap-bar,
    .evidence-packs-page .ep-cap-nav {
        display: none !important;
    }
}

/* ============================================================================
   Dark mode
   ========================================================================== */
html[data-theme="dark"] .evidence-packs-page .card--surface {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(148, 163, 184, 0.16);
}
/* Keep the "captured" green outline in dark mode (out-specifies the rule above). */
html[data-theme="dark"] .evidence-packs-page .ep-cap-stage.is-captured {
    border-color: var(--success);
}
html[data-theme="dark"] .evidence-packs-page .ep-cap-stage.is-pending {
    border-color: var(--accent);
}
html[data-theme="dark"] .evidence-packs-page .ep-cap-finish {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(148, 163, 184, 0.16);
    box-shadow: none;
}
html[data-theme="dark"] .evidence-packs-page .ep-cap-finish-row--pack {
    background: rgba(2, 6, 23, 0.42);
    border-color: rgba(148, 163, 184, 0.16);
}
html[data-theme="dark"] .evidence-packs-page .fd-job-slot-editor {
    border-top-color: rgba(148, 163, 184, 0.16);
}
html[data-theme="dark"] .evidence-packs-page .fd-job-progress-count {
    background: rgba(148, 163, 184, 0.15);
    color: rgba(148, 163, 184, 0.8);
}
html[data-theme="dark"] .evidence-packs-page .fd-job-progress-count.is-complete {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}
html[data-theme="dark"] .evidence-packs-modal .ep-door-results {
    background: rgba(2, 6, 23, 0.42);
    border-color: rgba(148, 163, 184, 0.22);
}
html[data-theme="dark"] .evidence-packs-modal .ep-door-result {
    background: rgba(15, 23, 42, 0.55);
    color: rgba(248, 250, 252, 0.85);
}

@media (max-width: 900px) {
    html[data-theme="dark"] .evidence-packs-page .ipi-table tr {
        background: var(--card);
        border-color: var(--border);
        box-shadow: none;
    }
    html[data-theme="dark"] .evidence-packs-page .ipi-table td {
        border-bottom-color: rgba(71, 85, 105, 0.4);
    }
    html[data-theme="dark"] .evidence-packs-page .ipi-table td::before {
        color: var(--text-muted);
    }

    /* Index directory native card — dark */
    html[data-theme="dark"] .evidence-packs-page .ipi-table.evidence-packs-index-table tr {
        background: var(--card);
        border-color: var(--border);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    }
    html[data-theme="dark"] .evidence-packs-page .ipi-table.evidence-packs-index-table td[data-label="Property"] .ipi-td-insp-name {
        color: var(--text);
    }
    html[data-theme="dark"] .evidence-packs-page .ipi-table.evidence-packs-index-table td.ipi-actions {
        border-top-color: var(--border);
    }
}

/* ============================================================================
   Property floorplans (Phase 5) — VERBATIM fork of the inspection/FS floorplan
   CSS (inspection_show.css, also copied into fire-stopping-survey-show.css).
   Class names kept identical for 1:1 parity; only the gallery-click hook is the
   evidence-scoped data-ep-floorplan-plan-id. Driven by features/fd-evidence-floorplan.js.
   Nothing invented — these are the existing floorplan styles.
   ========================================================================== */
.floorplan-modal {
    position: fixed;
    inset: 0;
    background: rgba(26, 24, 21, 0.42);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2500;
    padding: 40px;
}
.floorplan-modal[hidden] {
    display: none;
}
.floorplan-modal__backdrop {
    position: absolute;
    inset: 0;
}
.floorplan-modal__dialog {
    position: relative;
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(35, 31, 24, 0.08);
    padding: 0;
    width: 100%;
    max-width: calc(100vw - 80px);
    height: calc(100vh - 80px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0;
    box-shadow: 0 28px 80px rgba(25, 19, 9, 0.22);
}
.floorplan-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 22px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(35, 31, 24, 0.08);
}
.floorplan-modal__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 22px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(35, 31, 24, 0.08);
    background: #f7f5f0;
}
.floorplan-modal__tabs button {
    border: 1px solid rgba(35, 31, 24, 0.12);
    border-radius: 999px;
    padding: 6px 14px;
    background: #ffffff;
    font-size: 0.82rem;
    font-weight: 500;
    color: #1a1815;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.floorplan-modal__tabs button:hover {
    background: #edeae3;
}
.floorplan-modal__tabs button.is-active {
    background: #1a1815;
    color: #fff;
    border-color: #1a1815;
}
.floorplan-modal__stage {
    position: relative;
    background: #0f172a;
    border-radius: 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    touch-action: none;
}
.floorplan-stage__loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.floorplan-modal__stage.is-loading .floorplan-stage__loading {
    opacity: 1;
}
.floorplan-modal__stage.is-loading .floorplan-stage__inner {
    opacity: 0;
}
.floorplan-stage__spinner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.18);
    border-top-color: rgba(255, 255, 255, 0.85);
    animation: fdBtnSpin 0.8s linear infinite;
}
.floorplan-stage__loading-text {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.02em;
}
.floorplan-stage__inner {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-origin: center center;
    transition: opacity 0.2s ease;
}
.floorplan-stage__inner img {
    display: block;
    max-width: none;
    pointer-events: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.floorplan-pin {
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: var(--brand, #0052cc);
    transform: translate(-50%, -50%);
    box-shadow: 0 6px 12px rgba(0, 82, 204, 0.5);
    cursor: grab;
    z-index: 2;
}
.floorplan-pin[data-label]:not([data-label=""])::after {
    content: attr(data-label);
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translate(-50%, -120%);
    background: rgba(234, 88, 12, 0.92);
    color: #fff;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.25);
}
.floorplan-pin[hidden]::after {
    content: '';
    display: none;
}
.floorplan-header-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.floorplan-markers {
    position: absolute;
    inset: 0;
    pointer-events: auto;
    z-index: 1;
}
.floorplan-marker {
    position: absolute;
    transform: translate(-50%, -100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: auto;
    text-align: center;
}
.floorplan-marker__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(234, 88, 12, 0.9);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.3);
}
.floorplan-marker--tagged .floorplan-marker__dot {
    background: #16a34a;
}
.floorplan-marker--pending .floorplan-marker__dot {
    background: #f97316;
}
.floorplan-marker--faulty .floorplan-marker__dot {
    background: #dc2626;
}
.floorplan-marker__label {
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.85);
    color: #fff;
    font-size: 0.68rem;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.floorplan-gallery {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}
.floorplan-gallery__item {
    display: flex;
    flex-direction: column;
    background: var(--surface-card);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.floorplan-gallery__canvas {
    position: relative;
    overflow: hidden;
    background: var(--surface-inset);
    min-height: 200px;
    border-bottom: 1px solid var(--rule);
}
.floorplan-gallery__canvas--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: color-mix(in srgb, var(--text-muted, #475569) 55%, transparent);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.floorplan-gallery__canvas img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: var(--surface-inset);
}
.floorplan-gallery__meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px 14px;
}
.floorplan-gallery__metatop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.floorplan-gallery__title {
    margin: 0;
    font-family: var(--font-display, inherit);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
}
.floorplan-gallery__pill {
    flex-shrink: 0;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}
.floorplan-gallery__empty {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px 24px;
    border: 1px dashed var(--rule-strong);
    border-radius: var(--radius-lg);
    background: var(--surface-subtle);
    text-align: center;
    color: var(--ink-3);
}
.floorplan-gallery__empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface-card);
    border: 1px solid var(--rule);
    color: var(--ink-4);
}
.floorplan-gallery__empty-icon svg {
    width: 22px;
    height: 22px;
}
.floorplan-gallery__empty-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 2px;
}
.floorplan-gallery__hint {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted, #475569);
}
.floorplan-gallery__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.floorplan-gallery__action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--rule, rgba(26, 24, 21, 0.12));
    background: var(--surface-card, #fff);
    color: var(--ink-2, #3d3a34);
    border-radius: 7px;
    padding: 5px 11px;
    font: 500 12px/1.3 "Inter", sans-serif;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.floorplan-gallery__action svg {
    width: 13px;
    height: 13px;
}
.floorplan-gallery__action:hover,
.floorplan-gallery__action:focus {
    background: var(--surface-subtle, #f2efe9);
    color: var(--ink, #1a1815);
}
.floorplan-gallery__action--danger {
    color: var(--danger, #b03030);
}
.floorplan-gallery__action--danger:hover,
.floorplan-gallery__action--danger:focus {
    background: rgba(176, 48, 48, 0.08);
    border-color: rgba(176, 48, 48, 0.32);
    color: var(--danger, #b03030);
}
html[data-theme="dark"] .floorplan-gallery__action {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(148, 163, 184, 0.22);
    color: #e2e8f0;
}
html[data-theme="dark"] .floorplan-gallery__action:hover,
html[data-theme="dark"] .floorplan-gallery__action:focus {
    background: rgba(15, 23, 42, 0.78);
    color: #f8fafc;
}
html[data-theme="dark"] .floorplan-gallery__action--danger {
    color: #f87171;
}
.floorplan-modal__hint {
    margin: 0;
    padding: 8px 22px;
    font-size: 12px;
    color: #8f8476;
    flex-shrink: 0;
    background: #f7f5f0;
    border-top: 1px solid rgba(35, 31, 24, 0.08);
}
.floorplan-modal__status {
    margin: 0;
    padding: 8px 22px;
    font-size: 12px;
    color: #6b6458;
    flex-shrink: 0;
    background: #edeae3;
    border-top: 1px solid rgba(35, 31, 24, 0.08);
}
.floorplan-modal__actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
    padding: 16px 22px;
    border-top: 1px solid rgba(35, 31, 24, 0.08);
    background: #ffffff;
}
.floorplan-modal__actions-primary {
    display: flex;
    gap: 10px;
}

/* Narrow viewports: fullscreen floorplan — warm neutrals (matches the stepper). */
.floorplan-modal.floorplan-modal--fullscreen {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    background: #f7f5f0;
}
.floorplan-modal.floorplan-modal--fullscreen .floorplan-modal__backdrop {
    display: none;
}
.floorplan-modal.floorplan-modal--fullscreen .floorplan-modal__dialog {
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    min-height: 100dvh;
    border-radius: 0;
    padding: 0;
    gap: 0;
    box-shadow: none;
    border: 0;
    background: #f7f5f0;
}
.floorplan-modal.floorplan-modal--fullscreen .floorplan-modal__header {
    flex-shrink: 0;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px 14px;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 20px 12px;
    background: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}
.floorplan-modal.floorplan-modal--fullscreen .floorplan-modal__tabs {
    flex-shrink: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding: 10px 16px;
    background: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    scrollbar-width: thin;
}
.floorplan-modal.floorplan-modal--fullscreen .floorplan-modal__tabs button {
    flex-shrink: 0;
    border-color: rgba(35, 31, 24, 0.12);
    background: #f7f5f0;
    color: #1a1815;
}
.floorplan-modal.floorplan-modal--fullscreen .floorplan-modal__tabs button.is-active {
    background: #1a1815;
    color: #fff;
    border-color: #1a1815;
}
.floorplan-modal.floorplan-modal--fullscreen .floorplan-modal__stage {
    flex: 1 1 auto;
    min-height: 0;
    border-radius: 0;
    border: 0;
    background: #1f1b16;
}
.floorplan-modal.floorplan-modal--fullscreen .floorplan-modal__hint {
    display: none;
}
.floorplan-modal.floorplan-modal--fullscreen .floorplan-modal__status {
    flex-shrink: 0;
    margin: 0;
    padding: 10px 16px;
    font-size: 12px;
    line-height: 1.45;
    font-weight: 400;
    border: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: #edeae3;
    color: #6b6458;
}
.floorplan-modal.floorplan-modal--fullscreen .floorplan-modal__actions {
    flex-shrink: 0;
    margin: 0;
    padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0px));
    background: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
    flex-wrap: nowrap;
    gap: 10px;
}
.floorplan-modal.floorplan-modal--fullscreen .floorplan-modal__actions .btn {
    min-height: 44px;
}
.floorplan-gallery__canvas[data-ep-floorplan-plan-id] {
    cursor: zoom-in;
}
.floorplan-gallery__canvas[data-ep-floorplan-plan-id]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -3px;
}
.floorplan-gallery__item:hover,
.floorplan-gallery__item:focus-within {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--rule-strong);
}
