/* ==========================================================================
   Downstream workspace extracted from downstream.ejs
   ========================================================================== */

.module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #edf2f7;
}
.downstream-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 4px 0 18px;
    margin-bottom: 14px;
    border-bottom: 1px solid #dbe4f0;
}
.downstream-kicker {
    display: inline-flex;
    margin-bottom: 7px;
    color: #556274;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.075em;
    text-transform: uppercase;
}
.downstream-hero h2 {
    margin: 0 0 7px;
    color: #1f2a37;
    font-size: 1.55rem;
    line-height: 1.2;
    text-wrap: balance;
}
.downstream-hero p {
    max-width: 72ch;
    margin: 0;
    color: #556274;
    font-size: 0.94rem;
    line-height: 1.55;
    text-wrap: pretty;
}
.downstream-hero-meta {
    display: grid;
    gap: 4px;
    min-width: 230px;
    padding: 11px 13px;
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    background: #f9fbfe;
}
.downstream-hero-meta strong {
    color: #1f2937;
    overflow-wrap: anywhere;
    line-height: 1.25;
}
.downstream-hero-meta span {
    color: #556274;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
}
.downstream-analysis-card {
    display: grid;
    grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
    gap: 0;
    margin: 0 0 12px;
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    background: #f9fbfe;
    overflow: hidden;
}
.downstream-analysis-card > div {
    display: grid;
    grid-template-columns: minmax(96px, auto) minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 10px 13px;
}
.downstream-analysis-card > div + div {
    border-left: 1px solid #dbe4f0;
}
.downstream-context-panel {
    display: grid;
    gap: 12px;
    margin: 12px 0 0;
    padding: 14px;
    border: 1px solid #dbe4f0;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(31, 42, 55, 0.045);
}
.downstream-analysis-card span,
.downstream-overview span,
.downstream-readiness-panel span {
    display: block;
    color: #556274;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}
.downstream-analysis-card strong,
.downstream-analysis-card code {
    color: #1f2937;
    overflow-wrap: anywhere;
}
.downstream-overview {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}
.downstream-overview div,
.downstream-readiness-panel div {
    padding: 0;
}
.downstream-overview div {
    display: grid;
    gap: 4px;
    align-content: center;
    min-height: 64px;
    padding: 10px 12px;
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    background: #f9fbfe;
}
.downstream-overview strong {
    display: inline-block;
    margin: 0;
    color: #1f2937;
    font-size: 1.2rem;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.downstream-readiness-panel {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    background: #f8fafc;
    overflow: hidden;
}
.downstream-readiness-panel div {
    min-height: 70px;
    padding: 11px 13px;
}
.downstream-readiness-panel div + div {
    border-left: 1px solid #e8eef6;
}
.downstream-readiness-panel strong {
    display: block;
    margin-top: 5px;
    color: #475569;
    font-size: 0.8rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.downstream-readiness-panel .readiness-ok {
    color: #166534;
}
.downstream-readiness-panel .readiness-warn {
    color: #9a3412;
}
.downstream-readiness-panel .readiness-err {
    color: #b91c1c;
}
.downstream-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin: 0;
}
.downstream-run-plan {
    display: grid;
    gap: 12px;
    margin: 14px 0 0;
    padding: 16px;
    border: 1px solid #dbe4f0;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(31, 42, 55, 0.045);
}
.downstream-run-plan-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
}
.downstream-run-plan-copy {
    display: grid;
    gap: 6px;
    min-width: 0;
}
.downstream-run-plan-copy span,
.downstream-run-plan-card span {
    color: #357abd;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.downstream-run-plan-copy strong {
    color: #1f2a37;
    font-size: 1rem;
    line-height: 1.3;
    text-wrap: balance;
}
.downstream-run-plan-copy p {
    max-width: 760px;
    margin: 0;
    color: #556274;
    font-size: 0.84rem;
    line-height: 1.55;
    text-wrap: pretty;
}
.downstream-run-plan-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 176px;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: 999px;
    color: #ffffff;
    background: #1f2a37;
    box-shadow: 0 10px 20px rgba(31, 42, 55, 0.14);
    font-size: 0.86rem;
    font-weight: 800;
    cursor: pointer;
    transition-property: transform, box-shadow, background-color, opacity;
    transition-duration: 180ms;
    transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.downstream-run-plan-action[data-plan-state="good"] {
    background: #245a8d;
    box-shadow: 0 10px 20px rgba(74, 144, 226, 0.16);
}
.downstream-run-plan-action[data-plan-state="warning"] {
    color: #7c2d12;
    background: #ffedd5;
    box-shadow: inset 0 0 0 1px #fed7aa;
}
.downstream-run-plan-action[data-plan-state="error"] {
    color: #991b1b;
    background: #fee2e2;
    box-shadow: inset 0 0 0 1px #fecaca;
}
.downstream-run-plan-action[data-plan-state="running"] {
    color: #1d4ed8;
    background: #dbeafe;
    box-shadow: inset 0 0 0 1px #bfdbfe;
}
.downstream-run-plan-action:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(31, 42, 55, 0.16);
}
.downstream-run-plan-action:focus-visible {
    outline: 3px solid rgba(74, 144, 226, 0.28);
    outline-offset: 2px;
}
.downstream-run-plan-action:active {
    transform: scale(0.96);
}
.downstream-run-plan-action:disabled {
    cursor: not-allowed;
    opacity: 0.76;
    transform: none;
}
.downstream-run-plan-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
}
.downstream-run-plan-card {
    display: grid;
    gap: 5px;
    align-content: start;
    min-height: 102px;
    min-width: 0;
    padding: 12px 13px;
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    background: #fbfdff;
    color: #1f2a37;
    font: inherit;
    text-align: left;
    transition-property: transform, border-color, background-color, box-shadow, color;
    transition-duration: 180ms;
    transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
button.downstream-run-plan-card {
    cursor: pointer;
}
button.downstream-run-plan-card:hover,
button.downstream-run-plan-card:focus-visible {
    border-color: #bfd3ed;
    background: #f4f9ff;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(31, 42, 55, 0.075);
}
button.downstream-run-plan-card:focus-visible {
    outline: 3px solid rgba(74, 144, 226, 0.24);
    outline-offset: 2px;
}
button.downstream-run-plan-card:active {
    transform: scale(0.96);
}
button.downstream-run-plan-card:disabled {
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.downstream-run-plan-card strong {
    color: #1f2a37;
    font-size: 0.94rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
    text-wrap: balance;
}
.downstream-run-plan-card small {
    color: #556274;
    font-size: 0.77rem;
    line-height: 1.42;
    text-wrap: pretty;
}
.downstream-run-plan-card[data-plan-state="good"] {
    border-color: #bbf7d0;
    background: #f0fdf4;
}
.downstream-run-plan-card[data-plan-state="good"] span,
.downstream-run-plan-card[data-plan-state="good"] strong {
    color: #166534;
}
.downstream-run-plan-card[data-plan-state="warning"] {
    border-color: #fed7aa;
    background: #fff7ed;
}
.downstream-run-plan-card[data-plan-state="warning"] span,
.downstream-run-plan-card[data-plan-state="warning"] strong {
    color: #9a3412;
}
.downstream-run-plan-card[data-plan-state="error"] {
    border-color: #fecaca;
    background: #fef2f2;
}
.downstream-run-plan-card[data-plan-state="error"] span,
.downstream-run-plan-card[data-plan-state="error"] strong {
    color: #991b1b;
}
.downstream-run-plan-card[data-plan-state="running"] {
    border-color: #bfdbfe;
    background: #eff6ff;
}
.downstream-run-plan-card[data-plan-state="running"] span,
.downstream-run-plan-card[data-plan-state="running"] strong {
    color: #1d4ed8;
}
.downstream-run-plan-card[data-plan-state="muted"] {
    background: #f8fafc;
}
.downstream-decision-guide {
    display: grid;
    grid-template-columns: minmax(190px, 0.28fr) minmax(0, 0.72fr);
    gap: 16px;
    margin: 16px 0 0;
    padding: 16px;
    border: 1px solid #dbe4f0;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(31, 42, 55, 0.045);
}
.downstream-decision-heading {
    display: grid;
    gap: 6px;
    align-content: start;
}
.downstream-decision-heading span {
    color: #357abd;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.downstream-decision-heading strong {
    color: #1f2a37;
    font-size: 1rem;
    line-height: 1.3;
    text-wrap: balance;
}
.downstream-decision-heading p {
    max-width: 36ch;
    margin: 0;
    color: #556274;
    font-size: 0.84rem;
    line-height: 1.55;
    text-wrap: pretty;
}
.downstream-decision-list {
    display: grid;
    gap: 8px;
}
.downstream-decision-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) minmax(190px, auto);
    gap: 12px;
    align-items: center;
    min-height: 56px;
    padding: 9px 11px;
    border: 1px solid #e2e8f0;
    border-radius: 13px;
    background: #fbfdff;
    color: #1f2a37;
    text-align: left;
    cursor: pointer;
    transition-property: transform, border-color, background-color, box-shadow, color;
    transition-duration: 180ms;
    transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.downstream-decision-row:hover,
.downstream-decision-row:focus-visible {
    border-color: #bfd3ed;
    background: #f4f9ff;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(31, 42, 55, 0.075);
}
.downstream-decision-row:focus-visible {
    outline: 3px solid rgba(74, 144, 226, 0.24);
    outline-offset: 2px;
}
.downstream-decision-row:active {
    transform: scale(0.96);
}
.downstream-decision-step {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid #dbe4f0;
    border-radius: 999px;
    background: #eef6ff;
    color: #245a8d;
    font-size: 0.78rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.downstream-decision-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}
.downstream-decision-copy strong {
    color: #1f2a37;
    font-size: 0.88rem;
    line-height: 1.3;
    text-wrap: pretty;
}
.downstream-decision-copy small {
    color: #64748b;
    font-size: 0.76rem;
    line-height: 1.35;
}
.downstream-decision-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}
.downstream-decision-chips span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 8px;
    border: 1px solid #dbe4f0;
    border-radius: 999px;
    background: #ffffff;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}
