/* Shared list-card + app-store + ops-console styling for the Portal's
   browse surfaces (context definitions, workflows, action packs, action
   center). All colors via --theme-* tokens so tenant branding flows through.
   Goal: sexy, functional, inviting, professional. */

/* ── Toolbar (search + count) ─────────────────────────────────────────── */
.plist-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.plist-search {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 420px;
}

.plist-search .bi {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--theme-text-secondary);
    pointer-events: none;
}

.plist-search input {
    padding-left: 2.1rem;
}

.plist-count {
    font-size: var(--theme-font-size-sm);
    color: var(--theme-text-secondary);
    white-space: nowrap;
}

.plist-spacer { flex: 1; }

/* ── Card grid ────────────────────────────────────────────────────────── */
.pcard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
}

/* The Action Packs section toolbar - title left, count + filter chips right. */
.appstore-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: end;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius, 0.6rem);
    background: var(--theme-surface, #fff);
    margin-bottom: 0.75rem;
}
.appstore-toolbar .ast-f { display: flex; flex-direction: column; gap: 0.2rem; min-width: 140px; flex: 1 1 140px; }
.appstore-toolbar .ast-f label { font-size: 0.72rem; color: var(--theme-text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.appstore-toolbar .ast-f-search { flex: 2 1 220px; }
.appstore-toolbar .ast-f-actions { display: flex; gap: 0.4rem; align-items: center; margin-left: auto; }
.appstore-toolbar .ast-f-count { font-size: 0.8rem; color: var(--theme-text-secondary); white-space: nowrap; }

/* Collapsible "Pack authoring" section header (Definitions). */
.appstore-section-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0.5rem;
    padding: 0.55rem 0.9rem;
    background: var(--theme-surface, #fff);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius, 0.6rem);
    color: var(--theme-text-emphasis);
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    margin: 1rem 0 0.75rem;
}
.appstore-section-toggle:hover { background: color-mix(in oklch, var(--theme-primary) 4%, var(--theme-surface, #fff)); }
.appstore-section-toggle .chev { margin-left: auto; transition: transform .15s ease; }
.appstore-section-toggle.is-open .chev { transform: rotate(90deg); }
.appstore-section-toggle .hint { font-weight: 400; color: var(--theme-text-secondary); font-size: 0.8rem; }
.appstore-section-toggle .new-btn { margin-left: 0.5rem; }

/* Subscription edit modal - two-column layout: form (left) + catalog/preview (right). */
.subedit-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
}
@media (max-width: 991.98px) {
    .subedit-grid { grid-template-columns: 1fr; }
}
.subedit-pane {
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius, 0.6rem);
    background: var(--theme-surface, #fff);
    padding: 0.85rem 1rem;
}
.subedit-pane h6 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--theme-text-secondary);
    margin: 0 0 0.6rem 0;
    font-weight: 700;
}
.subedit-fieldlist {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 260px;
    overflow-y: auto;
}
.subedit-fieldlist li {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--theme-border);
    font-size: 0.85rem;
}
.subedit-fieldlist li:last-child { border-bottom: 0; }
.subedit-fieldlist code {
    font-size: 0.82rem;
    color: var(--theme-primary);
    background: color-mix(in oklch, var(--theme-primary) 8%, transparent);
    padding: 0.05rem 0.3rem;
    border-radius: 0.2rem;
}
.subedit-fieldlist .field-desc { color: var(--theme-text-secondary); font-size: 0.75rem; margin-top: 0.15rem; }
.subedit-sample {
    background: color-mix(in oklch, var(--theme-text-emphasis) 4%, var(--theme-surface, #fff));
    border: 1px solid var(--theme-border);
    border-radius: 0.4rem;
    padding: 0.5rem 0.6rem;
    max-height: 280px;
    overflow: auto;
    font-size: 0.78rem;
    margin: 0;
}

/* Configure / Definition modal - sectioned body, like the Action Center detail. */
.ap-config-modal .ap-section {
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius, 0.6rem);
    background: var(--theme-surface, #fff);
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}
.ap-config-modal .ap-section h6 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--theme-text-secondary);
    margin: 0 0 0.6rem 0;
    font-weight: 700;
}
.ap-config-modal .ap-section .hint { font-size: 0.78rem; color: var(--theme-text-secondary); margin-top: 0.25rem; }

.pcard {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius, 0.6rem);
    background: var(--theme-surface, #fff);
    overflow: hidden;
    transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}

.pcard:hover {
    box-shadow: 0 6px 20px color-mix(in oklch, var(--theme-primary) 14%, transparent);
    border-color: color-mix(in oklch, var(--theme-primary) 45%, var(--theme-border));
    transform: translateY(-2px);
}

/* A thin accent rail at the top of each card; color set inline per card. */
.pcard-accent {
    height: 4px;
    background: var(--theme-primary);
}

.pcard-head {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.85rem 0.9rem 0.4rem;
}

.pcard-icon {
    flex: 0 0 auto;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.55rem;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    background: color-mix(in oklch, var(--theme-primary) 12%, transparent);
    color: var(--theme-primary);
}

.pcard-headtext { min-width: 0; flex: 1; }

.pcard-title {
    font-weight: 650;
    color: var(--theme-text-emphasis);
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.2;
    word-break: break-word;
}

.pcard-sub {
    font-family: var(--bs-font-monospace, monospace);
    font-size: 0.72rem;
    color: var(--theme-text-secondary);
    word-break: break-all;
}

.pcard-body {
    padding: 0.1rem 0.9rem 0.6rem;
    flex: 1;
}

.pcard-desc {
    font-size: 0.83rem;
    color: var(--theme-text-secondary);
    margin: 0 0 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pcard-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.6rem;
    font-size: 0.74rem;
    color: var(--theme-text-secondary);
}

.pcard-meta .bi { margin-right: 0.2rem; }

.pcard-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.08rem 0.45rem;
    border-radius: 0.35rem;
    background: color-mix(in oklch, var(--theme-accent, #6c757d) 13%, transparent);
    color: var(--theme-text-emphasis);
    font-size: 0.72rem;
}

.pcard-foot {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border-top: 1px solid var(--theme-border);
    background: color-mix(in oklch, var(--theme-accent, #6c757d) 4%, transparent);
}

.pcard-foot .pcard-spacer { flex: 1; }

/* ── Empty state ──────────────────────────────────────────────────────── */
.pcard-empty {
    text-align: center;
    padding: 3rem 1rem;
    border: 1px dashed var(--theme-border);
    border-radius: var(--theme-radius, 0.6rem);
    background: color-mix(in oklch, var(--theme-primary) 3%, transparent);
}

.pcard-empty-icon {
    font-size: 2.4rem;
    color: color-mix(in oklch, var(--theme-primary) 55%, var(--theme-text-secondary));
    margin-bottom: 0.5rem;
}

.pcard-empty-title {
    font-weight: 650;
    color: var(--theme-text-emphasis);
    margin-bottom: 0.25rem;
}

.pcard-empty-body {
    font-size: 0.88rem;
    color: var(--theme-text-secondary);
    max-width: 32rem;
    margin: 0 auto 1rem;
}

/* ── App-store (action packs) ─────────────────────────────────────────── */
.appstore-section-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: var(--theme-font-size-sm);
    font-weight: 650;
    color: var(--theme-text-emphasis);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 1.5rem 0 0.75rem;
}

.appstore-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.74rem;
    font-weight: 600;
}

.appstore-status.on { color: var(--theme-success, #198754); }
.appstore-status.off { color: var(--theme-text-secondary); }

.appstore-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: currentColor;
}

/* The on/off switch sits in the card foot; make it read as the primary act. */
.appstore-switch .form-check-input {
    width: 2.4rem;
    height: 1.3rem;
    cursor: pointer;
}

/* Disabled packs read muted until switched on. */
.pcard-muted { opacity: 0.72; }
.pcard-muted:hover { opacity: 1; }

/* ── Ops console (action center) ──────────────────────────────────────── */
.ops-hero {
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius, 0.6rem);
    background: linear-gradient(180deg,
        color-mix(in oklch, var(--theme-primary) 7%, var(--theme-surface, #fff)),
        var(--theme-surface, #fff));
    padding: 1rem 1.1rem;
    margin-bottom: 1.5rem;
}

.ops-runlist {
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius, 0.6rem);
    overflow: hidden;
}

.ops-runrow {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    border-top: 1px solid var(--theme-border);
    cursor: pointer;
    transition: background .12s ease;
}

.ops-runrow:first-child { border-top: 0; }
.ops-runrow:hover { background: color-mix(in oklch, var(--theme-primary) 6%, transparent); }

.ops-run-main { flex: 1; min-width: 0; }
.ops-run-name { font-weight: 600; color: var(--theme-text-emphasis); }
.ops-run-sub { font-size: 0.76rem; color: var(--theme-text-secondary); }
.ops-run-time { font-size: 0.76rem; color: var(--theme-text-secondary); white-space: nowrap; }

/* status pill - colors come from severity helper classes already in use */
.ops-pill {
    font-size: 0.72rem;
    padding: 0.12rem 0.5rem;
    border-radius: 1rem;
    font-weight: 600;
}

/* The Test Center collapses to a slim strip so the Run Log gets the real estate. */
.ops-section-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0.5rem;
    padding: 0.55rem 0.9rem;
    background: var(--theme-surface, #fff);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius, 0.6rem);
    color: var(--theme-text-emphasis);
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    margin-bottom: 1rem;
}
.ops-section-toggle:hover { background: color-mix(in oklch, var(--theme-primary) 4%, var(--theme-surface, #fff)); }
.ops-section-toggle .chev { margin-left: auto; transition: transform .15s ease; }
.ops-section-toggle.is-open .chev { transform: rotate(90deg); }
.ops-section-toggle .hint { font-weight: 400; color: var(--theme-text-secondary); font-size: 0.8rem; }

/* The Run Log filter strip — the "lotta stuff, need filters" answer. */
.ops-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: end;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius, 0.6rem);
    background: var(--theme-surface, #fff);
    margin-bottom: 0.75rem;
}
.ops-filters .ops-f { display: flex; flex-direction: column; gap: 0.2rem; min-width: 140px; flex: 1 1 140px; }
.ops-filters .ops-f label { font-size: 0.72rem; color: var(--theme-text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.ops-filters .ops-f-search { flex: 2 1 220px; }
.ops-filters .ops-f-actions { display: flex; gap: 0.4rem; align-items: center; margin-left: auto; }
.ops-filters .ops-f-count { font-size: 0.8rem; color: var(--theme-text-secondary); white-space: nowrap; }

/* No-match empty state inside a filtered list. */
.ops-runlist-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--theme-text-secondary);
    border: 1px dashed var(--theme-border);
    border-radius: var(--theme-radius, 0.6rem);
}

/* ── Run detail dialog (modal-xl) ─────────────────────────────────────── */
/* Each logical section (Run header / Result / Input / Output / Steps) is a card. */
.ops-detail .ops-section {
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius, 0.6rem);
    background: var(--theme-surface, #fff);
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}
/* ── Answer Center ────────────────────────────────────────────────────── */
.ansc-grid { display: flex; flex-direction: column; gap: 0.75rem; }

.ansc-jobcard {
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius, 0.6rem);
    background: var(--theme-surface, #fff);
    overflow: hidden;
}

.ansc-jobhead {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 1rem;
    width: 100%;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
    transition: background .12s ease;
}
.ansc-jobhead:hover { background: color-mix(in oklch, var(--theme-primary) 5%, transparent); }
.ansc-jobhead > .bi-folder2-open { font-size: 1.4rem; color: var(--theme-primary); flex: 0 0 auto; }
.ansc-jobhead .chev { color: var(--theme-text-secondary); transition: transform .15s ease; flex: 0 0 auto; }
.ansc-jobhead.is-open .chev { transform: rotate(90deg); }

.ansc-jobtitle { flex: 1; min-width: 0; }
.ansc-kit { font-weight: 700; color: var(--theme-text-emphasis); font-size: 1.05rem; line-height: 1.2; }
/* The job-number chip - three jobs on one anchor need telling apart (2026-07-03). */
.ansc-jobid {
    font-family: var(--bs-font-monospace, monospace);
    font-size: .7rem;
    font-weight: 600;
    color: var(--theme-text-muted);
    background: var(--theme-background-subtle);
    border: 1px solid var(--theme-border);
    border-radius: 999px;
    padding: 0 .45rem;
    white-space: nowrap;
    vertical-align: middle;
}
.ansc-anchor { font-size: 0.82rem; color: var(--theme-text-secondary); margin-top: 0.15rem; }
.ansc-anchortext { color: var(--theme-text-emphasis); font-weight: 500; }

.ansc-jobmeta { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.ansc-kitcount {
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--theme-text-emphasis);
    padding: 0.15rem 0.55rem;
    border-radius: 0.35rem;
    background: color-mix(in oklch, var(--theme-success, #198754) 10%, transparent);
}
.ansc-date { font-size: 0.78rem; color: var(--theme-text-secondary); white-space: nowrap; }

.ansc-jobbody { border-top: 1px solid var(--theme-border); padding: 0.6rem 1rem 0.9rem; }
.ansc-toolbar { display: flex; gap: 0.5rem; justify-content: flex-end; margin-bottom: 0.4rem; }
.ansc-kittable { font-size: 0.9rem; margin-bottom: 0; }
.ansc-kittable code { font-size: 0.78rem; }

/* Reports for this job - the Report Center consumption strip under the kit table. */
.ansc-reports { margin-top: 0.75rem; border-top: 1px dashed var(--theme-border); padding-top: 0.55rem; }
.ansc-reports-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.3rem; }
.ansc-reports-title { font-weight: 600; font-size: 0.85rem; color: var(--theme-text-secondary); text-transform: uppercase; letter-spacing: 0.03em; }
.ansc-reports-gen { display: flex; align-items: center; gap: 0.4rem; margin-left: auto; }
.ansc-reports-gen select { width: auto; max-width: 16rem; }
.ansc-reports-list { display: flex; flex-direction: column; gap: 0.2rem; }
.ansc-report-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.25rem; border-radius: 0.3rem; font-size: 0.88rem; }
.ansc-report-row:hover { background: color-mix(in oklch, var(--theme-primary) 5%, transparent); }
.ansc-report-row i { color: var(--theme-offset); }
.ansc-report-name { font-weight: 500; }

/* Answer Story (PR1 Phase 2) - the per-workflow review tree (.ansc-story*) moved
   to UI.Runner.Components/wwwroot/runner.css so the shared AnswerStoryView RCL
   carries its own styling across Portal + Mobile + the proof packet. The Answer
   Center PAGE chrome above (.ansc-grid / .ansc-jobcard / .ansc-jobhead) and the
   proof-packet .ansc-print* rules below stay here - they are Portal-page only. */

/* Printable kit summary - a clean single-color report. */
.ansc-print {
    max-width: 8.5in;
    margin: 0.5in auto;
    padding: 0 0.5in;
    color: #222;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
.ansc-print-bar { margin-bottom: 1rem; }
.ansc-print-header { border-bottom: 2px solid #333; padding-bottom: 0.5rem; margin-bottom: 1rem; }
.ansc-print-header h1 { font-size: 1.4rem; margin: 0 0 0.2rem; }
.ansc-print-kit { font-size: 1.05rem; color: #444; margin-bottom: 0.3rem; }
.ansc-print-meta { display: flex; gap: 1.2rem; flex-wrap: wrap; color: #555; font-size: 0.85rem; }
.ansc-print-meta span { white-space: nowrap; }

.ansc-print-table { width: 100%; border-collapse: collapse; margin-bottom: 1.2rem; }
.ansc-print-table thead th {
    text-align: left;
    border-bottom: 1px solid #999;
    padding: 0.4rem 0.5rem;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #444;
    background: #f4f4f4;
}
.ansc-print-table tbody td {
    padding: 0.5rem;
    border-bottom: 1px solid #ddd;
    vertical-align: top;
    font-size: 0.92rem;
}
.ansc-print-num { font-variant-numeric: tabular-nums; color: #888; font-weight: 600; }
.ansc-print-status { padding: 0.1rem 0.5rem; border-radius: 0.3rem; font-size: 0.78rem; font-weight: 600; }
.ansc-print-status.is-complete { background: #d1e7dd; color: #0a3622; }
.ansc-print-status.is-pending { background: #fff3cd; color: #664d03; }

.ansc-print-footer { margin-top: 2rem; padding-top: 0.6rem; border-top: 1px solid #ddd; }
.ansc-print-genstamp { font-size: 0.75rem; color: #888; }

/* Job-report TOC + per-workflow story sections (2026-06-20). Print-page colors
   are intentionally fixed grays for monochrome proof-packet fidelity. */
/* The kit-level AI summary card on the proof-of-service packet (after the TOC). */
.ansc-print-aisummary {
    border: 1px solid var(--theme-border);
    border-left: 4px solid var(--theme-accent, var(--theme-primary));
    border-radius: .5rem;
    background: var(--theme-background-subtle);
    padding: .85rem 1rem;
    margin-bottom: 1.25rem;
}
.ansc-print-aisummary-text {
    white-space: pre-wrap;
    line-height: 1.45;
}
.ansc-print-aisummary-meta {
    margin-top: .4rem;
    font-size: .75rem;
    color: var(--theme-text-muted);
}
.ansc-print-toc {
    border: 1px solid #ddd; border-radius: 0.4rem;
    padding: 0.6rem 0.9rem; margin-bottom: 1.2rem; background: #fafafa;
}
.ansc-print-toc-title { font-weight: 700; color: #333; margin-bottom: 0.35rem; }
.ansc-print-toc ol { margin: 0; padding-left: 1.3rem; }
.ansc-print-toc li { margin: 0.15rem 0; }
.ansc-print-toc a { color: #0d6efd; text-decoration: none; }
.ansc-print-toc-meta { color: #888; font-size: 0.8rem; margin-left: 0.4rem; }

.ansc-print-section { margin-bottom: 1.4rem; }
.ansc-print-sectionhead {
    display: flex; align-items: center; gap: 0.6rem;
    background: #2c3440; color: #fff;
    padding: 0.5rem 0.8rem; border-radius: 0.4rem; margin-bottom: 0.7rem;
}
.ansc-print-sectionnum {
    background: rgba(255, 255, 255, 0.2); color: #fff;
    width: 1.6rem; height: 1.6rem; border-radius: 0.3rem; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem;
}
.ansc-print-sectiontitle { font-weight: 700; font-size: 1.02rem; }
.ansc-print-sectionmeta { margin-left: auto; font-size: 0.8rem; color: #cdd3db; white-space: nowrap; }
.ansc-print-nostory { color: #888; font-style: italic; padding: 0.5rem 0.2rem; }

@media print {
    /* Hide every chrome surface that isn't part of the report. */
    .wf-page-header, .ops-section-toggle, .ops-filters,
    .wf-sidebar, .wf-topnav, .wf-sidebar-mobilebar,
    .d-print-none, button:not(.ansc-print-table button) { display: none !important; }

    /* THE pagination fix ("Total: 1 sheet of paper" bug). The app shell pins page
       content inside a 100vh scroll container (#app -> .wf-shell -> .wf-main, the
       last with overflow-y:auto), so the browser printed only the visible viewport.
       Neutralize the whole height/overflow/flex chain in print so the report flows
       across as many pages as it needs. */
    html, body {
        height: auto !important; min-height: 0 !important;
        overflow: visible !important; background: white;
    }
    #app, .wf-shell, .wf-shell--side, .wf-shell--top, .wf-main, .wf-main > div {
        display: block !important;
        height: auto !important; min-height: 0 !important; max-height: none !important;
        overflow: visible !important;
        padding-top: 0 !important;   /* drop the mobile top-bar offset that clipped the first step */
    }

    /* Top padding bumps the first step down off the page edge (the brand bar is gone). */
    .ansc-print { margin: 0; padding: 0.3in 0 0 0; max-width: 100%; }
    .ansc-print-bar { display: none !important; }

    /* Keep the dark section bands (and INTERNAL badge) visible on paper. */
    .ansc-print-sectionhead {
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
        break-inside: avoid; break-after: avoid;
    }
    .ansc-print-section { break-inside: auto; }
    /* Avoid splitting a step card / TOC across a page boundary where possible. */
    .ansc-print-toc, .ansc-step, .ops-stepcard { break-inside: avoid; }
}

.ops-detail .ops-section h6 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--theme-text-secondary);
    margin: 0 0 0.6rem 0;
    font-weight: 700;
}

/* Key/value grid for the run header — readable labels, big values. */
.ops-kv {
    display: grid;
    grid-template-columns: 9rem 1fr;
    gap: 0.4rem 1rem;
    align-items: baseline;
}
.ops-kv dt { font-size: 0.78rem; color: var(--theme-text-secondary); font-weight: 600; }
.ops-kv dd { margin: 0; color: var(--theme-text-emphasis); font-size: 0.92rem; word-break: break-word; }
@media (max-width: 576px) {
    .ops-kv { grid-template-columns: 1fr; gap: 0.1rem 0; }
    .ops-kv dd { margin-bottom: 0.5rem; }
}

/* Each step is its own card (was a cramped table cell). Collapses to header-only. */
.ops-stepcard {
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius, 0.6rem);
    background: var(--theme-surface, #fff);
    margin-bottom: 0.5rem;
    overflow: hidden;
}
.ops-stepcard-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    border: 0;
    background: transparent;
    width: 100%;
    text-align: left;
}
.ops-stepcard-head:hover { background: color-mix(in oklch, var(--theme-primary) 5%, transparent); }
.ops-stepcard-head .ord { font-variant-numeric: tabular-nums; color: var(--theme-text-secondary); font-size: 0.8rem; min-width: 1.6rem; }
.ops-stepcard-head .kind { font-size: 0.72rem; padding: 0.1rem 0.45rem; border-radius: 0.25rem; background: color-mix(in oklch, var(--theme-text-emphasis) 8%, transparent); color: var(--theme-text-emphasis); font-weight: 600; }
.ops-stepcard-head .label { flex: 1; min-width: 0; font-weight: 600; color: var(--theme-text-emphasis); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ops-stepcard-head .dur { font-size: 0.76rem; color: var(--theme-text-secondary); white-space: nowrap; }
.ops-stepcard-head .chev { color: var(--theme-text-secondary); transition: transform .15s ease; }
.ops-stepcard-head.is-open .chev { transform: rotate(90deg); }
.ops-stepcard-body { padding: 0.6rem 0.9rem 0.9rem 0.9rem; border-top: 1px solid var(--theme-border); }
.ops-stepcard-body .ops-section { margin-bottom: 0.6rem; padding: 0.6rem 0.75rem; }
.ops-stepcard-body .ops-section:last-child { margin-bottom: 0; }

/* ── Workflow Designer list table ───────────────────────────────────────── */
.wf-table-wrap { overflow-x: auto; border: 1px solid var(--theme-border); border-radius: var(--theme-radius); background: var(--theme-surface); }
.wf-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.wf-table thead th {
    text-align: left; padding: 0.6rem 1rem; font-size: 0.72rem; font-weight: 700;
    letter-spacing: 0.05em; text-transform: uppercase; color: var(--theme-text-muted);
    border-bottom: 1px solid var(--theme-border); background: var(--theme-background-subtle);
}
.wf-table tbody td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--theme-border); vertical-align: middle; }
.wf-table tbody tr:hover { background: var(--theme-background-hover); }
.wf-table tbody tr:last-child td { border-bottom: none; }
.wf-c-id { width: 64px; color: var(--theme-text-muted); font-variant-numeric: tabular-nums; }
.wf-c-steps { width: 90px; }
.wf-c-status { width: 210px; }
.wf-c-actions { width: 150px; }

.wf-prompt { display: flex; align-items: flex-start; gap: 0.65rem; }
.wf-prompt-ico {
    flex-shrink: 0; width: 38px; height: 38px; border-radius: var(--theme-radius);
    display: flex; align-items: center; justify-content: center;
    background: var(--theme-accent-muted); color: var(--theme-accent);
}
.wf-prompt-name { font-weight: 600; color: var(--theme-text-emphasis); }
.wf-prompt-desc {
    font-size: 0.8rem; color: var(--theme-text-secondary); margin-top: 2px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.wf-prompt-meta { display: flex; align-items: center; gap: 0.5rem; margin-top: 4px; flex-wrap: wrap; }
.wf-prompt-internal { font-size: 0.7rem; color: var(--theme-text-muted); font-family: monospace; }
.wf-chip {
    display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.7rem;
    padding: 2px 8px; border-radius: 999px; background: var(--theme-info-muted); color: var(--theme-info);
}
.wf-chip i { font-size: 0.75rem; }

/* Membership chips — which KIT(s) carry this workflow, and their JOB SET(s).
   Links into the kit/set builders; hover lifts so they read as clickable. */
.wf-chip-kit { background: var(--theme-primary-muted); color: var(--theme-primary); text-decoration: none; }
.wf-chip-set { background: color-mix(in srgb, var(--theme-success) 15%, transparent); color: var(--theme-success); text-decoration: none; }
.wf-chip-kit:hover, .wf-chip-set:hover { filter: brightness(0.92); text-decoration: none; }

.wf-steps { display: inline-flex; align-items: center; color: var(--theme-text-secondary); font-variant-numeric: tabular-nums; }

.wf-status { display: inline-flex; align-items: center; font-size: 0.78rem; font-weight: 600; }
.wf-status-pub { color: var(--theme-success); }
.wf-status-draft { color: var(--theme-warning); }
.wf-status-none { color: var(--theme-text-muted); }
.wf-status-dates { font-size: 0.7rem; color: var(--theme-text-muted); margin-top: 3px; line-height: 1.4; }

.wf-actions { display: flex; align-items: center; gap: 0.35rem; }
.wf-act {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: var(--theme-radius);
    border: 1px solid var(--theme-border); background: var(--theme-surface);
    color: var(--theme-text-secondary); cursor: pointer; text-decoration: none;
    transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.wf-act:hover { border-color: var(--theme-primary); color: var(--theme-primary); background: color-mix(in oklch, var(--theme-primary) 6%, var(--theme-surface)); }
.wf-act-results:hover { border-color: var(--theme-success); color: var(--theme-success); background: color-mix(in oklch, var(--theme-success) 8%, var(--theme-surface)); }
.wf-act-badge {
    position: absolute; top: -7px; right: -7px; min-width: 18px; height: 18px; padding: 0 4px;
    border-radius: 999px; background: var(--theme-success); color: var(--theme-text-on-primary);
    font-size: 0.62rem; font-weight: 700; display: flex; align-items: center; justify-content: center; line-height: 1;
}

/* ─────────────────────────────────────────────────────────────────────────
   Report Center builder (Ops -> /report-center). Three-pane workbench:
   template library | the Compose band editor canvas | the data-source arsenal.
   Mirrors the Data Studio ReportBuilder layout language. All --theme-* tokens.
   ───────────────────────────────────────────────────────────────────────── */
.rc-shell {
    display: grid; grid-template-columns: 260px minmax(0, 1fr) 300px; gap: 1rem;
    align-items: start;
}
@media (max-width: 1100px) { .rc-shell { grid-template-columns: 1fr; } }

.rc-library, .rc-arsenal {
    background: var(--theme-surface); border: 1px solid var(--theme-border);
    border-radius: 12px; padding: 0.75rem; max-height: calc(100vh - 220px); overflow-y: auto;
}
.rc-library-head, .rc-arsenal-head, .rc-bands-head {
    font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em;
    color: var(--theme-text-muted); margin-bottom: 0.5rem;
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.rc-lib-item {
    width: 100%; text-align: left; border: 1px solid var(--theme-border); background: var(--theme-bg);
    border-radius: 9px; padding: 0.5rem 0.6rem; margin-bottom: 0.4rem; cursor: pointer;
    display: flex; flex-direction: column; gap: 0.3rem;
}
.rc-lib-item:hover { border-color: var(--theme-primary); }
.rc-lib-item.is-active { border-color: var(--theme-primary); box-shadow: 0 0 0 2px var(--theme-primary-soft, rgba(13,110,253,0.15)); }
.rc-lib-name { font-weight: 600; color: var(--theme-text); }
.rc-lib-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.rc-tag {
    font-size: 0.62rem; font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 999px;
    background: var(--theme-offset-soft, rgba(13,110,253,0.12)); color: var(--theme-offset);
}
.rc-tag-trigger { background: var(--theme-border); color: var(--theme-text-muted); }

.rc-canvas {
    background: var(--theme-surface); border: 1px solid var(--theme-border);
    border-radius: 12px; padding: 1rem; min-height: 320px;
}
.rc-canvas-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--theme-text-muted); text-align: center; gap: 0.5rem; }
.rc-empty-icon { font-size: 2.5rem; opacity: 0.4; }
.rc-empty { color: var(--theme-text-muted); font-size: 0.85rem; padding: 0.5rem 0; }

.rc-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }
.rc-name { max-width: 200px; }
.rc-sel { max-width: 190px; }
.rc-kit { max-width: 140px; }
.rc-toolbar-actions { display: flex; gap: 0.4rem; margin-left: auto; }

.rc-issues { margin-bottom: 0.6rem; }
.rc-issue { font-size: 0.82rem; padding: 0.35rem 0.55rem; border-radius: 7px; margin-bottom: 0.25rem; }
.rc-issue-error { background: var(--theme-danger-soft, rgba(220,53,69,0.12)); color: var(--theme-danger); }
.rc-issue-warning { background: var(--theme-warning-soft, rgba(255,193,7,0.14)); color: var(--theme-warning); }
.rc-status { font-size: 0.85rem; color: var(--theme-text-muted); margin-bottom: 0.6rem; }

.rc-bands { border-top: 1px solid var(--theme-border); padding-top: 0.6rem; }
.rc-addband { display: flex; gap: 0.35rem; align-items: center; }
.rc-band { border: 1px solid var(--theme-border); border-radius: 9px; padding: 0.55rem; margin: 0.5rem 0; background: var(--theme-bg); }
.rc-band-head { display: flex; align-items: center; justify-content: space-between; }
.rc-band-kind { font-weight: 700; font-size: 0.8rem; color: var(--theme-offset); text-transform: capitalize; }
.rc-band-ops .btn { padding: 0 0.3rem; }
.rc-band-note { font-size: 0.8rem; color: var(--theme-text-muted); font-style: italic; padding: 0.25rem 0; }
.rc-fields { margin-top: 0.4rem; display: flex; flex-direction: column; gap: 0.35rem; }
.rc-field-row { display: flex; gap: 0.35rem; align-items: center; }
.rc-flabel { max-width: 160px; }
.rc-fbind { flex: 1; font-family: var(--bs-font-monospace, monospace); font-size: 0.8rem; }

.rc-preview-row { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.85rem; border-top: 1px solid var(--theme-border); padding-top: 0.75rem; }
.rc-preview-hint { font-size: 0.78rem; color: var(--theme-text-muted); }

.rc-src-group { margin-bottom: 0.6rem; }
.rc-src-grouphead { font-weight: 600; font-size: 0.78rem; color: var(--theme-text); margin: 0.3rem 0; }
.rc-src-field {
    width: 100%; text-align: left; border: 1px solid var(--theme-border); background: var(--theme-bg);
    border-radius: 7px; padding: 0.3rem 0.45rem; margin-bottom: 0.2rem; cursor: pointer;
    display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; font-size: 0.8rem;
}
.rc-src-field:hover { border-color: var(--theme-primary); }
.rc-src-dt { font-size: 0.68rem; color: var(--theme-text-muted); }
.rc-copied { font-size: 0.78rem; padding: 0.35rem 0.5rem; margin-bottom: 0.5rem; border-radius: 7px;
    background: var(--theme-success-soft, rgba(25,135,84,0.12)); color: var(--theme-success); }
.rc-copied code { color: var(--theme-text); }

/* Source-workflow multi-select (drives the answer fields + enrichment suggestions). */
.rc-wf-pick { border: 1px solid var(--theme-border); border-radius: 7px; padding: 0.5rem; margin-bottom: 0.6rem; }
.rc-wf-hint { font-size: 0.72rem; color: var(--theme-text-muted); margin-bottom: 0.4rem; }
.rc-wf-check { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; padding: 0.15rem 0; cursor: pointer; }

/* Enrichment suggestions - actionable (copy the keyBind). */
.rc-enrich { border-left: 3px solid var(--theme-primary); }

/* Relationship reaches - informational (which related entities a source can reach). */
.rc-rel { border: 1px solid var(--theme-border); border-radius: 7px; padding: 0.4rem 0.5rem; margin-bottom: 0.35rem; }
.rc-rel-from { font-weight: 600; font-size: 0.78rem; color: var(--theme-text); margin-bottom: 0.2rem; }
.rc-reach { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem;
    font-size: 0.78rem; color: var(--theme-text-muted); padding: 0.12rem 0; }

/* The preview job picker grows to fill the row. */
.rc-jobpick { flex: 1 1 auto; min-width: 12rem; }

/* ─────────────────────────────────────────────────────────────────────────
   Report DESIGNER v2 (rcd-*) - the drag/drop WYSIWYG canvas over the same
   /report-center route. Library | the paper | the palette | the live preview.
   Pure-Blazor HTML5 DnD; tokens render as friendly chips (plumbing, not UX).
   ───────────────────────────────────────────────────────────────────────── */
.rcd-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .rcd-shell { grid-template-columns: 1fr; } }

.rcd-main { min-width: 0; }
.rcd-work { display: grid; grid-template-columns: minmax(0, 1fr) 270px minmax(260px, 24rem); gap: 0.85rem; align-items: start; }
.rcd-work:has(.rcd-preview.is-closed) { grid-template-columns: minmax(0, 1fr) 270px 2.4rem; }
@media (max-width: 1400px) { .rcd-work { grid-template-columns: minmax(0, 1fr) 250px; } .rcd-preview { grid-column: 1 / -1; } }

/* The paper - a letter-ish page the author drops onto. */
.rcd-canvas-scroll { max-height: calc(100vh - 260px); overflow-y: auto; min-width: 0; }
.rcd-paper {
    background: var(--theme-surface); border: 1px solid var(--theme-border); border-radius: 6px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07); padding: 1.4rem 1.6rem; min-height: 480px;
    max-width: 8.5in; margin: 0 auto;
}
.rcd-canvas-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--theme-text-muted); gap: 0.5rem; padding: 4rem 1rem; text-align: center; }
.rcd-canvas-empty i { font-size: 2rem; opacity: 0.4; }

/* Inter-band drop zones - invisible until a drag is live. */
.rcd-drop { height: 6px; border-radius: 4px; margin: 2px 0; transition: height 0.1s ease; }
.rcd-drop span { display: none; }
.rcd-drop.is-active { height: 22px; border: 1.5px dashed color-mix(in oklch, var(--theme-primary) 55%, transparent);
    background: color-mix(in oklch, var(--theme-primary) 6%, transparent);
    display: flex; align-items: center; justify-content: center; }
.rcd-drop.is-active span { display: inline; font-size: 0.68rem; color: var(--theme-primary); font-weight: 600; }
.rcd-drop.is-active.is-hover { background: color-mix(in oklch, var(--theme-primary) 16%, transparent); border-style: solid; }

/* A band on the paper. */
.rcd-band { border: 1px solid transparent; border-radius: 8px; padding: 0.15rem 0.35rem 0.35rem; cursor: pointer; }
.rcd-band:hover { border-color: var(--theme-border); }
.rcd-band.is-selected { border-color: var(--theme-primary); box-shadow: 0 0 0 2px color-mix(in oklch, var(--theme-primary) 18%, transparent); }
.rcd-band.is-hover { background: color-mix(in oklch, var(--theme-primary) 5%, transparent); }
.rcd-band-head { display: flex; align-items: center; gap: 0.4rem; cursor: grab; padding: 0.1rem 0; }
.rcd-band-head:active { cursor: grabbing; }
.rcd-band-ico { color: var(--theme-offset); font-size: 0.85rem; }
.rcd-band-title { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--theme-text-muted); }
.rcd-band-x { margin-left: auto; border: 0; background: none; color: var(--theme-text-muted); padding: 0 0.2rem; visibility: hidden; }
.rcd-band:hover .rcd-band-x, .rcd-band.is-selected .rcd-band-x { visibility: visible; }
.rcd-band-x:hover { color: var(--theme-danger); }
.rcd-align { display: inline-flex; gap: 1px; margin-left: 0.4rem; }
.rcd-align button { border: 1px solid var(--theme-border); background: var(--theme-bg); color: var(--theme-text-muted);
    padding: 0 0.3rem; font-size: 0.72rem; border-radius: 4px; line-height: 1.3; }
.rcd-align button.is-on { background: var(--theme-primary); border-color: var(--theme-primary); color: var(--theme-on-primary, #fff); }
.rcd-band-body { padding: 0.15rem 0.2rem; }
.rcd-al-center { text-align: center; }
.rcd-al-right { text-align: right; }

/* WYSIWYG field rows - label + a friendly VALUE CHIP (the token is a tooltip, never typed). */
.rcd-fields { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; }
.rcd-al-center .rcd-fields { justify-content: center; }
.rcd-al-right .rcd-fields { justify-content: flex-end; }
.rcd-field { display: flex; align-items: center; gap: 0.35rem; }
.rcd-field-labelro { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--theme-text-muted); }
.rcd-field-label { border: 1px solid var(--theme-border); border-radius: 5px; font-size: 0.75rem; padding: 0.1rem 0.3rem; max-width: 9.5rem; background: var(--theme-surface); color: var(--theme-text); }
.rcd-chip { display: inline-flex; align-items: center; background: color-mix(in oklch, var(--theme-primary) 11%, transparent);
    color: var(--theme-primary); border-radius: 5px; padding: 0.08rem 0.42rem; font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.rcd-agg { border: 1px solid var(--theme-border); border-radius: 5px; font-size: 0.72rem; padding: 0.08rem 0.2rem; background: var(--theme-surface); color: var(--theme-text); max-width: 11rem; }
.rcd-field-x { border: 0; background: none; color: var(--theme-text-muted); padding: 0; }
.rcd-field-x:hover { color: var(--theme-danger); }
.rcd-hint { font-size: 0.76rem; color: var(--theme-text-muted); font-style: italic; }
.rcd-note { font-size: 0.76rem; color: var(--theme-text-muted); }
.rcd-warnchip { font-size: 0.68rem; background: var(--theme-warning-soft, rgba(255,193,7,0.14)); color: var(--theme-warning); border-radius: 999px; padding: 0.06rem 0.45rem; }

.rcd-text { font-size: 0.88rem; color: var(--theme-text); line-height: 1.6; }
.rcd-story, .rcd-step, .rcd-imageband, .rcd-chart { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--theme-text); flex-wrap: wrap; }
.rcd-story i, .rcd-step i, .rcd-imageband i, .rcd-chart i { color: var(--theme-offset); }
.rcd-step-name { font-weight: 600; }
.rcd-curate { margin-top: 0.4rem; border-top: 1px dashed var(--theme-border); padding-top: 0.4rem; max-height: 13rem; overflow-y: auto; }
.rcd-curate-row { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; padding: 0.12rem 0; cursor: pointer; }
.rcd-curate-wf { margin-left: auto; font-size: 0.68rem; color: var(--theme-text-muted); }
.rcd-imgw { width: 4.2rem; border: 1px solid var(--theme-border); border-radius: 5px; font-size: 0.78rem; padding: 0.1rem 0.3rem; background: var(--theme-surface); color: var(--theme-text); }
.rcd-imgcap { max-width: 12rem; }

/* Chart color swatches (theme tokens + a custom hex picker). */
.rcd-swatches { display: inline-flex; align-items: center; gap: 0.25rem; }
.rcd-swatch { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--theme-surface); outline: 1px solid var(--theme-border); padding: 0; cursor: pointer; }
.rcd-swatch.is-on { outline: 2px solid var(--theme-text); }
.rcd-swatch-custom { width: 22px; height: 20px; border: 1px solid var(--theme-border); border-radius: 5px; padding: 0; background: var(--theme-surface); cursor: pointer; }
.rcd-swatch-custom.is-on { outline: 2px solid var(--theme-text); }

/* Table band - a data source + its column chips (views / reports / entities / the answer set). */
.rcd-tableband { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: var(--theme-text); }
.rcd-tableband-src { display: flex; align-items: center; gap: 0.4rem; }
.rcd-tableband-src i { color: var(--theme-offset); }
.rcd-tableband-name { font-weight: 600; }
.rcd-tablecols { display: flex; flex-wrap: wrap; gap: 0.3rem 0.55rem; }
.rcd-tablecol { display: inline-flex; align-items: center; gap: 0.25rem; border: 1px solid var(--theme-border); border-radius: 7px; padding: 0.12rem 0.4rem; background: color-mix(in oklch, var(--theme-primary) 4%, var(--theme-surface)); }
.rcd-tablecol-head { font-size: 0.78rem; font-weight: 600; }

/* Columns band - the L/C/R cells, each its own nested drop canvas. */
.rcd-cols { display: flex; gap: 0.6rem; align-items: stretch; }
.rcd-col { flex: 1; min-width: 0; border: 1px dashed var(--theme-border); border-radius: 7px; padding: 0.25rem; position: relative; }
.rcd-cell-x { position: absolute; top: 0.15rem; right: 0.15rem; border: 0; background: none; color: var(--theme-text-muted); padding: 0; }
.rcd-cell-add { border: 1px dashed var(--theme-border); background: none; color: var(--theme-text-muted); border-radius: 7px; padding: 0 0.5rem; }
.rcd-cell-add:hover, .rcd-cell-x:hover { color: var(--theme-primary); border-color: var(--theme-primary); }

.rcd-divider { border: 0; border-top: 1px solid var(--theme-border); margin: 0.3rem 0; }
.rcd-spacer { height: 14px; background: repeating-linear-gradient(45deg, transparent, transparent 5px, color-mix(in oklch, var(--theme-border) 55%, transparent) 5px, color-mix(in oklch, var(--theme-border) 55%, transparent) 6px); border-radius: 4px; }
.rcd-pagebreak { border-top: 2px dashed var(--theme-border); text-align: center; margin-top: 0.55rem; }
.rcd-pagebreak span { position: relative; top: -0.72rem; background: var(--theme-surface); padding: 0 0.5rem; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--theme-text-muted); }

/* The declared data-source chips under the paper. */
.rcd-sources-strip { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; max-width: 8.5in; margin: 0.5rem auto 0; }
.rcd-sources-title { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--theme-text-muted); }
.rcd-source-chip { display: inline-flex; align-items: center; gap: 0.15rem; font-size: 0.75rem; border: 1px solid var(--theme-border);
    border-radius: 999px; padding: 0.1rem 0.5rem; background: var(--theme-surface); color: var(--theme-text); }
.rcd-source-chip button { border: 0; background: none; color: var(--theme-text-muted); padding: 0 0 0 0.15rem; }
.rcd-source-chip button:hover { color: var(--theme-danger); }

/* The palette. */
.rcd-palette { background: var(--theme-surface); border: 1px solid var(--theme-border); border-radius: 12px;
    padding: 0.6rem; max-height: calc(100vh - 260px); overflow-y: auto; }
.rcd-pal-search { display: flex; align-items: center; gap: 0.35rem; margin-bottom: 0.55rem; }
.rcd-pal-search i { color: var(--theme-text-muted); }
.rcd-pal-group { margin-bottom: 0.65rem; }
.rcd-pal-head { font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em;
    color: var(--theme-text-muted); margin-bottom: 0.3rem; display: flex; align-items: center; gap: 0.3rem; }
.rcd-pal-toggle { border: 0; background: none; width: 100%; text-align: left; padding: 0.15rem 0; cursor: pointer; }
.rcd-pal-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.rcd-pal-chip { display: inline-flex; align-items: center; gap: 0.3rem; border: 1px solid var(--theme-border);
    background: var(--theme-bg); border-radius: 7px; padding: 0.22rem 0.5rem; font-size: 0.76rem; cursor: grab; color: var(--theme-text); }
.rcd-pal-chip:hover { border-color: var(--theme-primary); color: var(--theme-primary); }
.rcd-pal-chip i { color: var(--theme-offset); }
.rcd-pal-item { width: 100%; display: flex; align-items: center; gap: 0.4rem; border: 1px solid var(--theme-border);
    background: var(--theme-bg); border-radius: 7px; padding: 0.28rem 0.45rem; margin-bottom: 0.22rem;
    font-size: 0.8rem; cursor: grab; color: var(--theme-text); text-align: left; }
.rcd-pal-item:hover { border-color: var(--theme-primary); }
.rcd-pal-item i { color: var(--theme-offset); flex: 0 0 auto; }
.rcd-pal-item span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcd-pal-dt { margin-left: auto; font-size: 0.66rem; color: var(--theme-text-muted); flex: 0 0 auto; }
.rcd-enrich { border-left: 3px solid var(--theme-primary); cursor: pointer; }
.rcd-wf-pick { border: 1px solid var(--theme-border); border-radius: 7px; padding: 0.45rem; }

/* The LIVE PREVIEWER - the exact HTML the PDF prints, in a sandboxed iframe. */
.rcd-preview { background: var(--theme-surface); border: 1px solid var(--theme-border); border-radius: 12px;
    padding: 0.55rem; display: flex; flex-direction: column; gap: 0.45rem; max-height: calc(100vh - 260px); }
.rcd-preview.is-closed { padding: 0.35rem 0.25rem; align-items: center; }
.rcd-preview.is-closed .rcd-preview-title { writing-mode: vertical-rl; font-size: 0.7rem; }
.rcd-preview-head { display: flex; align-items: center; gap: 0.4rem; }
.rcd-preview.is-closed .rcd-preview-head { flex-direction: column; }
.rcd-preview-toggle { border: 0; background: none; color: var(--theme-text-muted); padding: 0 0.15rem; }
.rcd-preview-title { font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--theme-text-muted); }
.rcd-preview-auto { display: flex; align-items: center; gap: 0.25rem; font-size: 0.72rem; color: var(--theme-text-muted); margin-left: auto; cursor: pointer; }
.rcd-preview-job { width: 100%; }
.rcd-preview-hint { font-size: 0.78rem; color: var(--theme-text-muted); padding: 0.8rem 0.4rem; text-align: center; }
.rcd-preview-frame { width: 100%; flex: 1; min-height: 420px; border: 1px solid var(--theme-border); border-radius: 7px; background: #fff; }

/* FillTemplate canvas - the uploaded source PDF (PDF.js) with placements overlaid. */
.rcd-work-fill { grid-template-columns: minmax(0, 1fr) 270px; }
.rcd-fill-bar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.rcd-fill-upload { position: relative; overflow: hidden; }
.rcd-fill-upload input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.rcd-fill-job { width: auto; max-width: 22rem; flex: 1 1 auto; }
.rcd-fill-hint { color: var(--theme-text-muted); font-size: 0.85rem; padding: 1.2rem 0.5rem; text-align: center; }
.rcd-fill-inspector { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; border: 1px solid var(--theme-border);
    border-radius: 8px; padding: 0.4rem 0.55rem; margin-bottom: 0.5rem; background: var(--theme-surface); }
.rcd-fill-named { font-size: 0.72rem; color: var(--theme-success); background: var(--theme-success-soft, rgba(25,135,84,0.12));
    border-radius: 999px; padding: 0.1rem 0.5rem; }
.rcd-fill-pages { display: flex; flex-direction: column; gap: 0.9rem; align-items: center; }
.rcd-fill-pagewrap { position: relative; display: inline-block; box-shadow: 0 1px 6px rgba(0,0,0,0.12); border: 1px solid var(--theme-border); }
.rcd-fill-pagewrap canvas { display: block; }
.rcd-fill-widget { position: absolute; border: 1px dashed color-mix(in oklch, var(--theme-success, #198754) 65%, transparent);
    background: color-mix(in oklch, var(--theme-success, #198754) 7%, transparent); border-radius: 2px; }
.rcd-fill-pages.is-place .rcd-fill-widget { background: color-mix(in oklch, var(--theme-success, #198754) 18%, transparent); }
.rcd-fill-place { position: absolute; display: flex; align-items: center; overflow: hidden; cursor: grab;
    border: 1.5px solid var(--theme-primary); background: color-mix(in oklch, var(--theme-primary) 12%, transparent);
    border-radius: 3px; font-size: 10px; color: var(--theme-primary); font-weight: 600; padding: 0 3px; white-space: nowrap; }
.rcd-fill-place:active { cursor: grabbing; }
.rcd-fill-place.is-selected { border-color: var(--theme-offset); box-shadow: 0 0 0 2px color-mix(in oklch, var(--theme-offset) 30%, transparent); }
.rcd-fill-t-signature { border-style: dashed; }
.rcd-fill-t-image { border-style: dotted; }
/* During drags the drop target must be the PAGE (wrapper-relative offsets): chips let events
   through; widgets stay live only while PLACING a palette field (the named-fill snap). */
.rcd-fill-pages.is-place .rcd-fill-place, .rcd-fill-pages.is-move .rcd-fill-place { pointer-events: none; }
.rcd-fill-pages.is-move .rcd-fill-widget { pointer-events: none; }