.downstream-decision-row[data-module-state="running"] {
    border-color: #fdba74;
    background: #fff7ed;
}
.downstream-decision-row[data-module-state="running"] .downstream-decision-step {
    border-color: #fdba74;
    background: #ffedd5;
    color: #9a3412;
}
.downstream-decision-row[data-module-state="done"] {
    border-color: #86efac;
    background: #f0fdf4;
}
.downstream-decision-row[data-module-state="done"] .downstream-decision-step {
    border-color: #86efac;
    background: #dcfce7;
    color: #166534;
}
.downstream-decision-row[data-module-state="error"] {
    border-color: #fca5a5;
    background: #fef2f2;
}
.downstream-decision-row[data-module-state="error"] .downstream-decision-step {
    border-color: #fca5a5;
    background: #fee2e2;
    color: #b91c1c;
}
.downstream-decision-row[data-module-state="blocked"] {
    background: #f8fafc;
    color: #64748b;
}
.downstream-module-map {
    position: sticky;
    top: 10px;
    z-index: 8;
    display: flex;
    gap: 8px;
    margin: 14px 0 0;
    padding: 8px;
    border: 1px solid #dbe4f0;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 24px rgba(31, 42, 55, 0.07);
    overflow-x: auto;
    scrollbar-width: thin;
}
.downstream-module-nav {
    position: relative;
    display: grid;
    gap: 4px;
    flex: 1 0 146px;
    min-height: 62px;
    padding: 9px 28px 9px 11px;
    text-align: left;
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    background: #fbfdff;
    box-shadow: none;
    cursor: pointer;
    transition-property: transform, box-shadow, border-color, background-color, color;
    transition-duration: 180ms;
    transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.downstream-module-nav::before {
    content: "";
    position: absolute;
    top: 12px;
    right: 12px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #94a3b8;
    box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.14);
}
.downstream-module-nav:hover,
.downstream-module-nav:focus-visible {
    transform: translateY(-1px);
    border-color: #bfd3ed;
    box-shadow: 0 8px 18px rgba(31, 42, 55, 0.07);
}
.downstream-module-nav:focus-visible {
    outline: 3px solid rgba(74, 144, 226, 0.26);
    outline-offset: 2px;
}
.downstream-module-nav:active {
    transform: scale(0.96);
}
.downstream-module-nav span {
    display: block;
    padding-right: 16px;
    color: #556274;
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.055em;
    line-height: 1.2;
    text-transform: uppercase;
}
.downstream-module-nav strong {
    display: block;
    padding-right: 16px;
    color: #1f2a37;
    font-size: 0.84rem;
    line-height: 1.25;
    text-wrap: balance;
}
.downstream-module-nav small {
    display: block;
    color: #64748b;
    font-size: 0.7rem;
    line-height: 1.35;
    text-wrap: pretty;
}
.downstream-module-nav[data-module-state="running"] {
    border-color: #fdba74;
    background: #fff7ed;
}
.downstream-module-nav[data-module-state="running"]::before {
    background: #f97316;
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.16);
}
.downstream-module-nav[data-module-state="done"] {
    border-color: #86efac;
    background: #f0fdf4;
}
.downstream-module-nav[data-module-state="done"]::before {
    background: #16a34a;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.14);
}
.downstream-module-nav[data-module-state="error"] {
    border-color: #fca5a5;
    background: #fef2f2;
}
.downstream-module-nav[data-module-state="error"]::before {
    background: #dc2626;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.14);
}
.downstream-module-nav[data-module-state="blocked"] {
    border-color: #e2e8f0;
    background: #f8fafc;
}
.downstream-module-nav[data-module-state="blocked"]::before {
    background: #94a3b8;
}
.downstream-status-message {
    position: relative;
    min-height: 42px;
    margin: 0;
    padding: 10px 12px 10px 32px;
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    background: #f9fbfe;
    color: #334155;
    font-size: 0.9rem;
    line-height: 1.45;
}
.downstream-status-message::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 13px;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #357abd;
    box-shadow: 0 0 0 6px rgba(74, 144, 226, 0.12);
    transform: translateY(-50%);
}
.downstream-status-message.status-ok {
    border-color: #cae8d4;
    background: #f5fbf7;
    color: #166534;
}
.downstream-status-message.status-ok::before {
    background: #16a34a;
    box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.12);
}
.downstream-status-message.status-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}
.downstream-status-message.status-error::before {
    background: #dc2626;
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.12);
}
.downstream-empty-state {
    padding: 14px 15px;
    border: 1px solid #dbe4f0;
    border-radius: 16px;
    background: #f9fbfe;
    color: #556274;
    line-height: 1.55;
    text-wrap: pretty;
}
.downstream-module-card {
    margin-top: 18px !important;
    margin-bottom: 18px !important;
    border: 1px solid #dbe4f0;
    border-radius: 18px;
    box-shadow: 0 8px 22px rgba(31, 42, 55, 0.045);
    transition-property: box-shadow, background-color, border-color;
    transition-duration: 180ms;
    transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.downstream-module-card:hover {
    box-shadow: 0 10px 26px rgba(31, 42, 55, 0.055);
}
.downstream-module-card.is-running {
    border-color: #fdba74;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.16), 0 10px 26px rgba(31, 42, 55, 0.055);
}
.downstream-module-card.is-done {
    border-color: #86efac;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.14), 0 10px 26px rgba(31, 42, 55, 0.055);
}
.downstream-module-card.is-error {
    border-color: #fca5a5;
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.16), 0 10px 26px rgba(31, 42, 55, 0.055);
}
.downstream-module-card.is-highlighted {
    animation: downstreamModuleHighlight 1250ms cubic-bezier(0.2, 0, 0, 1);
}
@keyframes downstreamModuleHighlight {
    0% {
        transform: translateY(-2px);
        box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.24), 0 18px 38px rgba(31, 42, 55, 0.1);
    }
    65% {
        transform: translateY(0);
        box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.14), 0 14px 34px rgba(31, 42, 55, 0.08);
    }
    100% {
        transform: translateY(0);
        box-shadow: 0 10px 28px rgba(31, 42, 55, 0.06);
    }
}
.module-state {
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 4px 10px;
    border: 1px solid #d1d5db;
    color: #374151;
    background: #f9fafb;
    white-space: nowrap;
}
.module-state.running {
    background: #fff7ed;
    border-color: #fdba74;
    color: #9a3412;
}
.module-state.done {
    background: #ecfdf5;
    border-color: #86efac;
    color: #166534;
}
.module-state.error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #b91c1c;
}
.requirements-list {
    margin: 8px 0 10px 0;
    padding-left: 18px;
    color: #374151;
    font-size: 0.9rem;
}
.plots-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.dea-plot-section {
    width: min(100%, 980px);
    margin: 0;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}
.dea-plot-title {
    font-weight: 600;
    margin: 4px 0 8px;
    color: #111827;
}
.dea-plot-legend {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.legend-row { display: flex; align-items: center; gap: 8px; }
.legend-label { font-size: 13px; color: #374151; }
.legend-gradient {
    width: 180px;
    height: 10px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
}
.legend-gradient-reds {
    background: linear-gradient(to right,
        #fff5f0, #fee0d2, #fcbba1, #fc9272,
        #fb6a4a, #ef3b2c, #cb181d, #99000d
    );
}
.legend-gradient-diverging {
    background: linear-gradient(to right,
        #313695, #7aa6d9, #c5d9f2, #ffffff,
        #f0b0a8, #de6e68, #a50026
    );
}
.legend-gradient-blues {
    background: linear-gradient(to right,
        #eff6ff, #dbeafe, #bfdbfe, #93c5fd,
        #60a5fa, #3b82f6, #2563eb, #1d4ed8
    );
}
.legend-gradient-scale-viridis {
    background: linear-gradient(to right,
        #440154, #472c7a, #3b528b, #2c728e,
        #21918c, #28ae80, #5ec962, #9bd93c, #dce319
    );
}
.legend-gradient-scale-plasma {
    background: linear-gradient(to right,
        #0d0887, #5b02a3, #9a179b, #cb4679,
        #ed7953, #fb9f3a, #fdca26, #f0f921
    );
}
.legend-gradient-scale-cividis {
    background: linear-gradient(to right,
        #00224e, #2c2e66, #51446f, #72605f,
        #8e7b4a, #a89832, #c1b80e, #d8de00
    );
}
.legend-gradient-scale-blues {
    background: linear-gradient(to right,
        #f7fbff, #deebf7, #c6dbef, #9ecae1,
        #6baed6, #4292c6, #2171b5, #08519c, #08306b
    );
}
.legend-gradient-scale-reds {
    background: linear-gradient(to right,
        #fff5f0, #fee0d2, #fcbba1, #fc9272,
        #fb6a4a, #ef3b2c, #cb181d, #99000d, #67000d
    );
}
.legend-gradient-scale-rdbu {
    background: linear-gradient(to right,
        #67001f, #b2182b, #d6604d, #f4a582,
        #fddbc7, #e0e0e0, #bababa, #92c5de, #4393c3, #2166ac
    );
}
.size-legend { display: flex; align-items: center; gap: 12px; }
.size-dot { display: inline-block; border-radius: 50%; background: #6b7280; opacity: 0.6; border: 1px solid #4b5563; }
.size-dot-sm { width: 6px; height: 6px; }
.size-dot-md { width: 10px; height: 10px; }
.size-dot-lg { width: 14px; height: 14px; }
.downstream-artifact-frame {
    width: 100%;
    height: clamp(420px, 62vh, 540px);
    border: none;
    margin-top: 10px;
}
.downstream-artifact-frame.frame-cellchat {
    height: clamp(460px, 68vh, 600px);
}
.downstream-artifact-frame.frame-cellchat-heatmap {
    height: clamp(460px, 68vh, 600px);
}
.downstream-artifact-frame.frame-trajectory {
    height: clamp(420px, 62vh, 540px);
}
.downstream-artifact-frame.frame-velocity {
    height: clamp(460px, 68vh, 600px);
}
.downstream-artifact-frame.frame-trajectory-cluster {
    height: clamp(460px, 68vh, 600px);
}
.downstream-artifact-frame.frame-scenic-post {
    height: clamp(430px, 64vh, 560px);
}
.downstream-artifact-frame.frame-scenic-post-mean {
    height: clamp(340px, 48vh, 420px);
}
.downstream-artifact-frame.frame-scenic-post-compact {
    height: clamp(360px, 54vh, 460px);
}
.downstream-artifact-image {
    width: 100%;
    max-height: 580px;
    object-fit: contain;
    display: block;
    margin-top: 10px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    background: #fff;
}
.downstream-artifact-image.img-velocity {
    max-height: 620px;
}
.plot-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 5px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-color, #374151);
    background: var(--card-bg, #f9fafb);
    border: 1px solid var(--border-color, #d1d5db);
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.plot-download-btn:hover {
    background: var(--hover-bg, #e5e7eb);
    border-color: var(--accent-color, #9ca3af);
    text-decoration: none;
}
.plot-download-btn i { font-size: 0.75rem; }
.downstream-loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    place-items: center;
    background: rgba(15, 23, 42, 0.64);
    z-index: 100;
}
.downstream-loading-panel {
    padding: 24px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.36);
}
.downstream-loading-content {
    display: grid;
    gap: 12px;
    justify-items: center;
    color: #f8fbff;
    font-size: 1rem;
    font-weight: 750;
    text-align: center;
}
.downstream-loading-content img {
    display: block;
    width: 54px;
    height: 54px;
    margin: auto;
}
.downstream-module-title {
    margin: 0;
}
body.downstream-page .downstream-module-card > p {
    max-width: 76ch;
    margin: 0 0 10px;
    color: #556274;
    font-size: 0.92rem;
    line-height: 1.55;
    text-wrap: pretty;
}
body.downstream-page .downstream-module-card .params-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    align-items: end;
    margin-top: 12px;
}
body.downstream-page .downstream-module-card .input-group {
    min-width: 0;
    margin: 0;
}
body.downstream-page .downstream-module-card .upload-btn {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    min-width: 0;
}
body.downstream-page .downstream-module-card .run-btn {
    min-height: 40px;
    min-width: 96px;
}
body.downstream-page .table-copy {
    min-height: 40px;
    padding: 8px 12px;
    cursor: pointer;
    transition-duration: 160ms;
    transition-property: background-color, border-color, color, transform;
    transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}
body.downstream-page .table-copy:active {
    transform: scale(0.96);
}
.downstream-help-heading {
    color: #374151;
    font-size: 1.2rem;
    margin-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
}
.downstream-preview-empty {
    margin: 8px 0;
    color: #6b7280;
}
.downstream-metric-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0 10px;
    flex-wrap: wrap;
}
.downstream-metric-switch label {
    font-size: 13px;
    color: #374151;
    font-weight: 500;
}
.downstream-metric-switch select {
    width: auto;
    min-width: 260px;
    max-width: 100%;
    margin: 0;
    padding: 6px 10px;
    font-size: 13px;
}
.module-gated[hidden] {
    display: none;
}
.module-gated:not([hidden]) {
    display: block;
}
.subtle-note {
    margin: 4px 0 10px 0;
    color: #6b7280;
    font-size: 0.82rem;
}
.module-error-card {
    width: min(100%, 980px);
    margin: 0;
    padding: 12px 14px;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    background: #fff1f2;
}
.module-error-title {
    font-weight: 600;
    color: #9f1239;
    margin-bottom: 6px;
}
.module-error-text {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    line-height: 1.45;
    color: #881337;
    white-space: pre-wrap;
    word-break: break-word;
}
@media (max-width: 768px) {
    .downstream-hero,
    .downstream-readiness-panel,
    .downstream-analysis-card > div {
        grid-template-columns: 1fr;
    }
    .downstream-context-panel {
        padding: 12px;
        border-radius: 16px;
    }
    .downstream-overview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .downstream-hero {
        align-items: stretch;
    }
    .downstream-hero-meta {
        display: none;
    }
    .downstream-analysis-card {
        grid-template-columns: 1fr;
    }
    .downstream-readiness-panel {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        border: 0;
        background: transparent;
        overflow: visible;
    }
    .downstream-readiness-panel div {
        min-height: 64px;
        border: 1px solid #e8eef6;
        border-radius: 14px;
        background: #f8fafc;
    }
    .downstream-analysis-card > div + div {
        border-left: 0;
        border-top: 1px solid #e8eef6;
    }
    .downstream-readiness-panel div + div {
        border-top: 1px solid #e8eef6;
        border-left: 1px solid #e8eef6;
    }
    .module-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .module-state {
        align-self: flex-start;
    }
    .downstream-module-map {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        top: 0;
        gap: 7px;
        margin-inline: 0;
        border-radius: 14px;
        overflow: visible;
    }
    .downstream-run-plan,
    .downstream-run-plan-header,
    .downstream-run-plan-grid {
        grid-template-columns: 1fr;
    }
    .downstream-run-plan-action {
        width: 100%;
    }
    .downstream-run-plan-copy p {
        max-width: none;
    }
    .downstream-run-plan-card {
        min-height: 92px;
    }
    .downstream-decision-guide,
    .downstream-decision-row {
        grid-template-columns: 1fr;
    }
    .downstream-decision-heading p {
        max-width: none;
    }
    .downstream-decision-step {
        width: 40px;
        height: 40px;
    }
    .downstream-decision-chips {
        justify-content: flex-start;
    }
    .downstream-module-nav {
        width: 100%;
        min-width: 0;
        flex: initial;
        min-height: 62px;
    }
    .downstream-action-row,
    body.downstream-page .downstream-module-card .upload-btn {
        align-items: stretch;
        justify-content: stretch;
    }
    .downstream-action-row .table-action,
    .downstream-action-row .table-action-link,
    body.downstream-page .downstream-module-card .run-btn {
        width: 100%;
    }
    .plots-container {
        align-items: stretch;
    }
    .dea-plot-section,
    .module-error-card {
        width: 100%;
        padding: 10px 12px;
    }
    .dea-plot-legend,
    .size-legend {
        align-items: flex-start;
        gap: 10px;
    }
    .legend-gradient {
        width: 150px;
        max-width: 100%;
    }
    .requirements-list {
        font-size: 0.85rem;
        padding-left: 16px;
    }
    .downstream-metric-switch {
        flex-direction: column;
        align-items: stretch;
    }
    .downstream-metric-switch label {
        width: 100%;
    }
    .downstream-metric-switch select {
        width: 100%;
        min-width: 0;
    }
    .plots-container iframe.downstream-artifact-frame,
    .downstream-artifact-frame,
    .downstream-artifact-frame.frame-cellchat,
    .downstream-artifact-frame.frame-cellchat-heatmap,
    .downstream-artifact-frame.frame-trajectory,
    .downstream-artifact-frame.frame-velocity,
    .downstream-artifact-frame.frame-trajectory-cluster,
    .downstream-artifact-frame.frame-scenic-post,
    .downstream-artifact-frame.frame-scenic-post-mean,
    .downstream-artifact-frame.frame-scenic-post-compact {
        height: min(62vh, 440px) !important;
        min-height: 280px !important;
    }
    .downstream-artifact-image,
    .downstream-artifact-image.img-velocity {
        max-height: none;
    }
    .plot-download-btn {
        width: 100%;
        justify-content: center;
    }
}
@media (max-width: 480px) {
    .downstream-module-map {
        padding: 7px;
    }
    .downstream-overview {
        grid-template-columns: 1fr;
    }
    .dea-plot-title {
        font-size: 0.95rem;
    }
    .legend-label,
    .downstream-metric-switch label,
    .downstream-metric-switch select {
        font-size: 12px;
    }
    .plots-container iframe.downstream-artifact-frame,
    .downstream-artifact-frame,
    .downstream-artifact-frame.frame-cellchat,
    .downstream-artifact-frame.frame-cellchat-heatmap,
    .downstream-artifact-frame.frame-trajectory,
    .downstream-artifact-frame.frame-velocity,
    .downstream-artifact-frame.frame-trajectory-cluster,
    .downstream-artifact-frame.frame-scenic-post,
    .downstream-artifact-frame.frame-scenic-post-mean,
    .downstream-artifact-frame.frame-scenic-post-compact {
        height: min(56vh, 360px) !important;
        min-height: 240px !important;
    }
    .module-error-text {
        font-size: 11px;
    }
}
@media (max-width: 380px) {
    .downstream-module-map {
        grid-template-columns: 1fr;
    }
}
@media (prefers-reduced-motion: reduce) {
    .downstream-module-card.is-highlighted {
        animation: none;
        box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2), 0 10px 28px rgba(31, 42, 55, 0.06);
    }
}
