:root {
    --primary-color: #275EFE; /* Modern Blue from Loader */
    --primary-hover: #1b49d1;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --bg-color: #f8fafc; /* Slate-50 - cleaner background */
    --card-bg: #ffffff;
    --text-color: #0f172a; /* Slate-900 - sharper text */
    --border-color: #e2e8f0; /* Slate-200 */
    --input-bg: #f1f5f9; /* Slate-100 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
}

html {
    box-sizing: border-box;
    overflow-x: hidden;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

body {
    font-family: 'Nunito', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased; /* Smoother fonts */
    overflow-x: hidden;
}

/* ZhangBioLab Logo - Apple Style Gradient */
.zhang-lab-logo {
    position: absolute;
    top: 30px;
    left: 40px;
    text-decoration: none;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: opacity 0.3s ease;
}

.logo-text {
    font-size: 28px; /* Larger font size */
    font-weight: 800; /* Extra bold */
    font-family: 'Nunito', sans-serif;
    letter-spacing: -0.03em;
    
    /* Apple-style gradient text */
    color: #1d1d1f; /* Fallback */
    background: linear-gradient(135deg, #1d1d1f 30%, #434344 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.zhang-lab-logo::before {
    content: '';
    display: block;
    width: 16px; /* Larger icon */
    height: 16px;
    /* Gradient icon matching Apple Blue */
    background: linear-gradient(135deg, #0071e3, #00c6fb);
    border-radius: 4px; /* Softer radius */
    transform: rotate(45deg);
    box-shadow: 0 2px 8px rgba(0, 113, 227, 0.3);
}

.zhang-lab-logo:hover {
    opacity: 0.8; /* Subtle fade on hover like Apple links */
}

/* Highlighted 'B' with tech blue gradient */
.zhang-lab-logo .bio-blue {
    background: linear-gradient(135deg, #0071e3 0%, #00c6fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline; /* Changed from inline-block to inline to remove spacing */
}

/* Adjust main containers to not overlap with fixed logo if screen is small */
@media (max-width: 1200px) {
    .zhang-lab-logo {
        position: relative;
        top: 0;
        left: 0;
        margin-bottom: 20px;
        display: inline-flex;
    }
    .full-screen-center {
        display: block;
        padding-top: 20px;
    }
}

/* Shared layout */
.container {
    max-width: 98%; /* Almost full width */
    margin: 0 auto;
    padding: 40px;
}

.full-screen-center {
    min-height: 100vh;
    display: flex;
    align-items: flex-start; /* Start from top */
    justify-content: center;
    padding-top: 80px;
    padding-bottom: 60px;
}

.card {
    background: transparent; /* Remove global card background */
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    border: none;
}

.submission-card {
    width: 100%;
    max-width: 1400px; /* Slightly constrained for better reading */
    margin: 0 auto;
}

.interactive-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.interactive-banner p {
    margin: 0;
    max-width: 860px;
}

.workflow-choice-grid,
.project-grid,
.stage-timeline {
    display: grid;
    gap: 20px;
}

.workflow-choice-grid,
.project-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.workflow-branch-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.project-path-tabs {
    display: flex;
    gap: 12px;
    padding: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
}

.project-path-tab {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 14px;
    padding: 14px 16px;
    flex: 1;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.project-path-tab strong {
    display: block;
    color: #0f172a;
    font-size: 0.98rem;
    margin-bottom: 4px;
}

.project-path-tab span {
    display: block;
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.5;
}

.project-path-tab:hover {
    background: #ffffff;
    border-color: #dbeafe;
}

.project-path-tab.active {
    background: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(39, 94, 254, 0.10);
}

.workflow-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 18px;
}

.workflow-summary-grid .summary-card strong {
    display: block;
    font-size: 1.02rem;
    color: #0f172a;
    line-height: 1.55;
    word-break: break-word;
}

.workflow-chip-block {
    margin-top: 16px;
}

.workflow-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

.workflow-chip-row .info-chip {
    margin: 0;
    max-width: 100%;
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
}

.info-chip-empty {
    font-weight: 600;
}

.branch-card,
.summary-card,
.stage-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 20px;
}

.branch-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(39, 94, 254, 0.08);
}

.branch-card h4,
.stage-card h4 {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.compact-list {
    margin: 0;
    padding-left: 18px;
    color: #475569;
}

.compact-list li {
    margin-bottom: 6px;
}

.summary-label {
    display: block;
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 6px;
}

.info-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    margin: 0 10px 10px 0;
    font-size: 0.9rem;
    font-weight: 700;
}

.info-chip.primary {
    background: rgba(39, 94, 254, 0.1);
    color: var(--primary-color);
}

.info-chip.muted {
    background: #e2e8f0;
    color: #475569;
}

.info-chip.warning {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.stage-timeline {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.stage-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.stage-index,
.stage-status-tag {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #64748b;
    text-transform: uppercase;
}

.stage-status-stale {
    color: #b91c1c;
}

.stage-current {
    border-color: var(--primary-color);
    background: rgba(39, 94, 254, 0.05);
}

.status-overview-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-overview-card strong {
    display: block;
    font-size: 1rem;
    line-height: 1.5;
    word-break: break-word;
}

.status-overview-card .summary-value {
    margin: 0;
    color: #475569;
    line-height: 1.6;
}

.project-progress-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 22px;
}

.project-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
}

.project-progress-header strong {
    display: block;
    font-size: 1.08rem;
    color: #0f172a;
    line-height: 1.5;
}

.project-progress-meta {
    text-align: right;
    min-width: 120px;
}

.project-progress-meta span {
    display: block;
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.project-progress-meta strong {
    font-size: 1.35rem;
    color: var(--primary-color);
}

.project-progress-track {
    width: 100%;
    height: 14px;
    margin-top: 18px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.project-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #275efe 0%, #4f8cff 100%);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.stage-execution-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.stage-execution-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.stage-execution-card .summary-value {
    margin: 0;
    color: #475569;
    line-height: 1.6;
}

.stage-execution-status-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.stage-status-current {
    color: var(--primary-color);
}

.stage-execution-summary {
    margin-top: 0;
}

.stage-execution-outcome {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 14px;
    font-weight: 800;
    letter-spacing: 0.02em;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #334155;
}

.stage-execution-outcome.status-completed {
    background: rgba(16, 185, 129, 0.10);
    border-color: rgba(16, 185, 129, 0.28);
    color: #047857;
}

.stage-execution-outcome.status-failed {
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.28);
    color: #b91c1c;
}

.stage-execution-outcome.status-running {
    background: rgba(59, 130, 246, 0.10);
    border-color: rgba(59, 130, 246, 0.28);
    color: #1d4ed8;
}

.stage-execution-outcome.status-queued,
.stage-execution-outcome.status-idle {
    background: #ffffff;
    border-color: #dbe4f0;
    color: #334155;
}

.stage-execution-timestamps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.stage-execution-timestamp {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px 14px;
    min-width: 0;
}

.stage-execution-timestamp span {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 6px;
}

.stage-execution-timestamp strong {
    display: block;
    font-size: 0.92rem;
    line-height: 1.5;
    color: #0f172a;
    word-break: break-word;
}

.stage-execution-chip-row {
    margin-top: -4px;
}

.stage-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
}

.stage-action-btn {
    margin-top: 0;
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
}

.stage-card-actions .stage-action-btn {
    padding: 10px 16px;
}

@media (max-width: 640px) {
    .stage-card-actions .stage-action-btn {
        width: 100%;
    }
}

.project-lookup-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.project-lookup-form input[type="text"] {
    flex: 1;
    min-width: min(280px, 100%);
}

.project-lookup-message {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
    line-height: 1.6;
}

.project-lookup-message.success {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.25);
    color: #166534;
}

.project-lookup-message.warning {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
    color: #b91c1c;
}

.project-lookup-message.muted {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #334155;
}

@media (max-width: 768px) {
    .project-progress-header {
        flex-direction: column;
    }

    .project-progress-meta {
        text-align: left;
        min-width: 0;
    }
}

.stage-completed {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.08);
}

.history-project-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 22px;
    cursor: pointer;
}

.history-card-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.history-card-main {
    min-width: 0;
}

.history-project-id {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    word-break: break-word;
    line-height: 1.5;
}

.history-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.history-simple-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
}

.history-simple-status-waiting {
    background: rgba(148, 163, 184, 0.16);
    color: #475569;
}

.history-simple-status-running {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}

.history-simple-status-interaction {
    background: rgba(234, 179, 8, 0.14);
    color: #a16207;
}

.history-simple-status-completed {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
}

.history-actions {
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .history-card-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-card-badges {
        justify-content: flex-start;
    }
}

.stage-notes-card textarea {
    width: 100%;
    margin-bottom: 16px;
}

.summary-table {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-summary-table .summary-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
}

.sidebar-summary-table .summary-key {
    min-width: 0;
    white-space: normal;
    line-height: 1.45;
}

.sidebar-summary-table .summary-value {
    font-weight: 700;
    color: #0f172a;
    justify-self: end;
    min-width: 2ch;
    text-align: right;
    white-space: normal;
    word-break: break-word;
    line-height: 1.45;
    font-variant-numeric: tabular-nums;
}

.selection-summary-hint {
    line-height: 1.6;
}

.fixed-sites-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    width: 100%;
    min-width: 0;
}

.fixed-sites-grid > * {
    min-width: 0;
    max-width: 100%;
}

.sequence-design-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.sequence-design-summary-grid .summary-card {
    min-width: 0;
}

.fixed-sites-grid .summary-card,
#editableFixedSitesSection .summary-card,
#selectionSourceSection,
#preselectedResiduesSection {
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    contain: inline-size;
}

.fixed-sites-grid .summary-card,
.fixed-sites-grid .site-chip-row,
#selectionSourceTable,
#predictorStatusTable,
.summary-table,
.summary-row,
.summary-key,
.summary-value {
    min-width: 0;
    max-width: 100%;
}

.fixed-sites-grid .site-chip-row,
#selectionSourceTable,
#predictorStatusTable,
.summary-value {
    overflow-wrap: break-word;
}

.model-controls-card {
    gap: 16px;
    min-width: 0;
}

.model-controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin: 14px 0 8px;
}

#modelControlsCard .model-controls-grid {
    grid-template-columns: minmax(0, 1fr);
}

.model-control-field {
    margin: 0;
}

.model-control-note {
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
    padding: 14px 16px;
    color: #475569;
    min-width: 0;
}

#modelControlsCard .model-control-note {
    grid-column: 1 / -1;
}

.model-control-note strong {
    display: block;
    margin-bottom: 6px;
    color: #0f172a;
}

.model-control-note p {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

#modelControlsCard .model-control-field,
#modelControlsCard .model-control-field label,
#modelControlsCard .model-control-field input {
    min-width: 0;
}

.model-controls-action-row {
    margin: 6px 0 2px;
}

.site-chip-row {
    display: block;
    min-height: 0;
    color: #334155;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding: 2px 0 0;
    scrollbar-width: thin;
    min-width: 0;
    font-size: 0.84rem;
    line-height: 1.45;
    font-variant-numeric: tabular-nums;
}

#editableFixedSitesSection .fixed-sites-grid .site-chip-row {
    overflow-x: visible;
    overflow-y: visible;
    white-space: normal;
    scrollbar-width: auto;
}

.site-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
    font-weight: 700;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

button.site-chip {
    cursor: pointer;
    font-family: inherit;
}

.site-chip-muted {
    background: rgba(148, 163, 184, 0.15);
    color: #475569;
    border-color: rgba(148, 163, 184, 0.35);
}

.site-chip-selected {
    background: rgba(39, 94, 254, 0.12);
    color: var(--primary-color);
    border-color: rgba(39, 94, 254, 0.35);
}

.three-d-placeholder {
    border: 1px dashed #94a3b8;
    border-radius: 18px;
    padding: 18px;
    background: linear-gradient(180deg, rgba(39, 94, 254, 0.04), rgba(255, 255, 255, 0.9));
    overflow: hidden;
}

.three-d-placeholder strong {
    display: block;
    margin-bottom: 10px;
    font-size: 1rem;
}

.molecule-viewer {
    width: 100%;
    aspect-ratio: auto;
    height: clamp(360px, 52vh, 560px);
    min-height: 360px;
    max-height: 560px;
    border-radius: 16px;
    border: 1px solid #dbe4f0;
    background: #f8fafc;
    margin: 0;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.molecule-viewer canvas,
.molecule-viewer svg {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    touch-action: none;
}

.structure-inspection-board {
    margin-top: 16px;
    padding: 16px;
    overflow: visible;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.95fr);
    gap: 14px;
    position: relative;
    z-index: 2;
    align-items: stretch;
}

.structure-stage-card {
    border: 1px solid #dbe4f0;
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.9);
    padding: 12px;
    order: 0;
    position: relative;
    align-self: stretch;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.viewer-help-row {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 20;
}

.viewer-overlay-action {
    min-height: 24px !important;
    padding: 4px 10px !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12) !important;
    white-space: nowrap !important;
}

.viewer-overlay-action:hover {
    background: #f8fafc !important;
    border-color: #94a3b8 !important;
}

.viewer-help-item {
    position: relative;
}

.viewer-help-item .tooltip-icon {
    width: 18px;
    height: 18px;
    font-size: 11px;
    background: #ffffff !important;
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    opacity: 1 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}

.viewer-help-item .tooltip-text {
    left: auto;
    right: calc(100% + 10px);
    top: -6px;
    bottom: auto;
    width: min(280px, calc(100vw - 96px));
    height: max-content;
    min-height: max-content;
    overflow: hidden;
    display: block;
    z-index: 1400;
    transform: translateX(-6px) scale(0.95);
}

.viewer-help-item .tooltip-text::after {
    top: 14px;
    bottom: auto;
    left: 100%;
    right: auto;
    margin-left: 0;
    border-color: transparent transparent transparent #fff;
}

.viewer-help-item .tooltip-icon:hover + .tooltip-text,
.viewer-help-item .tooltip-icon:focus-visible + .tooltip-text {
    transform: translateX(0) scale(1);
}

.viewer-workbench-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.viewer-workbench-chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #334155;
    font-size: 0.82rem;
    line-height: 1.35;
}

.viewer-workbench-chip strong {
    color: #0f172a;
    margin-right: 4px;
}

.viewer-controls-card-embedded {
    margin-top: 8px;
    padding: 12px;
    min-width: 0;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
    overflow: visible;
}

.viewer-controls-card-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.viewer-controls-card-model {
    min-width: 0;
}

.viewer-control-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.viewer-control-checks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
    margin-top: 10px;
}

.viewer-control-section + .viewer-control-section {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
}

.viewer-control-section-title {
    margin-bottom: 8px;
    color: #0f172a;
    font-size: 0.78rem;
    font-weight: 700;
}

.viewer-controls-card-embedded .form-group {
    margin-bottom: 0;
}

.model-control-field-wide {
    grid-column: 1 / -1;
}

.viewer-controls-card-embedded select,
.viewer-controls-card-embedded button,
.viewer-controls-card-embedded input[type="color"],
.viewer-controls-card-embedded input[type="number"] {
    width: 100%;
}

.viewer-controls-card-embedded input[type="color"] {
    min-height: 42px;
    padding: 4px;
    border-radius: 12px;
    border: 1px solid #dbe4f0;
    background: #ffffff;
}

.viewer-control-grid-tight {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.viewer-control-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.viewer-control-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
    justify-content: stretch;
    align-items: stretch;
}

.viewer-control-actions-grid > * {
    width: 100%;
}

.viewer-control-section-ligand .viewer-control-actions-grid > .btn-secondary {
    min-width: 0;
    min-height: 26px;
    padding: 3px 6px;
    font-size: 0.68rem;
    line-height: 1.1;
    border-radius: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.viewer-controls-card-visual .viewer-control-section-ligand .viewer-control-actions-grid {
    gap: 6px;
}

.viewer-control-actions-grid-highlighted > * {
    min-height: 34px;
    white-space: nowrap;
}

.viewer-control-actions-compact {
    margin-top: 10px;
}

.viewer-selected-group-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.viewer-selected-group-actions-inline {
    justify-content: flex-end;
    margin-bottom: 0;
}

.viewer-ligand-info-card {
    margin-top: 10px;
    background: rgba(248, 250, 252, 0.92);
}

.viewer-interaction-details-group {
    display: grid;
    gap: 10px;
    margin-top: 8px;
    margin-bottom: 6px;
}

.viewer-interaction-details {
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    background: rgba(248, 250, 252, 0.92);
    overflow: hidden;
}

.viewer-interaction-details summary {
    cursor: pointer;
    list-style: none;
    padding: 10px 12px;
    font-size: 0.8rem;
    font-weight: 800;
    color: #0f172a;
    user-select: none;
}

.viewer-interaction-details summary::-webkit-details-marker {
    display: none;
}

.viewer-interaction-details summary::after {
    content: "Collapse";
    float: right;
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
}

.viewer-interaction-details:not([open]) summary::after {
    content: "Expand";
}

.viewer-interaction-details .site-chip-row {
    padding: 0 12px 12px;
}

.viewer-info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.ligand-selection-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    margin-top: 8px;
    max-height: 124px;
    overflow: auto;
    padding-right: 4px;
}

.ligand-selection-option {
    min-height: 34px;
    justify-content: flex-start;
    text-align: left;
    padding: 6px 10px;
}

.viewer-empty-state {
    padding: 24px;
    border: 1px solid #dbe4f0;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.75);
    color: #475569;
    margin-bottom: 16px;
}

.viewer-empty-state h4 {
    margin: 0 0 8px;
    color: #0f172a;
}

.inline-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0 12px;
}

.weight-action-row {
    gap: 10px;
}

.weight-action-row .weight-action-btn {
    min-width: 0;
    min-height: 42px;
    margin: 0;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
    box-sizing: border-box;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.weight-action-row .weight-action-btn.btn-primary {
    min-width: 220px;
}

.weight-action-row .weight-action-btn.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid rgba(59, 130, 246, 0.28);
    text-decoration: none;
}

.weight-action-row .weight-action-btn.btn-secondary:hover {
    background: #dbeafe;
    border-color: rgba(37, 99, 235, 0.34);
}

.selection-action-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.selection-action-row .selection-action-btn {
    width: 100%;
    max-width: none;
    min-width: 0;
    min-height: 42px;
    margin: 0;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
    box-sizing: border-box;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.selection-action-row .selection-action-btn.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid rgba(59, 130, 246, 0.28);
    text-decoration: none;
}

.selection-action-row .selection-action-btn.btn-secondary:hover {
    background: #dbeafe;
    border-color: rgba(37, 99, 235, 0.34);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.88rem;
}

.results-structure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.viewer-hover-card {
    margin-bottom: 16px;
    background: #ffffff !important;
    opacity: 1 !important;
    border-color: #dbe4f0 !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.viewer-inline-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 10px;
    margin: 6px 0 0;
    color: #475569;
    font-size: 0.75rem;
    line-height: 1.2;
}

.viewer-inline-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    min-width: 0;
}

.viewer-inline-card {
    margin-bottom: 0;
    height: 100%;
}

.viewer-legend-card {
    margin-bottom: 16px;
}

.viewer-filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 18px;
    margin-bottom: 0;
    padding: 10px 12px;
}

.viewer-side-rail {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    order: 1;
    overflow: visible;
    align-self: stretch;
}

.viewer-status-rail-card {
    margin-top: 10px;
    padding: 14px 12px 12px;
    background: #f8fafc !important;
    opacity: 1 !important;
    border-color: #dbe4f0 !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.viewer-status-action-group {
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
}

.viewer-status-action-title {
    font-size: 0.76rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 8px;
}

.viewer-status-inline-field {
    margin-bottom: 10px;
}

.viewer-status-inline-field label {
    display: block;
    margin-bottom: 6px;
}

.viewer-status-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.viewer-status-action-grid .btn-secondary {
    min-height: 30px;
    padding: 6px 8px;
    font-size: 0.74rem;
    white-space: nowrap;
}

.viewer-status-rail-card strong {
    display: block;
    color: #0f172a;
    font-size: 0.82rem;
    line-height: 1.25;
}

.viewer-status-rail-card p {
    margin: 4px 0 0;
    color: #475569;
    font-size: 0.75rem;
    line-height: 1.2;
}

.viewer-filter-inline {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 6px 10px;
    min-width: 0;
}

.viewer-filter-label {
    flex: 0 0 auto;
    font-size: 0.76rem;
    font-weight: 700;
    color: #475569;
    white-space: nowrap;
    line-height: 1.2;
    padding-top: 5px;
}

.dimension-toggle-row-compact {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 8px;
    overflow: visible;
}

.dimension-toggle-row-compact .btn-secondary,
.dimension-toggle-row-compact .btn-primary {
    padding: 6px 10px;
    font-size: 0.78rem;
    white-space: nowrap;
}

.dimension-toggle-row-compact .dimension-toggle {
    padding: 4px 8px;
    font-size: 0.74rem;
    white-space: nowrap;
    justify-content: center;
    min-height: 28px;
}

.viewer-sequence-card {
    margin-top: 16px;
    border: 1px solid #dbe4f0;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.92));
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
    overflow: visible;
}

.viewer-sequence-card-embedded {
    margin-top: 0;
    padding: 10px 12px;
    order: 0;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
}

.viewer-sequence-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 46%);
    align-items: start;
    gap: 12px 16px;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    position: relative;
    overflow: visible;
    z-index: 6;
}

.viewer-sequence-intro {
    min-width: 0;
    padding-bottom: 6px;
    position: relative;
    overflow: visible;
    z-index: 7;
}

.viewer-sequence-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    position: relative;
    overflow: visible;
    z-index: 8;
}

.viewer-sequence-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    color: #0f172a;
}

.viewer-sequence-title::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}

.viewer-sequence-hint {
    margin: 2px 0 0;
    color: #475569;
    font-size: 0.78rem;
    line-height: 1.35;
}

.viewer-pinned-residue-label {
    padding: 8px 12px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #dbe4f0;
    color: #0f172a;
    font-size: 0.78rem;
    line-height: 1.45;
    word-break: break-word;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
    margin: 0;
}

.viewer-pinned-residue-label-float {
    position: absolute;
    left: 12px;
    top: 12px;
    z-index: 18;
    width: min(360px, calc(100% - 24px));
    pointer-events: none;
}

.viewer-pinned-residue-label-empty {
    color: #475569;
    background: #f8fafc;
}

.viewer-header-actions {
    display: block !important;
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
    align-self: start;
}

.viewer-toolbar-control-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.viewer-toolbar-control-pair > .viewer-toolbar-dropdown {
    display: block;
    width: 100%;
    min-width: 0;
}

.viewer-toolbar-control-pair > .viewer-toolbar-dropdown.hidden {
    display: none !important;
}

.viewer-toolbar-btn {
    min-height: 28px !important;
    width: auto !important;
    padding: 3px 10px !important;
    border-radius: 999px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    box-shadow: none !important;
}

.viewer-toolbar-dropdown {
    position: static;
    width: 100% !important;
    min-width: 0 !important;
}

.viewer-toolbar-dropdown > summary {
    display: inline-flex !important;
    width: 100% !important;
}

.viewer-header-actions > .viewer-toolbar-control-pair > .viewer-toolbar-dropdown > summary.btn-sm {
    min-height: 30px;
    padding: 5px 10px;
    border-radius: 999px;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
    width: 100%;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    font-size: 0.74rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.viewer-controls-dropdown {
    position: static;
    width: auto;
    min-width: 0;
}

.viewer-controls-dropdown summary {
    list-style: none;
    cursor: pointer;
}

.viewer-controls-dropdown summary::-webkit-details-marker {
    display: none;
}

.viewer-controls-dropdown[open] > summary {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.viewer-toolbar-dropdown > .viewer-controls-card-embedded {
    display: none;
}

.viewer-header-actions .viewer-controls-dropdown[open] .viewer-controls-card-embedded {
    display: block;
    position: static;
    z-index: auto;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    max-height: none;
    overflow: visible;
    margin-top: 8px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.viewer-header-actions .viewer-controls-card-embedded,
.viewer-header-actions .viewer-controls-card-model {
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

.viewer-controls-card-model .model-controls-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    margin: 10px 0 6px;
    align-items: start;
}

.viewer-controls-card-model .model-control-field-wide,
.viewer-controls-card-model .model-control-note {
    grid-column: 1 / -1;
}

.viewer-controls-card-model .model-control-note {
    padding: 10px 12px;
}

.viewer-controls-card-visual {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
}

.viewer-controls-card-visual .viewer-control-section {
    min-width: 0;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.viewer-controls-card-visual .viewer-control-section + .viewer-control-section {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    border-left: 0;
    padding-left: 0;
}

.viewer-controls-card-visual .viewer-control-section-focus {
    grid-column: 1 / -1;
}

.viewer-controls-card-visual .viewer-control-section-highlighted {
    border-left: 0;
    padding-left: 0;
}

.viewer-controls-card-visual .viewer-control-section-ligand {
    border-left: 1px solid rgba(226, 232, 240, 0.9);
    padding-left: 12px;
}

.viewer-controls-card-visual .viewer-selected-group-actions-inline {
    justify-content: stretch;
}

.viewer-controls-card-visual .viewer-selected-group-actions-inline .btn-secondary {
    width: 100%;
    min-height: 34px;
}

.viewer-controls-card-visual .viewer-control-actions-grid-highlighted {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.viewer-controls-card-visual .viewer-control-grid-tight {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 10px;
}

.viewer-controls-card-visual .viewer-control-checks {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.viewer-controls-card-visual .viewer-control-section-ligand .viewer-control-grid-tight {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.viewer-controls-card-visual .viewer-control-section-ligand .viewer-control-actions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.results-ligand-inline-checks {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow-x: visible;
    padding-bottom: 0;
}

.results-ligand-inline-checks .dimension-toggle {
    flex: 0 0 auto;
    white-space: nowrap;
    gap: 4px;
    padding: 4px 8px;
    font-size: 0.82rem;
    line-height: 1.2;
}

.results-ligand-inline-checks .dimension-toggle input[type="checkbox"] {
    transform: scale(0.92);
    transform-origin: center;
}

.results-ligand-inline-checks .tooltip-icon {
    width: 16px;
    height: 16px;
    min-width: 16px;
    font-size: 0.7rem;
}

#preselectedResiduesSection,
#editableFixedSitesSection,
#selectionSourceSection {
    content-visibility: auto;
    contain-intrinsic-size: 560px;
}

.viewer-sequence-panel {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    margin-top: 10px;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
}

@media (max-width: 1100px) {
    .structure-inspection-board {
        grid-template-columns: minmax(0, 1fr);
    }
}

.viewer-sequence-chain {
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    padding: 10px 12px;
    background: rgba(248, 250, 252, 0.84);
    overflow: hidden;
}

.viewer-sequence-chain-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
}

.viewer-sequence-scroll {
    --viewer-sequence-label-width: 200px;
    --viewer-sequence-cover-width: 216px;
    --viewer-sequence-token-offset: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    isolation: isolate;
    background: #f8fafc;
    scrollbar-width: thin;
    scroll-behavior: auto;
}

.fixed-sites-confirmation-stack {
    display: grid;
    gap: 16px;
}

.fixed-sites-form-block {
    overflow: visible;
}

.fixed-sites-manual-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.field-help-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.field-help-tooltip .tooltip-icon {
    width: 18px;
    height: 18px;
    font-size: 11px;
}

.viewer-sequence-scroll::before {
    content: "";
    position: sticky;
    left: 0;
    top: 0;
    display: block;
    width: var(--viewer-sequence-cover-width);
    min-width: var(--viewer-sequence-cover-width);
    height: 100%;
    background: #f8fafc;
    border-right: 1px solid rgba(226, 232, 240, 0.95);
    z-index: 2;
    pointer-events: none;
}

.viewer-sequence-scroll-inner {
    display: grid;
    gap: 6px;
    width: max-content;
    min-width: 100%;
}

.viewer-sequence-row {
    display: grid;
    grid-template-columns: var(--viewer-sequence-label-width) max-content;
    gap: 0;
    align-items: center;
    position: relative;
    width: max-content;
    min-width: 100%;
    padding: 4px 0;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.viewer-sequence-row:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.viewer-sequence-ruler {
    padding: 0 0 2px;
    border-top: 0;
}

.viewer-sequence-row-label {
    position: sticky;
    left: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 6px;
    width: var(--viewer-sequence-label-width);
    min-width: var(--viewer-sequence-label-width);
    min-height: 22px;
    padding: 0 14px 0 0;
    font-size: 0.76rem;
    font-weight: 700;
    color: #334155;
    line-height: 1.5;
    background: #f8fafc;
    border-right: 1px solid rgba(226, 232, 240, 0.95);
    white-space: nowrap;
}

.viewer-track-dot {
    display: inline-flex;
    width: 10px;
    min-width: 10px;
    height: 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.28);
}

.viewer-track-dot.sequence-residue-primary {
    background: #1d4ed8;
}

.viewer-track-dot.sequence-residue-secondary {
    background: #0f766e;
}

.viewer-track-dot.sequence-residue-conservation {
    background: #b45309;
}

.viewer-track-dot.sequence-residue-user {
    background: #7c3aed;
}

.viewer-track-dot.sequence-residue-neutral {
    background: #ec4899;
}

.viewer-track-toggle-btn {
    margin-left: auto;
    min-width: 48px;
    min-height: 24px;
    padding: 0 8px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 999px;
    background: #ffffff;
    color: #334155;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
}

.viewer-track-toggle-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.structure-inspection-board:fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
    padding: 14px;
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.95fr);
    gap: 14px;
    align-items: stretch;
    background: #f8fafc;
    box-sizing: border-box;
    overflow: auto;
}

.structure-inspection-board:fullscreen .structure-stage-card {
    padding: 12px;
    background: #ffffff;
    min-height: 0;
    height: calc(100vh - 28px);
    display: flex;
    flex-direction: column;
}

.structure-inspection-board:fullscreen #moleculeViewer {
    flex: 1 1 auto;
    min-height: 0;
    height: calc(100vh - 96px) !important;
}

.structure-inspection-board:fullscreen .viewer-side-rail {
    min-height: 0;
    max-height: calc(100vh - 28px);
    overflow: auto;
    padding-right: 2px;
}

.structure-inspection-board:fullscreen .viewer-sequence-panel {
    max-height: none;
}

@media (max-width: 960px) {
    .structure-inspection-board:fullscreen {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto;
    }

    .structure-inspection-board:fullscreen .structure-stage-card,
    .structure-inspection-board:fullscreen .viewer-side-rail {
        height: auto;
        max-height: none;
    }

    .structure-inspection-board:fullscreen #moleculeViewer {
        height: min(68vh, 720px) !important;
    }
}

@media (max-width: 720px) {
    .ligand-selection-group,
    .viewer-control-actions-grid {
        grid-template-columns: 1fr;
    }

    .viewer-toolbar-control-pair {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1280px) {
    .viewer-sequence-header {
        grid-template-columns: minmax(0, 1fr) minmax(360px, 44%);
    }

    .viewer-controls-card-visual {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .viewer-controls-card-visual .viewer-control-section-ligand {
        grid-column: 1 / -1;
        border-left: 0;
        padding-left: 0;
        border-top: 1px solid rgba(226, 232, 240, 0.9);
        padding-top: 12px;
    }
}

@media (max-width: 900px) {
    .viewer-sequence-header {
        grid-template-columns: 1fr;
    }

    .viewer-controls-card-model .model-controls-grid,
    .viewer-controls-card-visual,
    .viewer-controls-card-visual .viewer-control-section-ligand .viewer-control-grid-tight,
    .viewer-control-checks {
        grid-template-columns: 1fr;
    }

    .viewer-controls-card-visual .viewer-control-section + .viewer-control-section {
        border-left: 0;
        padding-left: 0;
        border-top: 1px solid rgba(226, 232, 240, 0.9);
        padding-top: 12px;
    }
}

.viewer-sequence-row-label-ruler {
    min-height: 12px;
    padding: 0;
    border-right-color: transparent;
}

.viewer-sequence-tokens {
    display: flex;
    flex-wrap: nowrap;
    gap: 1px;
    overflow: hidden;
    padding: 0 0 1px var(--viewer-sequence-token-offset);
    position: relative;
    z-index: 0;
    width: max-content;
}

.viewer-sequence-ruler-tokens {
    gap: 1px;
    overflow: hidden;
    padding: 0 0 0 var(--viewer-sequence-token-offset);
    min-height: 12px;
}

.viewer-sequence-ruler-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 18px;
    width: 18px;
    min-width: 18px;
    height: 12px;
    font-size: 0.56rem;
    line-height: 1;
    color: #64748b;
    font-weight: 700;
    font-family: "Consolas", "SFMono-Regular", monospace;
    user-select: none;
}

.sequence-residue-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex: 0 0 18px;
    width: 18px;
    min-width: 18px;
    height: 18px;
    padding: 0;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    font-size: 0.62rem;
    color: #334155;
    cursor: pointer;
    font-family: "Consolas", "SFMono-Regular", monospace;
    font-family: "Consolas", "SFMono-Regular", monospace;
    font-size: 0.64rem;
    font-weight: 700;
    line-height: 1;
    margin-top: 0;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.sequence-residue-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

.sequence-residue-neutral {
    background: #ffffff;
    color: #334155;
}

.sequence-residue-primary {
    background: rgba(29, 78, 216, 0.12);
    color: #1d4ed8;
    border-color: rgba(29, 78, 216, 0.28);
}

.sequence-residue-secondary {
    background: rgba(15, 118, 110, 0.12);
    color: #0f766e;
    border-color: rgba(15, 118, 110, 0.28);
}

.sequence-residue-conservation {
    background: rgba(180, 83, 9, 0.12);
    color: #b45309;
    border-color: rgba(180, 83, 9, 0.28);
}

.sequence-residue-user {
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
    border-color: rgba(124, 58, 237, 0.28);
}

.sequence-residue-faded {
    background: rgba(241, 245, 249, 0.95);
    color: #94a3b8;
    border-color: rgba(203, 213, 225, 0.8);
}

.sequence-residue-fixed {
    box-shadow: inset 0 0 0 2px rgba(124, 58, 237, 0.2);
}

.sequence-residue-grouped {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7), 0 6px 14px rgba(15, 23, 42, 0.12);
}

.sequence-residue-ligand {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
    border-color: rgba(22, 163, 74, 0.30);
}

.sequence-residue-ligand-btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 34px;
    padding: 0 6px;
    border-radius: 7px;
    font-size: 0.58rem;
    letter-spacing: 0.02em;
}

.sequence-residue-ligand-static {
    cursor: default;
    user-select: none;
}

.sequence-residue-ligand-static:hover {
    transform: none;
    box-shadow: none;
}

.sequence-residue-ligand-deselected {
    background: rgba(148, 163, 184, 0.12);
    color: #64748b;
    border-color: rgba(148, 163, 184, 0.38);
}

.viewer-sequence-empty {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(241, 245, 249, 0.95);
    border: 1px solid rgba(203, 213, 225, 0.8);
    color: #94a3b8;
    font-size: 0.74rem;
    white-space: nowrap;
}

.viewer-legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px 16px;
    margin-top: 10px;
}

.viewer-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #334155;
    font-size: 0.94rem;
}

.viewer-legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    flex: 0 0 14px;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.viewer-legend-final {
    background: #7c3aed;
}

.viewer-legend-primary {
    background: #1d4ed8;
}

.viewer-legend-secondary {
    background: #0f766e;
}

.viewer-legend-conservation {
    background: #b45309;
}

.fixed-sites-submit-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 8px;
}

.fixed-sites-continue-card {
    margin-top: 18px;
    text-align: center;
}

.fixed-sites-continue-card .summary-value {
    margin: 10px 0 0;
}

.fixed-sites-continue-btn {
    width: 100%;
    max-width: 100%;
    margin-top: 18px;
}

.site-chip-hidden {
    opacity: 0.45;
}

@media (min-width: 1280px) {
    .structure-inspection-board {
        grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr);
        align-items: start;
    }

    .molecule-viewer {
        height: clamp(440px, 68vh, 760px);
        min-height: 440px;
        max-height: 760px;
    }

    .viewer-side-rail {
        align-self: start;
    }
}

@media (max-width: 900px) {
    .viewer-filter-toolbar,
    .viewer-filter-inline {
        align-items: flex-start;
    }

    .viewer-filter-inline {
        flex-direction: column;
    }

    .viewer-control-grid {
        grid-template-columns: 1fr;
    }

    .structure-info-strip {
        grid-template-columns: 1fr;
    }

    .viewer-workbench-hints {
        width: 100%;
    }

    .molecule-viewer {
        height: 360px;
        min-height: 360px;
        max-height: 360px;
    }

    .viewer-sequence-header {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .viewer-header-actions {
        width: 100%;
    }

    .viewer-selected-group-actions {
        width: 100%;
        justify-content: stretch;
    }

    .viewer-selected-group-actions button {
        width: 100%;
    }

    .viewer-header-actions .viewer-controls-dropdown[open] .viewer-controls-card-embedded {
        position: static;
        min-width: 100%;
        max-width: 100%;
        margin-top: 0;
    }

    .viewer-sequence-row {
        grid-template-columns: 170px max-content;
    }
}

.summary-row {
    display: grid;
    grid-template-columns: 132px 1fr;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.summary-key {
    font-weight: 700;
    color: #334155;
    font-size: 0.8rem;
}

.summary-value {
    color: #475569;
    word-break: normal;
    overflow-wrap: break-word;
    font-size: 0.88rem;
    line-height: 1.42;
}

.summary-value-nowrap {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
}

#sequenceDesignRunIntentTable .summary-row,
#designConstraintsTable .summary-row,
#designRunStatusTable .summary-row {
    grid-template-columns: 108px minmax(0, 1fr);
}

#sequenceDesignRunIntentTable .summary-value-nowrap,
#designConstraintsTable .summary-value-nowrap,
#designRunStatusTable .summary-value-nowrap {
    font-size: 0.82rem;
    letter-spacing: -0.01em;
}

.summary-table-compact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 12px;
}

.summary-table-compact-grid .summary-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.summary-table-compact-grid .summary-key {
    font-size: 0.74rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #64748b;
}

.summary-table-compact-grid .summary-value {
    font-size: 0.9rem;
    line-height: 1.35;
    color: #0f172a;
}

.summary-table-compact-grid .summary-value-nowrap {
    font-size: 0.9rem;
}

.summary-table-compact-grid .summary-row-fullspan {
    grid-column: 1 / -1;
    align-content: start;
}

.summary-table-compact-grid .summary-row-fullspan .summary-value {
    text-align: left;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

#preselectedResiduesSection .summary-card,
#editableFixedSitesSection .summary-card {
    padding: 14px 16px;
}

#selectionSourceSection .summary-table {
    gap: 6px;
}

.summary-value-large {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
}

.summary-formula {
    margin-top: 6px;
    font-size: 0.82rem;
    line-height: 1.45;
    color: #475569;
    word-break: break-word;
}

.sequence-design-inline-summary {
    margin-bottom: 16px;
}

.summary-value-wrap {
    color: #475569;
    word-break: break-word;
}

.stage-lock-notice {
    border: 1px solid rgba(59, 130, 246, 0.18);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.98), rgba(255, 255, 255, 0.98));
    padding: 16px 18px;
}

.stage-lock-notice .summary-row {
    display: block;
    padding: 0;
    border-bottom: 0;
}

.stage-lock-notice .summary-key {
    display: block;
    margin-bottom: 8px;
    color: #1e3a8a;
    font-size: 0.95rem;
}

.stage-lock-notice .summary-value {
    display: block;
    color: #475569;
    line-height: 1.6;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.chart-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 16px;
    min-width: 0;
    overflow: hidden;
}

.chart-card canvas {
    display: block;
    width: 100% !important;
    height: 280px !important;
}

.plotly-chart-card {
    min-height: 360px;
}

.plotly-chart-host {
    width: 100%;
    min-height: 300px;
}

.results-graph-grid {
    grid-template-columns: repeat(auto-fit, minmax(560px, 1fr));
}

.results-graph-grid .plotly-chart-card {
    min-height: 400px;
    overflow: visible;
    position: relative;
    z-index: 1;
}

.results-graph-grid .plotly-chart-host {
    min-height: 340px;
    position: relative;
    z-index: 1;
}

.results-graph-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    margin: 0 0 12px;
    overflow: visible;
    position: relative;
    z-index: 25;
}

.results-graph-title-with-help {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow: visible;
}

.results-graph-title-with-help > span:first-child {
    display: inline-block;
}

.results-graph-title-with-help .field-help-tooltip {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}

.results-graph-title-with-help .field-help-tooltip .tooltip-text {
    z-index: 2200;
    width: min(460px, calc(100vw - 48px));
    max-width: min(460px, calc(100vw - 48px));
    white-space: normal;
    line-height: 1.55;
    left: calc(100% + 10px);
    right: auto;
    top: 50%;
    bottom: auto;
    transform: translateX(6px) translateY(-50%) scale(0.95);
}

.results-graph-title-with-help .field-help-tooltip .tooltip-text::after {
    top: 50%;
    bottom: auto;
    right: 100%;
    left: auto;
    transform: translateY(-50%);
    border-color: transparent #fff transparent transparent;
}

.results-graph-title-with-help .field-help-tooltip .tooltip-icon:hover + .tooltip-text,
.results-graph-title-with-help .field-help-tooltip .tooltip-icon:focus-visible + .tooltip-text {
    transform: translateX(0) translateY(-50%) scale(1);
}

.summary-row-button {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0;
    cursor: pointer;
}

.summary-row-button:hover .summary-key {
    color: #1d4ed8;
}

.candidate-select-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.candidate-select-label-block {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
}

.candidate-select-checkbox {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex: 0 0 auto;
}

.candidate-name-text {
    display: block;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9rem;
    line-height: 1.45;
    word-break: break-word;
}

.candidate-summary-row {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    align-items: flex-start;
}

.candidate-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 0 18px;
    overflow: hidden;
}

.candidate-item + .candidate-item {
    margin-top: 12px;
}

.candidate-item > summary {
    list-style: none;
    cursor: pointer;
    padding: 18px 0;
}

.candidate-item > summary::-webkit-details-marker {
    display: none;
}

.candidate-item[open] {
    border-color: rgba(37, 99, 235, 0.26);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.08);
}

.candidate-summary-key {
    min-width: 0;
}

.viewer-summary-compact-grid {
    display: grid;
    gap: 8px 12px;
    margin-bottom: 10px;
}

.viewer-summary-compact-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.viewer-summary-compact-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.viewer-summary-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.viewer-summary-stat-label {
    min-width: 0;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.25;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.viewer-summary-stat-value {
    min-width: 0;
    font-size: 0.88rem;
    line-height: 1.35;
    color: #0f172a;
    font-weight: 700;
    word-break: normal;
    overflow-wrap: break-word;
}

.results-mutation-summary-row {
    grid-template-columns: minmax(0, 1fr);
}

.results-mutation-summary-value {
    grid-column: 1 / -1;
    justify-self: start !important;
    text-align: left !important;
    white-space: normal;
    word-break: break-word;
}

.results-threshold-inline-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.results-threshold-inline-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
}

.results-threshold-inline-label {
    min-width: 0;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.25;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.results-threshold-inline-value {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.88rem;
    line-height: 1.35;
    color: #0f172a;
    font-weight: 700;
    white-space: nowrap;
}

@media (max-width: 1280px) {
    .results-threshold-inline-grid {
        grid-template-columns: 1fr;
    }
}

.candidate-sequence-text {
    line-height: 1.55;
    word-break: break-word;
}

.candidate-expand-hint {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.84rem;
    color: #2563eb;
    font-weight: 600;
}

.candidate-detail-panel {
    border-top: 1px solid #e2e8f0;
    padding: 16px 0 18px;
}

.candidate-detail-label {
    font-size: 0.84rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 10px;
}

.candidate-detail-sequence {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #334155;
    white-space: pre-wrap;
    word-break: break-word;
}

.sequence-next-step-card {
    border: 1px solid rgba(37, 99, 235, 0.18);
    box-shadow: 0 16px 40px rgba(37, 99, 235, 0.08);
}

.sequence-next-step-btn {
    margin-top: 16px;
}

.evaluation-weight-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.evaluation-weight-actions .evaluation-weight-action-btn {
    min-width: 0;
    min-height: 42px;
    margin: 0;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
    box-sizing: border-box;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.evaluation-weight-actions .evaluation-weight-action-btn.btn-primary,
.evaluation-weight-actions .evaluation-weight-action-btn.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border: 1px solid rgba(37, 99, 235, 0.22);
    text-decoration: none;
}

.evaluation-weight-actions .evaluation-weight-action-btn.btn-primary:hover,
.evaluation-weight-actions .evaluation-weight-action-btn.btn-secondary:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    border-color: rgba(30, 64, 175, 0.28);
}

.evaluation-next-step-card {
    border: 1px solid rgba(37, 99, 235, 0.18);
    box-shadow: 0 16px 40px rgba(37, 99, 235, 0.08);
    margin-top: 24px;
    padding: 20px;
    border-radius: 16px;
    background: #f8fbff;
    text-align: center;
    overflow-wrap: anywhere;
}

.evaluation-next-step-card .candidate-detail-label {
    margin-bottom: 8px;
}

.evaluation-next-step-card .summary-value {
    margin-bottom: 16px;
}

.evaluation-next-step-btn {
    margin-top: 0;
    min-width: min(320px, 100%);
    max-width: 100%;
}

@media (max-width: 640px) {
    .evaluation-next-step-btn {
        width: 100%;
        min-width: 0;
        padding-left: 20px;
        padding-right: 20px;
    }
}

.weight-normalization-summary {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.weight-total-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 0.84rem;
    font-weight: 700;
}

.weight-module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.weight-module-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.weight-module-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.weight-module-header h4 {
    margin: 0;
    color: #0f172a;
    font-size: 1rem;
}

.weight-module-caption {
    margin: 6px 0 0;
    color: #64748b;
    line-height: 1.5;
    font-size: 0.88rem;
}

.weight-module-status {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid #cbd5e1;
    color: #475569;
    background: #f8fafc;
}

.weight-module-status.is-enabled {
    color: #166534;
    background: #dcfce7;
    border-color: #86efac;
}

.weight-module-status.is-disabled {
    color: #991b1b;
    background: #fee2e2;
    border-color: #fca5a5;
}

.weight-input-row {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    margin-top: 16px;
}

.weight-input-row input[type="range"] {
    width: 100%;
}

.weight-submodel-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.weight-submodel-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #334155;
    font-size: 0.84rem;
    font-weight: 600;
}

.weight-submodel-help {
    margin-top: 16px;
    color: #64748b;
    font-size: 0.84rem;
    line-height: 1.5;
}

.weight-submodel-control-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.weight-submodel-control-row {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.weight-submodel-control-row label {
    color: #334155;
    font-size: 0.84rem;
    font-weight: 600;
}

.weight-submodel-control-row input[type="number"] {
    width: 100%;
}

.weight-submodel-total {
    margin-top: 14px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #64748b;
}

.ranking-preview-list {
    display: grid;
    gap: 14px;
}

.results-mode-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.results-mode-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 14px;
}

.results-download-main-btn {
    min-height: 48px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 800;
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.18);
}

.results-mode-hero h3 {
    margin: 8px 0 10px;
}

.results-mode-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.84rem;
    font-weight: 700;
}

.mode-empty-callout {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid #fed7aa;
    background: #fff7ed;
    color: #9a3412;
    line-height: 1.55;
}

.mode-callout-success {
    border-color: #86efac;
    background: #f0fdf4;
    color: #166534;
}

.is-hidden {
    display: none !important;
}

.results-ranking-card {
    width: 100%;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 18px;
    text-align: left;
    padding: 16px 18px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.results-ranking-card + .results-ranking-card {
    margin-top: 12px;
}

.results-ranking-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.results-ranking-card-title {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.results-ranking-rank {
    flex: 0 0 auto;
    min-width: 44px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 800;
    text-align: center;
}

.results-ranking-name {
    font-weight: 700;
    color: #0f172a;
    line-height: 1.5;
    word-break: break-word;
}

.results-ranking-composite {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.results-ranking-composite-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 700;
}

.results-ranking-composite-value {
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
}

.results-ranking-card-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.results-mini-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #334155;
    font-size: 0.83rem;
    font-weight: 700;
}

.results-dimension-title {
    margin: 0 0 14px;
    font-size: 1rem;
    color: #0f172a;
}

.results-dimension-entry {
    width: 100%;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 16px;
    text-align: left;
    padding: 14px 16px;
    cursor: pointer;
}

.results-dimension-entry + .results-dimension-entry {
    margin-top: 10px;
}

.results-dimension-entry-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.results-dimension-entry-rank {
    flex: 0 0 auto;
    min-width: 38px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.82rem;
    font-weight: 800;
    text-align: center;
}

.results-dimension-entry-name {
    font-weight: 700;
    color: #0f172a;
    line-height: 1.5;
    word-break: break-word;
}

.results-dimension-entry-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.results-sequence-details {
    margin-top: 14px;
    border-top: 1px solid #e2e8f0;
    padding-top: 14px;
}

.results-sequence-summary {
    cursor: pointer;
    color: #334155;
    font-weight: 700;
    line-height: 1.6;
    word-break: break-word;
}

.results-sequence-full {
    margin-top: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #334155;
    white-space: pre-wrap;
    word-break: break-word;
}

.ranking-preview-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 16px 18px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.ranking-preview-top1 {
    border-color: rgba(245, 158, 11, 0.42);
    background: linear-gradient(135deg, rgba(255, 251, 235, 0.96), rgba(255, 255, 255, 1));
    box-shadow: 0 14px 32px rgba(245, 158, 11, 0.14);
}

.ranking-preview-top2 {
    border-color: rgba(148, 163, 184, 0.42);
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.98), rgba(255, 255, 255, 1));
    box-shadow: 0 14px 32px rgba(148, 163, 184, 0.12);
}

.ranking-preview-top3 {
    border-color: rgba(251, 146, 60, 0.34);
    background: linear-gradient(135deg, rgba(255, 247, 237, 0.98), rgba(255, 255, 255, 1));
    box-shadow: 0 14px 32px rgba(251, 146, 60, 0.12);
}

.ranking-preview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.ranking-preview-title-wrap {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.ranking-preview-rank {
    flex: 0 0 auto;
    min-width: 46px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 800;
    text-align: center;
}

.ranking-preview-top1 .ranking-preview-rank {
    background: #f59e0b;
    color: #fff;
}

.ranking-preview-top2 .ranking-preview-rank {
    background: #94a3b8;
    color: #fff;
}

.ranking-preview-top3 .ranking-preview-rank {
    background: #fb923c;
    color: #fff;
}

.ranking-preview-name {
    min-width: 0;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.5;
    word-break: break-word;
}

.ranking-preview-composite {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.ranking-preview-composite-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 700;
}

.ranking-preview-composite-value {
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
}

.ranking-preview-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.ranking-score-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.ranking-score-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
}

.ranking-score-value {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
}

.help-inline-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.help-callout {
    background: linear-gradient(180deg, rgba(39, 94, 254, 0.06), rgba(255, 255, 255, 0.94));
    border: 1px solid rgba(39, 94, 254, 0.12);
    border-radius: 18px;
    padding: 18px;
}

.help-callout h4 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.help-callout p {
    margin: 0;
    color: #475569;
}

.dimension-toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.dimension-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #dbe4f0;
    color: #334155;
}

.interactive-layout .content-wrapper {
    align-items: flex-start;
}

.interactive-layout {
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
}

.interactive-layout .status-header {
    position: sticky;
    top: 0;
}

.interactive-layout .content-wrapper {
    flex: 1;
    min-height: 0;
    height: calc(100vh - 70px);
    overflow: hidden;
}

.interactive-layout .progress-sidebar {
    position: sticky;
    top: 0;
    align-self: stretch;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
}

.interactive-layout .results-main {
    min-height: 0;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    overflow-x: hidden;
}

@media (max-width: 1100px) {
    .interactive-layout {
        height: auto;
        overflow: visible;
    }

    .interactive-layout .content-wrapper {
        flex-direction: column;
        height: auto;
        overflow: visible;
        min-height: calc(100vh - 70px);
    }

    .interactive-layout .progress-sidebar {
        width: auto;
        max-height: none;
        position: static;
        overflow: visible;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .interactive-layout .results-main {
        max-height: none;
        overflow: visible;
    }

    .sequence-design-summary-grid {
        grid-template-columns: 1fr;
    }

    .fixed-sites-sidebar {
        width: auto;
        position: static;
        max-height: none;
        overflow: visible;
    }
}

.interactive-stage-badge {
    background: rgba(39, 94, 254, 0.12);
    color: var(--primary-color);
}

@media (max-width: 900px) {
    .interactive-banner {
        flex-direction: column;
        align-items: flex-start;
    }

    .summary-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .sidebar-summary-table .summary-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
    }

    .candidate-summary-row {
        grid-template-columns: 1fr;
    }

    .viewer-summary-compact-grid-3,
    .viewer-summary-compact-grid-2 {
        grid-template-columns: 1fr;
    }

    .ranking-preview-header {
        flex-direction: column;
    }

    .ranking-preview-composite {
        align-items: flex-start;
    }

    .evaluation-weight-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .weight-module-header {
        flex-direction: column;
    }

    .weight-input-row {
        grid-template-columns: 1fr;
    }

    .weight-normalization-summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-mode-hero {
        flex-direction: column;
    }

    .results-mode-actions {
        width: 100%;
        align-items: flex-start;
    }

    .results-ranking-card-header {
        flex-direction: column;
    }

    .results-ranking-composite {
        align-items: flex-start;
    }

    .weight-submodel-control-row {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
        gap: 16px;
    }

    .project-path-tabs {
        flex-direction: column;
    }
}

/* Apple Style Sections */
.form-section {
    background: #fff;
    padding: 40px;
    border-radius: 24px; /* Large, smooth radius */
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04); /* Soft ambient shadow */
    margin-bottom: 40px; /* Spacing between sections */
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.form-section:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.06); /* Subtle lift on hover */
}

/* Remove old border-bottom approach */
.form-section:last-child { 
    border-bottom: 1px solid rgba(0, 0, 0, 0.04); 
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

.interactive-data-table {
    width: max-content;
    border-collapse: collapse;
    min-width: 100%;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
}

.sequence-design-candidates-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    overflow: visible;
    position: relative;
    z-index: 1;
}

.sequence-design-candidates-table thead,
.sequence-design-candidates-table tbody,
.sequence-design-candidates-table tr,
.sequence-design-candidates-table th {
    overflow: visible;
}

.sequence-design-candidates-table thead th {
    position: relative;
    z-index: 2;
}

.interactive-data-table th,
.interactive-data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

.interactive-data-table thead th {
    background: #f8fafc;
    font-weight: 700;
    color: #0f172a;
}

.table-header-with-help {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    white-space: nowrap;
    overflow: visible;
    width: auto;
    min-width: 0;
}

.table-header-label {
    min-width: 0;
    flex: 1 1 auto;
}

.table-header-tooltip {
    position: relative;
    top: auto;
    right: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    overflow: visible;
    z-index: 10;
}

.table-header-tooltip .tooltip-icon {
    width: 14px;
    height: 14px;
    font-size: 9px;
    position: relative;
    flex: 0 0 auto;
    z-index: 11;
}

.floating-table-tooltip {
    position: fixed;
    z-index: 2000;
    width: min(320px, calc(100vw - 24px));
    max-width: min(320px, calc(100vw - 24px));
    background: #ffffff;
    color: #1d1d1f;
    text-align: left;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.8rem;
    line-height: 1.4;
    font-weight: 400;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.04);
    pointer-events: none;
}

.interactive-data-table tbody tr:hover {
    background: #f8fafc;
}

.table-sort-btn {
    border: 0;
    background: transparent;
    padding: 0;
    font: inherit;
    font-weight: 700;
    color: inherit;
    cursor: pointer;
    width: auto;
    max-width: 100%;
    text-align: left;
}

.sequence-cell {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 12px;
    scrollbar-width: thin;
}

.interactive-data-table .sequence-column-cell {
    width: 30%;
    max-width: 30%;
    overflow: hidden;
}

.sequence-design-candidates-table th:nth-child(1),
.sequence-design-candidates-table td:nth-child(1) {
    width: 88px;
    min-width: 88px;
    white-space: nowrap;
}

.sequence-design-candidates-table th:nth-child(2),
.sequence-design-candidates-table td:nth-child(2) {
    width: 15%;
}

.sequence-design-candidates-table th:nth-child(3),
.sequence-design-candidates-table td:nth-child(3) {
    width: 12%;
}

.sequence-design-candidates-table td:nth-child(2),
.sequence-design-candidates-table td:nth-child(3) {
    white-space: nowrap;
}

.sequence-design-candidates-table th:nth-child(4),
.sequence-design-candidates-table td:nth-child(4),
.sequence-design-candidates-table th:nth-child(5),
.sequence-design-candidates-table td:nth-child(5),
.sequence-design-candidates-table th:nth-child(6),
.sequence-design-candidates-table td:nth-child(6) {
    width: 14%;
}

.sequence-design-candidates-table th:nth-child(4),
.sequence-design-candidates-table th:nth-child(5),
.sequence-design-candidates-table th:nth-child(6) {
    white-space: nowrap;
    font-size: 12px;
    line-height: 1.1;
}

.sequence-design-candidates-scroll {
    overflow-x: hidden;
    overflow-y: visible;
}

.sequence-design-settings-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.sequence-design-settings-grid input {
    width: 100%;
}

.interactive-data-table .sequence-cell {
    min-width: 0;
}

.results-candidate-table {
    width: 100%;
    min-width: 1240px;
    table-layout: fixed;
}

.results-candidate-table .sequence-column-cell {
    width: 360px;
    min-width: 360px;
    max-width: 360px;
    overflow: hidden;
}

.results-candidate-table .sequence-cell {
    width: 100%;
    max-width: 100%;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    scrollbar-gutter: stable;
}

.results-candidate-table .sequence-cell::-webkit-scrollbar {
    height: 8px;
}

.results-candidate-table .sequence-cell::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.45);
    border-radius: 999px;
}

.results-candidate-table .sequence-cell::-webkit-scrollbar-track {
    background: rgba(226, 232, 240, 0.8);
    border-radius: 999px;
}

.summary-table .summary-value strong {
    font-weight: 700;
}

.filter-toolbar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.evaluation-tab-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
}

.evaluation-tab-buttons {
    display: inline-flex;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
}

.evaluation-tab-btn {
    border: 0;
    background: transparent;
    color: #334155;
    font: inherit;
    font-weight: 700;
    padding: 10px 20px;
    cursor: pointer;
}

.evaluation-tab-btn + .evaluation-tab-btn {
    border-left: 1px solid #cbd5e1;
}

.evaluation-tab-btn.active {
    background: #2563eb;
    color: #fff;
}

.evaluation-tab-panel {
    display: none;
    margin-top: 18px;
}

.evaluation-tab-panel.active {
    display: block;
}

#evaluationDefaultWeightSummary .summary-row,
#resultsDefaultWeightSummary .summary-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    align-items: start;
}

.evaluation-weight-editor {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.evaluation-weight-editor .form-group {
    min-width: 0;
    margin-bottom: 0;
}

.results-weight-panel {
    min-width: 0;
}

.results-weight-panel .evaluation-weight-editor {
    gap: 10px;
}

.results-weight-panel .evaluation-weight-editor .form-group {
    min-width: 0;
}

.results-weight-panel .evaluation-weight-editor label {
    white-space: normal;
    overflow-wrap: anywhere;
}

.results-weight-panel .evaluation-weight-editor input[type="number"],
.results-weight-panel .evaluation-weight-editor select {
    min-width: 0;
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.84rem;
}

#resultsDefaultWeightSummary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px;
}

#resultsDefaultWeightSummary .summary-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
}

#resultsDefaultWeightSummary .summary-row:first-child {
    grid-column: 1 / -1;
}

#resultsDefaultWeightSummary .summary-key {
    font-size: 0.76rem;
    line-height: 1.3;
}

#resultsDefaultWeightSummary .summary-value {
    font-size: 0.92rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

#resultsWeightEditorSection {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px !important;
}

#resultsWeightEditorSection label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#resultsRerankEditorSection {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

#evaluationDefaultWeightSummary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px;
}

#evaluationDefaultWeightSummary .summary-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
}

#evaluationDefaultWeightSummary .summary-row:first-child {
    grid-column: 1 / -1;
}

#evaluationDefaultWeightSummary .summary-key {
    font-size: 0.76rem;
    line-height: 1.3;
}

#evaluationDefaultWeightSummary .summary-value {
    font-size: 0.92rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

#evaluationWeightEditorSection {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px !important;
}

#evaluationWeightEditorSection label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#evaluationWeightEditorSection input[type="number"] {
    min-width: 0;
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.84rem;
}

@media (max-width: 640px) {
    #evaluationDefaultWeightSummary,
    #evaluationWeightEditorSection,
    #resultsDefaultWeightSummary,
    #resultsWeightEditorSection,
    #resultsRerankEditorSection {
        grid-template-columns: 1fr !important;
    }
}

.evaluation-wide-table {
    width: max-content;
    min-width: 100%;
}

.evaluation-group-header-row th {
    background: #eff6ff;
    color: #1e3a8a;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table-link-btn {
    border: 0;
    background: transparent;
    padding: 0;
    color: #2563eb;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    text-align: left;
}

.table-link-btn:hover {
    text-decoration: underline;
}

.evaluation-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.evaluation-toolbar-left,
.evaluation-toolbar-right {
    display: flex;
    align-items: stretch;
    gap: 12px;
    flex-wrap: wrap;
}

.evaluation-popover-panel {
    border: 1px solid #dbe4f0;
    border-radius: 18px;
    background: #fff;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
}

.evaluation-popover-header,
.evaluation-popover-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.evaluation-popover-footer {
    margin-top: 16px;
}

.evaluation-checkbox-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.evaluation-checkbox-group {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 14px;
    background: #f8fafc;
}

.evaluation-checkbox-group h4 {
    margin: 0 0 12px;
    color: #0f172a;
    font-size: 0.92rem;
}

.evaluation-checkbox-list {
    display: grid;
    gap: 10px;
}

.evaluation-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #334155;
    font-size: 0.9rem;
}

.evaluation-checkbox-item input {
    width: 16px;
    height: 16px;
}

.evaluation-graph-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.evaluation-graph-stage {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.evaluation-graph-controls {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 14px;
    padding: 16px;
    border: 1px solid #dbe4f0;
    border-radius: 18px;
    background: #f8fafc;
    align-items: end;
}

.graph-column-selector-group {
    min-width: 0;
    position: relative;
}

.graph-columns-trigger {
    width: 100%;
    justify-content: space-between;
    min-height: 40px;
    padding: 8px 12px;
    text-align: left;
}

.graph-columns-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: min(360px, 90vw);
    z-index: 40;
    margin-bottom: 0;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.14);
}

.graph-metric-checklist {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    max-height: 260px;
    overflow-y: auto;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
}

.graph-metric-checklist .evaluation-checkbox-item {
    align-items: flex-start;
    line-height: 1.35;
}

.graph-metric-checklist .evaluation-checkbox-item.is-disabled {
    opacity: 0.58;
    cursor: not-allowed;
}

.graph-metric-checklist .evaluation-checkbox-item.is-disabled input,
.graph-metric-checklist .evaluation-checkbox-item.is-disabled span {
    cursor: not-allowed;
}

.graph-metric-checklist-hint {
    margin-top: 2px;
    color: #64748b;
    font-size: 0.84rem;
    line-height: 1.4;
}

.evaluation-toolbar-btn {
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.evaluation-page .evaluation-toolbar .evaluation-toolbar-btn,
.evaluation-page .timeline-stage-actions .btn-primary,
.evaluation-page .timeline-stage-actions .btn-secondary {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 0;
    min-height: 42px;
    border-radius: 12px;
    padding: 10px 16px;
    margin-top: 0;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    white-space: nowrap;
}

.evaluation-page .evaluation-toolbar .evaluation-toolbar-btn.btn-primary,
.evaluation-page .evaluation-toolbar .evaluation-toolbar-btn.btn-secondary,
.evaluation-page .timeline-stage-actions .btn-primary,
.evaluation-page .timeline-stage-actions .btn-secondary {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid rgba(59, 130, 246, 0.28);
}

.evaluation-page .evaluation-toolbar .evaluation-toolbar-btn.btn-primary:hover,
.evaluation-page .evaluation-toolbar .evaluation-toolbar-btn.btn-secondary:hover,
.evaluation-page .timeline-stage-actions .btn-primary:hover,
.evaluation-page .timeline-stage-actions .btn-secondary:hover {
    background: #dbeafe;
    border-color: rgba(37, 99, 235, 0.34);
}

.evaluation-chart-grid {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    flex: 1;
    min-height: 0;
}

.evaluation-plot-card {
    padding: 20px;
    min-height: 560px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.evaluation-plot-host {
    min-height: 520px;
    height: 100%;
    flex: 1;
}

.evaluation-page .results-main {
    padding: 24px;
}

.evaluation-page .page-surface-shell .progress-sidebar-inner {
    gap: 18px;
    padding: 22px;
}

.evaluation-page .form-section {
    padding: 24px;
    margin-bottom: 20px;
}

.evaluation-page .evaluation-tab-header {
    gap: 12px;
}

.evaluation-page .evaluation-toolbar {
    gap: 12px;
    margin-bottom: 12px;
}

.graph-inline-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.evaluation-page .evaluation-toolbar-left,
.evaluation-page .evaluation-toolbar-right,
.evaluation-page .filter-toolbar,
.evaluation-page .evaluation-graph-controls,
.evaluation-page .chart-grid {
    gap: 12px;
}

.evaluation-page .graph-metric-checklist {
    gap: 8px;
    padding: 10px;
}

.evaluation-page .evaluation-plot-card {
    padding: 12px;
}

.evaluation-page .plotly-chart-card,
.evaluation-page .evaluation-plot-host {
    min-height: 520px;
}

.evaluation-page .evaluation-detail-panel {
    margin-top: 14px;
    padding: 16px;
}

@media (max-width: 1200px) {
    .evaluation-graph-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .graph-metric-checklist {
        max-height: 220px;
    }

    .evaluation-plot-card {
        min-height: 480px;
    }

    .evaluation-page .plotly-chart-card,
    .evaluation-page .evaluation-plot-host {
        min-height: 440px;
    }
}

@media (max-width: 720px) {
    .evaluation-graph-controls {
        grid-template-columns: minmax(0, 1fr);
    }

    .graph-columns-panel {
        width: 100%;
    }

    .graph-metric-checklist {
        grid-template-columns: minmax(0, 1fr);
    }
}

.evaluation-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1400;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.evaluation-modal-card {
    width: min(1080px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    background: #fff;
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.24);
}

.evaluation-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.evaluation-view-btn,
.evaluation-select-btn {
    min-width: 84px;
}

.evaluation-select-btn.selected {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.evaluation-row-active {
    box-shadow: inset 0 0 0 9999px rgba(37, 99, 235, 0.05);
}

.evaluation-detail-panel {
    margin-top: 18px;
    border: 1px solid #dbe4f0;
    border-radius: 18px;
    padding: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.95));
}

.evaluation-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.results-detail-viewer {
    min-height: 420px;
    aspect-ratio: 4 / 3;
}

.results-structure-preview-card {
    overflow: hidden;
}

.results-detail-viewer-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    width: 100%;
    min-width: 0;
}

.results-detail-meta-grid {
    margin-top: 24px;
}

.results-structure-raw-toggle summary {
    display: inline-flex;
    cursor: pointer;
}

.results-mutation-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.results-mutation-chip,
.results-sequence-token {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.results-mutation-chip {
    padding: 8px 12px;
    font: inherit;
    font-weight: 700;
}

.results-mutation-chip.active,
.results-sequence-token.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.results-sequence-board {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 260px;
    overflow: auto;
    padding: 4px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.92);
}

.results-sequence-token {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    font: inherit;
}

.results-sequence-token.mutated {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(254, 242, 242, 0.92);
    color: #b91c1c;
}

.results-sequence-token.mutated.active {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.results-sequence-token-index {
    font-size: 0.74rem;
    font-weight: 700;
    opacity: 0.82;
}

.results-sequence-token-body {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.84rem;
    font-weight: 700;
}

.eda-bar-grid {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.eda-bar-row {
    display: grid;
    grid-template-columns: minmax(100px, 1.2fr) minmax(140px, 3fr) 40px;
    gap: 12px;
    align-items: center;
}

.eda-bar-label,
.eda-bar-count {
    color: #475569;
    font-size: 0.86rem;
}

.eda-bar-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.eda-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
}

h3 {
    font-size: 1.75rem; /* Larger, bolder headers */
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #1d1d1f;
    letter-spacing: -0.015em;
}

h3 small {
    font-size: 1rem;
    color: #86868b;
    font-weight: 400;
    margin-left: 10px;
}

/* Form styles */
.text-center { text-align: center; margin-bottom: 50px; }
h1 {
    font-size: 3rem; /* Hero size */
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #1d1d1f;
    margin-bottom: 0.5rem;
}
.text-center small {
    display: block;
    color: #86868b;
    font-size: 1.2rem;
    font-weight: 400;
}

.form-group { margin-bottom: 24px; }
.form-row { display: flex; gap: 24px; }
.half-width { flex: 1; }

.source-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: 28px;
}

.source-block {
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
    border: 1px solid #dbe7ff;
    border-radius: 22px;
    padding: 24px;
}

.source-block-header h4 {
    margin: 0 0 8px;
    font-size: 1.1rem;
    color: #0f172a;
}

.source-block-header p {
    margin: 0 0 18px;
    color: #64748b;
    line-height: 1.6;
}

.source-choice-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 18px;
}

.source-option-card {
    appearance: none;
    width: 100%;
    text-align: left;
    border: 1px solid #dbe3f0;
    background: #ffffff;
    border-radius: 18px;
    padding: 18px 20px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.source-option-card strong {
    display: block;
    font-size: 1rem;
    color: #0f172a;
    margin-bottom: 6px;
}

.source-option-card span {
    display: block;
    color: #64748b;
    line-height: 1.55;
    font-size: 0.94rem;
}

.source-option-card:hover {
    border-color: #9db9ff;
    box-shadow: 0 8px 20px rgba(39, 94, 254, 0.08);
    transform: translateY(-1px);
}

.source-option-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(39, 94, 254, 0.12);
    background: #f8fbff;
}

.source-panel {
    border: 1px solid #e2e8f0;
    background: #ffffff;
    border-radius: 18px;
    padding: 18px;
}

.source-panel .form-row {
    margin-bottom: 0;
}

.source-panel-note {
    margin: 0;
    color: #475569;
    line-height: 1.6;
}

.visually-hidden-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.file-upload-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.file-upload-label {
    color: #475569;
    font-size: 0.92rem;
    line-height: 1.5;
    word-break: break-word;
}

.readonly-path-input {
    background: #f8fafc;
    color: #334155;
    font-size: 0.92rem;
}

label { 
    display: block; 
    margin-bottom: 8px; 
    font-weight: 600; 
    font-size: 0.925rem;
    color: #475569;
}

input[type="text"], input[type="number"], textarea, select {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--input-bg);
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 15px;
    color: var(--text-color);
    box-sizing: border-box; 
    transition: all 0.2s;
    font-family: inherit;
}

input[type="text"]:focus, input[type="number"]:focus, textarea:focus, select:focus {
    outline: none;
    background-color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(39, 94, 254, 0.1); /* Soft focus ring */
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 44px;
    background-image:
        linear-gradient(45deg, transparent 50%, #64748b 50%),
        linear-gradient(135deg, #64748b 50%, transparent 50%);
    background-position:
        calc(100% - 20px) calc(50% - 3px),
        calc(100% - 14px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    cursor: pointer;
}

textarea { 
    font-family: 'JetBrains Mono', 'Fira Code', monospace; 
    resize: vertical; 
    line-height: 1.5;
}

textarea#manualSitesInput,
textarea#manualUnselectedSitesInput,
textarea#finalFixedSitesInput {
    min-height: 76px;
    font-size: 0.84rem;
    line-height: 1.42;
}

textarea#finalFixedSitesInput {
    max-height: none;
    overflow: hidden;
    resize: none;
}

.hint {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--secondary-color);
    /* Long unbreakable content (e.g. echoed API error payloads) must never
       stretch the page layout. */
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
    white-space: pre-wrap;
}

/* --- Ligand Input Group --- */
.ligand-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.ligand-input-group .ligand-input {
    flex: 1;
}

.btn-add-ligand, .btn-remove-ligand {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.btn-add-ligand:hover {
    background-color: var(--primary-hover);
}

.btn-remove-ligand {
    background-color: #e74c3c;
}

.btn-remove-ligand:hover {
    background-color: #c0392b;
}

.known-ligand-auto-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.known-ligand-panel-header,
.known-ligand-manual-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.known-ligand-panel-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

label .inline-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    vertical-align: middle;
}

.inline-tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 0.74rem;
    font-weight: 800;
    line-height: 1;
    cursor: help;
}

.inline-tooltip-content {
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    z-index: 30;
    width: min(320px, 70vw);
    padding: 10px 12px;
    border-radius: 12px;
    background: #0f172a;
    color: #f8fafc;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.45;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.inline-tooltip-content::before {
    content: "";
    position: absolute;
    left: 10px;
    bottom: 100%;
    border-width: 6px;
    border-style: solid;
    border-color: transparent transparent #0f172a transparent;
}

.inline-tooltip:hover .inline-tooltip-content,
.inline-tooltip:focus-within .inline-tooltip-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.known-ligand-detected-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.known-ligand-card {
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    background: #fff;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.known-ligand-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.known-ligand-card-title {
    font-weight: 800;
    color: #0f172a;
    line-height: 1.4;
}

.known-ligand-card-meta {
    color: #64748b;
    font-size: 0.86rem;
    line-height: 1.45;
}

.known-ligand-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.known-ligand-badge-cofactor {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.known-ligand-choice-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.known-ligand-choice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
    color: #334155;
}

.known-ligand-choice input {
    margin: 0;
}

.known-ligand-annotation {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.known-ligand-annotation strong {
    font-size: 0.74rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #64748b;
}

.known-ligand-annotation code {
    display: block;
    padding: 8px 10px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #dbe4f0;
    color: #0f172a;
    font-size: 0.78rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-all;
}

.known-ligand-annotation span {
    font-size: 0.76rem;
    color: #64748b;
    line-height: 1.4;
}

.known-ligand-smiles-preview {
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
    font-size: 0.84rem;
    color: #475569;
    word-break: break-all;
    display: flex;
    flex-direction: column;
    gap: 8px;
    white-space: normal;
}

.known-ligand-smiles-preview strong {
    display: block;
    font-size: 0.74rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #64748b;
}

.known-ligand-smiles-entry {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.known-ligand-smiles-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.known-ligand-smiles-preview code {
    display: block;
    padding: 8px 10px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #0f172a;
    font-size: 0.78rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-all;
}

.known-ligand-copy-btn {
    appearance: none;
    border: 1px solid #dbe4f0;
    background: #ffffff;
    color: #475569;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.known-ligand-copy-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

.known-ligand-smiles-preview-loading,
.known-ligand-smiles-preview-error,
.known-ligand-smiles-preview-placeholder {
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
    font-size: 0.82rem;
    line-height: 1.5;
}

.known-ligand-smiles-preview-loading {
    color: #64748b;
}

.known-ligand-smiles-preview-error {
    color: #b91c1c;
}

.known-ligand-smiles-preview-placeholder {
    color: #94a3b8;
    font-style: italic;
}

/* Weight section styling - Apple Style Cards */
.weights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Wider cards */
    gap: 24px;
    margin-top: 20px;
}

.weight-item {
    position: relative; /* For Tooltip Positioning */
    background: #fff;
    padding: 24px;
    border-radius: 18px; /* Softer Apple-like radius */
    border: 1px solid rgba(0, 0, 0, 0.04); /* Very subtle border */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04); /* Soft elevation */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.weight-item:hover {
    transform: translateY(-4px) scale(1.01); /* Slight lift and scale */
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08); /* Deeper shadow on hover */
    border-color: rgba(0, 0, 0, 0.08);
}

.weight-item label {
    margin-bottom: 16px;
    color: #1d1d1f; /* Apple's near-black text */
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.weight-item input.weight-input {
    width: 100%;
    text-align: center;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.5rem;
    border: none;
    background: #f5f5f7; /* Apple's light gray bg */
    border-radius: 12px;
    padding: 12px;
    transition: background 0.2s;
}

.weight-item input.weight-input:focus {
    background: #fff;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.sub-weights-details {
    margin-top: 16px;
    font-size: 0.9em;
    border: none;
    background: transparent;
    padding: 0;
    border-top: 1px solid #f5f5f7;
    padding-top: 12px;
}

.sub-weights-details summary {
    font-size: 0.85rem;
    color: #86868b; /* Apple's secondary text color */
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 8px;
    background: transparent;
    display: inline-block;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}
.sub-weights-details summary:hover {
    background: #f5f5f7;
    color: #1d1d1f;
}

.sub-weights-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 16px;
    padding-left: 4px;
}
.sub-weight-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fbfbfd;
    padding: 8px 12px;
    border-radius: 8px;
}
.sub-weight-item label {
    font-size: 0.85em;
    font-weight: 500;
    color: #424245;
    margin-bottom: 0;
}
.sub-weight-item input {
    width: 60px;
    padding: 6px;
    font-size: 0.9em;
    text-align: right;
    font-weight: 600;
    color: #1d1d1f;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
}

/* Tooltip Styles */
.tooltip-container {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
}

.tooltip-icon {
    width: 20px;
    height: 20px;
    background-color: #e8e8ed; /* Apple's light gray background */
    color: #1d1d1f; /* Apple's dark text */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    cursor: help;
    transition: all 0.2s ease;
    border: none; /* Removed border for cleaner look */
}

.tooltip-icon:hover {
    background-color: #d2d2d7; /* Slightly darker on hover */
    transform: none; /* Remove scale effect */
}

.tooltip-text {
    visibility: hidden;
    width: 260px; /* Slightly wider */
    background: #ffffff !important; /* Force opaque white tooltip card */
    background-color: #ffffff !important;
    color: #1d1d1f; /* Dark text */
    text-align: left;
    border-radius: 12px; /* Smooth radius */
    padding: 12px 14px;
    position: absolute;
    z-index: 100;
    bottom: 140%; /* Position above the icon */
    right: -10px; /* Align to right edge */
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.25, 0.1, 0.25, 1), visibility 0.3s, transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    font-size: 0.8rem;
    line-height: 1.4;
    font-weight: 400;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); /* Soft, diffused shadow */
    transform: translateY(10px) scale(0.95); /* Slight scale up animation */
    pointer-events: none;
    border: 1px solid rgba(0, 0, 0, 0.04); /* Subtle border */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background-image: none !important;
}

.tooltip-icon:hover + .tooltip-text,
.tooltip-icon:focus-visible + .tooltip-text {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Arrow for tooltip */
.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 14px;
    margin-left: -8px;
    border-width: 8px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent; /* Match white bg */
    filter: none;
}

.viewer-inline-tooltip,
.fixed-sites-inline-tooltip,
.section-help-tooltip,
.field-help-tooltip {
    position: relative;
    top: auto;
    right: auto;
}

.viewer-inline-tooltip .tooltip-text,
.fixed-sites-inline-tooltip .tooltip-text,
.section-help-tooltip .tooltip-text,
.field-help-tooltip .tooltip-text {
    right: 0;
    bottom: calc(100% + 10px);
    z-index: 1300;
    background: #ffffff !important;
    background-color: #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.viewer-sequence-title-row .viewer-inline-tooltip .tooltip-text {
    left: 0;
    right: auto;
    top: calc(100% + 8px);
    bottom: auto;
    transform: translateY(-4px) scale(0.95);
}

.viewer-sequence-title-row .viewer-inline-tooltip .tooltip-text::after {
    top: auto;
    bottom: 100%;
    left: 14px;
    right: auto;
    border-color: transparent transparent #fff transparent;
}

.viewer-sequence-title-row .viewer-inline-tooltip .tooltip-icon:hover + .tooltip-text,
.viewer-sequence-title-row .viewer-inline-tooltip .tooltip-icon:focus-visible + .tooltip-text {
    transform: translateY(0) scale(1);
}

.section-help-tooltip .tooltip-text {
    left: 0;
    right: auto;
}

.section-help-tooltip .tooltip-text::after {
    left: 14px;
    right: auto;
}

.field-help-tooltip .tooltip-text {
    left: auto;
    right: 0;
    width: min(320px, calc(100vw - 48px));
    max-width: min(320px, calc(100vw - 48px));
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.field-help-tooltip .tooltip-text::after {
    left: auto;
    right: 14px;
}

.field-help-tooltip-right .tooltip-text {
    left: calc(100% + 10px);
    right: auto;
    top: 50%;
    bottom: auto;
    transform: translateY(calc(-50% + 10px)) scale(0.95);
}

.field-help-tooltip-right .tooltip-icon:hover + .tooltip-text,
.field-help-tooltip-right .tooltip-icon:focus-visible + .tooltip-text {
    transform: translateY(-50%) scale(1);
}

.field-help-tooltip-right .tooltip-text::after {
    top: 50%;
    bottom: auto;
    left: -16px;
    right: auto;
    transform: translateY(-50%);
    border-color: transparent #ffffff transparent transparent;
}

.fixed-sites-mpnn-grid .field-help-label {
    position: relative;
    width: 100%;
}

.fixed-sites-mpnn-grid .field-help-tooltip {
    position: static;
}

.fixed-sites-mpnn-grid .field-help-tooltip .tooltip-text {
    left: 0;
    right: auto;
    top: auto;
    bottom: calc(100% + 10px);
    width: max-content;
    max-width: 100%;
    transform: translateY(10px) scale(0.95);
}

.fixed-sites-mpnn-grid .tooltip-icon:hover + .tooltip-text,
.fixed-sites-mpnn-grid .tooltip-icon:focus-visible + .tooltip-text {
    transform: translateY(0) scale(1);
}

.fixed-sites-mpnn-grid .field-help-tooltip .tooltip-text::after {
    top: 100%;
    bottom: auto;
    left: 14px;
    right: auto;
    transform: none;
    border-color: #ffffff transparent transparent transparent;
}

.section-heading-row,
.field-label-with-help {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-heading-row {
    margin-bottom: 6px;
}

.section-heading-row h3,
.field-label-with-help label {
    margin: 0;
}

.field-label-with-help {
    margin-bottom: 6px;
}

.compact-summary-text {
    margin-top: 0;
}

.fixed-sites-stage-tooltip {
    width: 240px;
}

.fixed-sites-stage-tooltip .hint,
.tooltip-text p {
    margin: 0 0 6px;
}

.fixed-sites-stage-tooltip .hint:last-child,
.tooltip-text p:last-child {
    margin-bottom: 0;
}

/* Button styles - Apple Style Button */
.btn-primary {
    background-color: #0071e3; /* Apple Blue */
    color: white;
    border: none;
    padding: 18px 40px; /* Taller, wider button */
    border-radius: 980px; /* Pill shape */
    font-size: 17px;
    font-weight: 400; /* Regular weight, not bold */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0, 0, 0.44, 1.18);
    box-shadow: none; /* Apple buttons usually flat or subtle */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -0.016em;
    min-width: 200px; /* Minimum width */
    margin-top: 40px;
}

.btn-primary:hover {
    background-color: #0077ed; /* Slightly lighter on hover */
    transform: scale(1.02); /* Subtle grow */
    box-shadow: 0 4px 14px rgba(0, 113, 227, 0.3);
}

.btn-primary:active {
    transform: scale(0.98); /* Press effect */
    background-color: #006edb;
}

.btn-block { 
    width: 100%; 
    max-width: 400px; /* Don't let it get too wide on huge screens */
    margin-left: auto;
    margin-right: auto;
    display: flex;
}

.btn-secondary {
    background-color: white;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-secondary:hover {
    border-color: #cbd5e1;
    background-color: #f8fafc;
}

.results-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.2;
    box-sizing: border-box;
}

.results-download-btn.btn-primary {
    box-shadow: 0 10px 24px rgba(0, 113, 227, 0.22);
}

.results-download-btn.btn-secondary:disabled {
    opacity: 1;
    background: #f8fafc;
    color: #94a3b8;
    border-color: #e2e8f0;
    box-shadow: none;
}

.btn-download-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-download-inline svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
    box-shadow: none;
}

.btn-sm { padding: 4px 8px; font-size: 12px; }

.error-message { 
    background: #fef2f2;
    color: var(--danger-color);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #fee2e2;
    margin-top: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.hidden { display: none !important; }

.demo-hero-card {
    border: 1px solid rgba(37, 99, 235, 0.12);
    box-shadow: 0 18px 42px rgba(37, 99, 235, 0.08);
}

.demo-hero-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.demo-hero-header h3 {
    margin: 0 0 8px;
}

.demo-hero-actions {
    display: flex;
    align-items: center;
}

.demo-note-card {
    margin-top: 20px;
}

.demo-stage-nav-btn.is-current {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(39, 94, 254, 0.08);
}

.demo-stage-current {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 16px 36px rgba(37, 99, 235, 0.08);
}

.demo-structure-box {
    margin-top: 20px;
}

.demo-structure-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.demo-structure-canvas {
    min-height: 240px;
    margin-top: 18px;
    border-radius: 18px;
    border: 1px dashed #93c5fd;
    background:
        radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.16), transparent 35%),
        radial-gradient(circle at 78% 30%, rgba(16, 185, 129, 0.14), transparent 30%),
        linear-gradient(135deg, #eff6ff, #f8fafc);
    color: #1d4ed8;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    letter-spacing: 0.02em;
}

.demo-sequence-track {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.demo-sequence-residue {
    min-width: 24px;
    height: 24px;
    padding: 0 4px;
    border-radius: 8px;
    background: #e2e8f0;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.demo-sequence-residue.is-highlighted {
    background: rgba(37, 99, 235, 0.16);
    color: #1d4ed8;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.24);
}

.demo-deliverable-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.demo-deliverable-card strong {
    display: block;
    font-size: 1rem;
    line-height: 1.5;
    color: #0f172a;
}

.demo-panel-footer {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.evaluation-tab-btn:disabled,
.btn-secondary:disabled,
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

@media (max-width: 900px) {
    .demo-hero-actions {
        width: 100%;
    }

    .demo-hero-actions .btn-primary {
        width: 100%;
        text-align: center;
    }

    .demo-panel-footer {
        align-items: stretch;
    }
}

/* Status Page Layout */
.layout-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: #f1f5f9;
}

.status-header {
    background: white;
    padding: 0 40px;
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

body.has-app-shell {
    background: #f6f8fb;
    color: #162033;
    padding-top: 88px;
}

.app-shell-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.app-shell-inner {
    max-width: 1380px;
    margin: 0 auto;
    padding: 0 24px;
}

.app-shell-header .app-shell-inner {
    min-height: 88px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.app-shell-header .zhang-lab-logo {
    position: relative;
    top: auto;
    left: auto;
}

.app-shell-brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: #0f172a;
    min-width: 0;
}

.app-shell-brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.04em;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18);
}

.app-shell-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-shell-brand-text strong {
    font-size: 1rem;
    line-height: 1.1;
}

.app-shell-brand-text small {
    font-size: 0.74rem;
    color: #64748b;
    margin-top: 2px;
    white-space: nowrap;
}

.app-shell-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.app-shell-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    text-decoration: none;
    color: #334155;
    font-weight: 700;
    font-size: 0.92rem;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.app-shell-link:hover {
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
}

.app-shell-link.active {
    background: #e8f0ff;
    color: #1d4ed8;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.app-shell-footer {
    margin-top: 48px;
    position: relative;
    z-index: 20;
    background: #fff;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.app-shell-footer-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: #475569;
    font-size: 0.9rem;
}

.app-shell-footer-inner strong {
    color: #0f172a;
    margin-right: 8px;
}

.app-shell-notice-stack {
    position: fixed;
    top: 104px;
    right: 24px;
    z-index: 1400;
    display: grid;
    gap: 12px;
    max-width: min(420px, calc(100vw - 32px));
}

.app-shell-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.96);
    color: #f8fafc;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.app-shell-notice.closing {
    opacity: 0;
    transform: translateY(-6px);
}

.app-shell-notice-info {
    background: rgba(15, 23, 42, 0.96);
}

.app-shell-notice-success {
    background: rgba(6, 95, 70, 0.96);
}

.app-shell-notice-warning {
    background: rgba(146, 64, 14, 0.97);
}

.app-shell-notice-error {
    background: rgba(153, 27, 27, 0.97);
}

.app-shell-notice-body {
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;
    min-width: 0;
    max-width: 100%;
    flex: 1;
    line-height: 1.45;
    font-size: 0.94rem;
}

.app-shell-notice-close {
    appearance: none;
    border: none;
    background: transparent;
    color: inherit;
    font-weight: 700;
    cursor: pointer;
    opacity: 0.78;
    padding: 0;
}

.app-shell-notice-close:hover {
    opacity: 1;
}

.app-page {
    width: 100%;
    max-width: 1380px;
    margin: 0 auto;
    padding: 28px 24px 0;
}

.app-page-narrow {
    max-width: 1180px;
}

.page-hero {
    margin-bottom: 24px;
}

.page-hero h1,
.page-hero h2 {
    overflow-wrap: anywhere;
    margin: 0;
    font-size: 2rem;
    color: #0f172a;
}

.page-hero p {
    margin: 10px 0 0;
    color: #516074;
    max-width: 840px;
    font-size: 1rem;
}

.page-surface {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 24px;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.08);
    padding: 28px;
}

.page-stack {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
}

.page-stack > * {
    min-width: 0;
}

@media (max-width: 600px) {
    :is(body[data-nav="auto"], body[data-interactive-page="new"]) .app-page {
        padding-inline: 12px;
    }

    :is(body[data-nav="auto"], body[data-interactive-page="new"]) .page-surface {
        padding: 12px;
    }

    :is(body[data-nav="auto"], body[data-interactive-page="new"]) :is(.form-section, .source-block) {
        padding: 16px;
        border-radius: 16px;
    }
}

.page-hero-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.page-hero-copy {
    min-width: 0;
}

.page-hero-meta {
    margin-top: 10px;
    color: #516074;
    font-size: 0.95rem;
    font-weight: 700;
}

.example-project-banner {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px 18px;
    border: 1px solid rgba(185, 28, 28, 0.22);
    border-left: 6px solid #b91c1c;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(254, 242, 242, 0.98), rgba(255, 255, 255, 0.98));
    box-shadow: 0 10px 28px rgba(185, 28, 28, 0.08);
}

.example-project-banner-title {
    margin: 0;
    color: #991b1b;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.example-project-banner-text {
    color: #7f1d1d;
    font-size: 0.96rem;
    line-height: 1.5;
}

.example-project-banner-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.example-project-banner-chip {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(185, 28, 28, 0.1);
    color: #991b1b;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.example-project-banner-chip.muted {
    background: rgba(127, 29, 29, 0.08);
    color: #7f1d1d;
}

.page-hero-button-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.fixed-sites-hero-button-row {
    align-items: center;
    gap: 12px;
}

.fixed-sites-hero-button-row .btn-primary,
.fixed-sites-hero-button-row .btn-secondary {
    margin-top: 0;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.fixed-sites-hero-button-row .btn-primary {
    min-width: 230px;
    padding: 12px 24px;
}

.fixed-sites-hero-button-row .btn-secondary {
    min-height: 48px;
    padding: 12px 18px;
    border-radius: 999px;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .example-project-banner {
        padding: 14px 14px;
    }

    .fixed-sites-hero-button-row {
        justify-content: flex-start;
    }
}

.page-surface-shell {
    padding: 0;
    overflow: visible;
    --workflow-sidebar-safe-gap: 24px;
}

.page-surface-shell .content-wrapper {
    display: grid;
    grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
    gap: 0;
    overflow: visible;
    align-items: stretch;
    min-height: auto;
    min-width: 0;
    width: 100%;
}

.page-surface-shell .content-wrapper.fixed-sites-single-workspace {
    display: block;
}

.page-surface-shell .progress-sidebar {
    box-shadow: none;
    border-right: 1px solid var(--border-color);
    width: 100%;
    max-width: none;
    min-width: 0;
    align-self: stretch;
    position: relative;
    padding: 0;
    overflow: visible;
    background: #f8fafc;
}

.page-surface-shell .progress-sidebar-inner {
    display: flex;
    flex-direction: column;
    gap: 30px;
    min-height: 100%;
    height: auto;
    padding: 30px;
    background: #fff;
    box-sizing: border-box;
}

@media (min-width: 1101px) {
    .page-surface-shell {
        --workflow-page-max-width: 1380px;
        --workflow-page-gutter: 24px;
        --workflow-sidebar-width: 320px;
        --workflow-sidebar-left: 24px;
        --workflow-sidebar-top: 104px;
    }

    .page-surface-shell .content-wrapper {
        grid-template-columns: var(--workflow-sidebar-width) minmax(0, 1fr);
    }

    .page-surface-shell .progress-sidebar {
        position: relative;
        top: auto;
    }

    .page-surface-shell .progress-sidebar-inner {
        width: 100%;
        height: auto;
    }
}

.page-surface-shell .results-main {
    background: #f8fafc;
    width: 100%;
    min-width: 0;
    min-height: auto;
    overflow-x: visible;
    overflow-y: visible;
}

.page-surface-shell .results-main.fixed-sites-workbench-main {
    padding: 28px;
}

.page-surface-shell .results-main > * {
    min-width: 0;
}

.page-surface-shell .table-scroll {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

@media (max-width: 1100px) {
    .page-surface-shell .content-wrapper {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .page-surface-shell .progress-sidebar {
        align-self: stretch;
        position: static;
        max-height: none;
        overflow: visible;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .page-surface-shell .progress-sidebar-inner {
        min-height: auto;
        height: auto;
        padding: 24px;
    }
}

.page-surface-shell .page-section-pad {
    padding: 28px;
}

.fixed-sites-stage-strip {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.fixed-sites-stage-strip-copy {
    min-width: 0;
}

.fixed-sites-next-stage-card {
    margin-top: 14px;
}

.fixed-sites-next-stage-head {
    align-items: flex-start;
    margin-bottom: 12px;
}

.fixed-sites-next-stage-card h4 {
    margin: 0;
    color: #0f172a;
    font-size: 0.98rem;
}

.fixed-sites-mpnn-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px 14px;
}

.fixed-sites-mpnn-wide {
    grid-column: span 2;
}

.fixed-sites-mpnn-textarea {
    min-height: 88px;
    resize: vertical;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.82rem;
    line-height: 1.5;
}

.fixed-sites-mpnn-upload-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: 8px;
}

.fixed-sites-mpnn-upload-row .btn-secondary {
    margin-top: 0;
    min-width: 0;
}

.fixed-sites-mpnn-upload-row .hint {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.45;
}

.fixed-sites-mpnn-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 12px;
    margin-top: 14px;
}

.fixed-sites-mpnn-apply-status {
    color: #475569;
    font-size: 0.84rem;
    line-height: 1.45;
}

.fixed-sites-mpnn-apply-status.pending {
    color: #92400e;
}

.fixed-sites-mpnn-apply-status.applied {
    color: #166534;
}

.fixed-sites-stage-strip-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
}

.fixed-sites-stage-strip-head-compact {
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px 10px;
    margin-top: 0;
}

.fixed-sites-stage-strip-title {
    min-width: 0;
    flex: 1 1 auto;
}

.fixed-sites-stage-strip h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1rem;
}

.fixed-sites-stage-strip-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: 8px;
}

.fixed-sites-stage-strip-meta-compact {
    margin-top: 6px;
    justify-content: flex-start;
}

.fixed-sites-stage-status-line {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.35;
}

.fixed-sites-stage-notice {
    margin: 0;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(245, 158, 11, 0.28);
    background: #fff8eb;
    color: #92400e;
    font-size: 0.84rem;
    line-height: 1.45;
    max-width: min(920px, 100%);
}

.fixed-sites-stage-route-label {
    margin-left: 6px;
}

.fixed-sites-stage-route {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.fixed-sites-stage-draft {
    font-weight: 700;
    color: #0f172a;
}

.fixed-sites-stage-strip-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    min-width: 0;
    width: 100%;
    max-width: none;
    align-self: start;
}

.fixed-sites-stage-strip-actions .btn-primary,
.fixed-sites-stage-strip-actions .btn-secondary,
.fixed-sites-stage-strip-actions .fixed-sites-stage-strip-btn {
    min-height: 42px;
    min-width: 0;
    width: 100%;
}

.fixed-sites-stage-strip-actions .btn-primary,
.fixed-sites-stage-strip-actions .btn-secondary,
.fixed-sites-stage-strip-actions .fixed-sites-stage-strip-btn,
.fixed-sites-submit-row .btn-primary,
.fixed-sites-submit-row .btn-secondary {
    margin-top: 0;
    min-width: 220px;
    width: auto;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
}

.viewer-header-actions > .btn-primary,
.viewer-header-actions > .btn-secondary {
    margin-top: 0;
    min-width: 0;
    width: 100%;
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.15;
    font-size: 0.78rem;
    white-space: normal;
    overflow-wrap: anywhere;
}

.fixed-sites-stage-strip-actions .btn-primary,
.fixed-sites-stage-strip-actions .btn-secondary,
.fixed-sites-stage-strip-actions .fixed-sites-stage-strip-btn,
.fixed-sites-submit-row .btn-primary,
.fixed-sites-submit-row .btn-secondary {
    font-size: 0.92rem;
    font-weight: 700;
}

.fixed-sites-stage-hidden-notes {
    display: none;
}

@media (max-width: 1100px) {
    .fixed-sites-stage-strip {
        grid-template-columns: 1fr;
    }

    .fixed-sites-stage-strip-actions {
        min-width: 0;
        width: 100%;
    }

    .fixed-sites-mpnn-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fixed-sites-mpnn-wide {
        grid-column: span 2;
    }
}

@media (max-width: 720px) {
    .page-surface-shell .results-main.fixed-sites-workbench-main {
        padding: 18px;
    }

    .fixed-sites-stage-strip-head {
        flex-direction: column;
        align-items: stretch;
    }

    .fixed-sites-stage-strip-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .fixed-sites-mpnn-grid {
        grid-template-columns: 1fr;
    }

    .fixed-sites-mpnn-wide {
        grid-column: span 1;
    }

    .fixed-sites-submit-row {
        justify-content: center;
    }
}

.top-tab-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.homepage-entry-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.homepage-entry-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 132px;
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    color: #0f172a;
    text-decoration: none;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.homepage-entry-card:hover {
    transform: translateY(-1px);
    border-color: rgba(37, 99, 235, 0.2);
    box-shadow: 0 16px 34px rgba(37, 99, 235, 0.08);
}

.homepage-entry-card strong {
    color: #0f172a;
    font-size: 1rem;
}

.homepage-entry-card span {
    color: #516074;
    line-height: 1.55;
}

.top-tab-btn {
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: #fff;
    color: #334155;
    border-radius: 999px;
    padding: 11px 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.top-tab-btn.active {
    background: #e8f0ff;
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.2);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

body[data-nav="history"] .page-stack {
    grid-template-columns: minmax(0, 1fr);
}

.project-history-table th,
.project-history-table td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: top;
}

.project-history-table {
    width: 100%;
    min-width: 1100px;
    table-layout: fixed;
}

.results-table.project-history-table th,
.results-table.project-history-table td {
    padding: 12px 10px;
    font-size: 0.9rem;
}

.project-history-table th:nth-child(1),
.project-history-table td:nth-child(1) {
    width: 18%;
}

.project-history-table th:nth-child(2),
.project-history-table td:nth-child(2) {
    width: 16%;
}

.project-history-table th:nth-child(3),
.project-history-table td:nth-child(3) {
    width: 15%;
}

.project-history-table th:nth-child(4),
.project-history-table td:nth-child(4) {
    width: 11%;
}

.project-history-table th:nth-child(5),
.project-history-table td:nth-child(5),
.project-history-table th:nth-child(6),
.project-history-table td:nth-child(6) {
    width: 13%;
}

.project-history-table th:nth-child(7),
.project-history-table td:nth-child(7) {
    width: 14%;
}

.project-history-table .table-action-group > .table-action-link {
    flex: 0 0 auto;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}

.table-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 76px;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    text-decoration: none;
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 700;
}

.table-action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.table-action-button {
    border: none;
    cursor: pointer;
    font: inherit;
}

.table-action-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    line-height: 1;
}

.table-action-icon-button:hover:not(:disabled) {
    background: rgba(37, 99, 235, 0.14);
}

.table-action-icon-button svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.table-action-button-download {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.table-action-button-download svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.table-action-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.project-info-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.project-info-item {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    padding: 16px 18px;
}

.project-info-item span {
    display: block;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 6px;
}

.project-action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.project-info-item strong {
    display: block;
    color: #0f172a;
    font-size: 1rem;
}

.timeline-stage-list {
    display: grid;
    gap: 16px;
    width: 100%;
    min-width: 0;
}

.timeline-top-section {
    margin-bottom: 4px;
}

.timeline-stage-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.timeline-stage-nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
    min-height: 64px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

@media (min-width: 900px) and (max-width: 1339px) {
    .timeline-stage-nav {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1340px) {
    .timeline-stage-nav {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 8px;
    }

    .timeline-stage-nav-btn {
        gap: 8px;
        min-height: 58px;
        padding: 10px 10px;
        border-radius: 14px;
    }

    .timeline-stage-nav-index {
        width: 28px;
        height: 28px;
        font-size: 0.84rem;
    }

    .timeline-stage-nav-copy strong {
        font-size: 0.8rem;
        line-height: 1.2;
    }

    .timeline-stage-nav-copy small {
        font-size: 0.64rem;
        letter-spacing: 0.04em;
    }
}

.timeline-stage-nav-btn:hover {
    border-color: rgba(37, 99, 235, 0.28);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.08);
    transform: translateY(-1px);
}

.timeline-stage-nav-btn.stage-completed {
    background: #f0fdf4;
}

.timeline-stage-nav-btn.stage-current {
    background: #eff6ff;
}

.timeline-stage-nav-btn.stage-pending {
    background: #f8fafc;
}

.timeline-stage-nav-btn.timeline-stage-nav-btn-active {
    border-color: rgba(37, 99, 235, 0.42);
    box-shadow: 0 14px 32px rgba(37, 99, 235, 0.14);
}

.timeline-stage-nav-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #1d4ed8;
    font-weight: 800;
    flex: 0 0 auto;
}

.timeline-stage-nav-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.timeline-stage-nav-copy strong {
    color: #0f172a;
    font-size: 0.9rem;
    line-height: 1.24;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
}

.timeline-stage-nav-copy small {
    color: #475569;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    overflow-wrap: anywhere;
}

.timeline-stage-card-list {
    display: grid;
    gap: 16px;
}

.timeline-stage-empty-state {
    display: grid;
    gap: 6px;
    padding: 18px 20px;
    border: 1px dashed rgba(100, 116, 139, 0.28);
    border-radius: 18px;
    background: #f8fafc;
}

.timeline-stage-empty-state strong {
    color: #0f172a;
    font-size: 0.95rem;
}

.timeline-stage-empty-state span {
    color: #516074;
    font-size: 0.92rem;
    line-height: 1.5;
}

.timeline-stage-card {
    position: relative;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
}

.timeline-stage-card.stage-completed {
    border-color: rgba(14, 116, 144, 0.18);
}

.timeline-stage-card.stage-failed {
    border-color: rgba(220, 38, 38, 0.24);
    box-shadow: 0 16px 36px rgba(220, 38, 38, 0.08);
}

.timeline-stage-card.stage-current {
    border-color: rgba(37, 99, 235, 0.24);
    box-shadow: 0 16px 36px rgba(37, 99, 235, 0.1);
}

.timeline-stage-card.stage-pending {
    background: #f8fafc;
}

.timeline-stage-card.timeline-stage-focus {
    box-shadow: 0 18px 40px rgba(37, 99, 235, 0.14);
    border-color: rgba(37, 99, 235, 0.28);
}

.timeline-stage-card.timeline-stage-card-hidden {
    display: none;
}

.timeline-stage-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.timeline-stage-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 800;
    flex: 0 0 auto;
}

.timeline-stage-title {
    flex: 1 1 auto;
    min-width: 0;
}

.timeline-stage-title h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1.1rem;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
}

.timeline-stage-type-chip {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    margin-top: 8px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.timeline-stage-type-chip.stage-type-user_config {
    background: #ecfccb;
    color: #3f6212;
}

.timeline-stage-type-chip.stage-type-backend_compute {
    background: #ede9fe;
    color: #6d28d9;
}

.timeline-stage-title p {
    margin: 8px 0 0;
    color: #516074;
}

.timeline-stage-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 98px;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.timeline-stage-badge.badge-completed {
    background: #dcfce7;
    color: #166534;
}

.timeline-stage-badge.badge-failed {
    background: #fee2e2;
    color: #b91c1c;
}

.timeline-stage-badge.badge-current {
    background: #dbeafe;
    color: #1d4ed8;
}

.timeline-stage-badge.badge-pending {
    background: #e2e8f0;
    color: #475569;
}

.timeline-stage-status-panel {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.timeline-stage-status-panel.status-completed {
    background: #f0fdf4;
    border-color: rgba(22, 101, 52, 0.14);
}

.timeline-stage-status-panel.status-failed {
    background: #fef2f2;
    border-color: rgba(185, 28, 28, 0.14);
}

.timeline-stage-status-panel.status-current {
    background: #eff6ff;
    border-color: rgba(37, 99, 235, 0.14);
}

.timeline-stage-status-panel.status-pending {
    background: #f8fafc;
    border-color: rgba(100, 116, 139, 0.14);
}

.timeline-stage-status-mode {
    color: #0f172a;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.timeline-stage-status-copy {
    color: #516074;
    font-size: 0.95rem;
    line-height: 1.55;
}

.timeline-stage-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
    margin-bottom: 16px;
}

.timeline-stage-kv {
    background: #f8fafc;
    border-radius: 14px;
    padding: 12px 14px;
}

.timeline-stage-kv span {
    display: block;
    font-size: 0.76rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}

.timeline-stage-kv strong,
.timeline-stage-kv div {
    color: #0f172a;
    font-size: 0.95rem;
    line-height: 1.45;
}

.timeline-stage-metric-value {
    word-break: break-word;
}

.timeline-stage-metric-value-nowrap {
    display: inline-block;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}

.timeline-stage-metric-download {
    display: inline-flex;
    align-items: center;
    margin-top: 8px;
    color: #2563eb;
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
}

.timeline-stage-metric-download:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.timeline-stage-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.timeline-stage-link {
    display: inline-flex;
    align-items: center;
    color: #2563eb;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
}

.timeline-stage-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.timeline-stage-card.timeline-stage-compact {
    padding: 18px;
}

.timeline-stage-card.timeline-stage-compact .timeline-stage-head {
    margin-bottom: 12px;
}

.timeline-stage-card.timeline-stage-compact .timeline-stage-title h3 {
    font-size: 1rem;
}

.timeline-stage-card.timeline-stage-compact .timeline-stage-title p {
    font-size: 0.92rem;
}

.timeline-stage-note {
    margin: 0 0 14px;
    color: #516074;
}

.example-project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.resource-link-list {
    display: grid;
    gap: 12px;
}

.resource-link-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    text-decoration: none;
    color: inherit;
    background: #fff;
}

.resource-link-card strong {
    color: #0f172a;
}

.resource-link-card span {
    color: #516074;
}

.inline-callout {
    border: 1px solid rgba(37, 99, 235, 0.14);
    background: #f8fbff;
    border-radius: 18px;
    padding: 18px 20px;
}

@media (max-width: 980px) {
    .app-shell-header .app-shell-inner,
    .app-shell-footer-inner {
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        padding-top: 14px;
        padding-bottom: 14px;
    }

    body.has-app-shell {
        padding-top: 132px;
    }

    .project-info-row,
    .timeline-stage-grid,
    .timeline-stage-nav,
    .homepage-entry-grid {
        grid-template-columns: 1fr;
    }
}

.task-info h2 { margin: 0; font-size: 1.25rem; }
.task-info {
    min-width: 0;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.task-id-display { 
    display: inline-flex;
    max-width: 100%;
    font-family: 'JetBrains Mono', monospace; 
    font-size: 0.9rem; 
    color: var(--secondary-color);
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 4px;
    margin-left: 12px;
    white-space: normal;
    word-break: break-word;
}

.history-table-wrap {
    overflow-x: auto;
}

.history-simple-table {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
}

.history-simple-table th,
.history-simple-table td {
    vertical-align: middle;
}

.history-status-cell {
    width: 220px;
}

.history-project-link {
    color: #0f172a;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    word-break: break-word;
}

.history-project-link:hover {
    color: #1d4ed8;
}

.history-table-row {
    cursor: pointer;
}

@media (max-width: 900px) {
    .status-header {
        height: auto;
        padding: 16px 20px;
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .task-id-display {
        display: inline-block;
        margin-left: 0;
        margin-top: 8px;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .evaluation-tab-header {
        align-items: stretch;
    }

    .evaluation-tab-buttons {
        width: 100%;
    }

    .evaluation-tab-btn {
        flex: 1 1 0;
    }

    .evaluation-toolbar-left,
    .evaluation-toolbar-right {
        width: 100%;
    }

    .evaluation-toolbar-left .btn-secondary,
    .evaluation-toolbar-left .btn-primary,
    .evaluation-toolbar-right .btn-secondary,
    .evaluation-toolbar-right .btn-primary {
        flex: 1 1 calc(50% - 6px);
    }

    .evaluation-modal-card {
        padding: 18px;
    }

    .evaluation-modal-header {
        flex-direction: column;
    }

    .eda-bar-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

.content-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 1px; /* Separator */
    min-height: 0;
}

.progress-sidebar {
    width: 296px;
    background: white;
    border-right: 1px solid var(--border-color);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: 4px 0 24px rgba(0,0,0,0.02);
    z-index: 5;
    overflow-y: auto;
    min-height: 0;
}

.progress-card {
    text-align: center;
}

.stage-shell-card {
    text-align: left;
}

.stage-shell-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-top: 6px;
}

.stage-shell-copy {
    min-width: 0;
    flex: 1 1 auto;
}

.stage-shell-copy h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1rem;
}

.stage-shell-type {
    margin-top: 6px;
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #ecfeff;
    color: #155e75;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.stage-shell-submeta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
}

.stage-navigation-card {
    text-align: left;
}

.stage-navigation-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.stage-navigation-card .stage-navigation-btn {
    width: 100%;
    max-width: none;
    min-width: 0;
    min-height: 42px;
    margin: 0;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
    text-decoration: none;
    box-sizing: border-box;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.stage-navigation-card .stage-navigation-btn.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid rgba(59, 130, 246, 0.28);
}

.stage-navigation-card .stage-navigation-btn.btn-secondary:hover {
    background: #dbeafe;
    border-color: rgba(37, 99, 235, 0.34);
}

.stage-navigation-card .stage-navigation-btn.btn-primary {
    min-width: 0;
}

.stage-navigation-card .stage-navigation-actions .btn-block + .btn-block {
    margin-top: 0 !important;
}

.stage-navigation-card .summary-value {
    margin: 0;
}

.progress-sidebar .form-section,
.progress-sidebar .progress-card {
    padding: 18px;
}

.progress-sidebar .current-stage {
    margin: 10px 0 0;
    font-size: 0.92rem;
}

.progress-sidebar .hint {
    margin-top: 8px;
    font-size: 0.78rem;
    line-height: 1.45;
}

.progress-sidebar .btn-block + .btn-block {
    margin-top: 10px !important;
}

.results-main {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    background: #f8fafc;
    min-height: 0;
}

@media (max-width: 1200px) {
    .results-detail-viewer-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Results Table */
.results-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    /* border-radius: 12px; Remove radius here as container handles it */
    /* overflow: hidden; Remove overflow here */
    box-shadow: none; /* Remove shadow as card has it */
    border: none; /* Remove border */
}

.all-results-card .table-responsive {
    max-height: 600px; /* Allow vertical scrolling for long lists */
    overflow-y: auto;
    border-top: 1px solid var(--border-color); /* Separator from header */
}

.results-table th, .results-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.results-table th { 
    background: #f8fafc; 
    font-weight: 600; 
    color: #475569;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky; /* Sticky header */
    top: 0;
    z-index: 10;
}
.results-table tr:last-child td { border-bottom: none; }
.results-table tr:hover { background-color: #f8fafc; }

/* Log Area - Apple Style */
.log-area {
    flex: 1;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.log-area:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.log-area h4 { 
    margin: 0; 
    padding: 16px 20px;
    background: #fff;
    color: #1d1d1f;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.log-content {
    flex: 1;
    padding: 20px;
    font-family: "SF Mono", "Menlo", "Monaco", "Courier New", monospace;
    font-size: 13px;
    color: #424245; /* Dark gray text */
    line-height: 1.6;
    background: #fbfbfd; /* Very subtle grey background for content */
    overflow-y: auto;
}

.log-item { 
    margin-bottom: 6px; 
    padding-left: 12px;
    border-left: 2px solid transparent;
}

.log-item.error { 
    color: #d70015; /* Apple Red */
    border-left-color: #d70015;
    background: rgba(215, 0, 21, 0.05);
    padding: 4px 12px;
    border-radius: 0 4px 4px 0;
}

.log-item.success { 
    color: #008844; /* Apple Green */
    border-left-color: #008844;
}

/* Progress Circle */
.progress-circle-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.progress-ring__circle {
    transition: stroke-dashoffset 0.35s;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

.status-badge {
    text-align: center;
    padding: 5px 10px;
    border-radius: 15px;
    background: #e9ecef;
    font-weight: bold;
    margin: 10px 0;
}
.status-badge.status-idle { background: #e2e8f0; color: #334155; }
.status-badge.status-queued { background: #fef3c7; color: #92400e; }
.status-badge.status-waiting { background: #fef9c3; color: #854d0e; border: 1px dashed #d97706; }
.status-badge.status-running { background: #dbeafe; color: #1d4ed8; }
.status-badge.status-completed { background: #dcfce7; color: #166534; }
.status-badge.status-canceled { background: #e2e8f0; color: #475569; }
.status-badge.status-failed { background: #f8d7da; color: #721c24; }

/* Waiting-room position + cancel control rendered next to a stage badge */
.stage-task-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
    vertical-align: middle;
}
.stage-queue-position {
    font-size: 12px;
    color: #854d0e;
    background: #fef9c3;
    border: 1px dashed #d97706;
    border-radius: 12px;
    padding: 3px 10px;
    white-space: nowrap;
}
.stage-task-cancel-btn, .stage-task-retry-btn {
    font-size: 12px;
    font-weight: 600;
    color: #b91c1c;
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 12px;
    padding: 3px 12px;
    cursor: pointer;
    white-space: nowrap;
}
.stage-task-cancel-btn:hover { background: #fecaca; }
.stage-task-retry-btn { color: #1d4ed8; background: #dbeafe; border-color: #93c5fd; }
.stage-task-retry-btn:hover { background: #bfdbfe; }
.stage-task-cancel-btn:disabled, .stage-task-retry-btn:disabled { opacity: 0.6; cursor: default; }

/* Spinner - Kept custom loader */
/* From Uiverse.io by Nawsome */
.loader {
    --background: linear-gradient(135deg, #23C4F8, #275EFE);
    --shadow: rgba(39, 94, 254, 0.28);
    --text: #6C7486;
    --page: rgba(255, 255, 255, 0.36);
    --page-fold: rgba(255, 255, 255, 0.52);
    --duration: 3s;
    width: 200px;
    height: 140px;
    position: relative;
    margin: 0 auto 80px; /* Center it and add space for text below */
}

.loader:before, .loader:after {
    --r: -6deg;
    content: "";
    position: absolute;
    bottom: 8px;
    width: 120px;
    top: 80%;
    box-shadow: 0 16px 12px var(--shadow);
    transform: rotate(var(--r));
}

.loader:before {
    left: 4px;
}

.loader:after {
    --r: 6deg;
    right: 4px;
}

.loader div {
    width: 100%;
    height: 100%;
    border-radius: 13px;
    position: relative;
    z-index: 1;
    perspective: 600px;
    box-shadow: 0 4px 6px var(--shadow);
    background-image: var(--background);
}

.loader div ul {
    margin: 0;
    padding: 0;
    list-style: none;
    position: relative;
}

.loader div ul li {
    --r: 180deg;
    --o: 0;
    --c: var(--page);
    position: absolute;
    top: 10px;
    left: 10px;
    transform-origin: 100% 50%;
    color: var(--c);
    opacity: var(--o);
    transform: rotateY(var(--r));
    -webkit-animation: var(--duration) ease infinite;
    animation: var(--duration) ease infinite;
}

.loader div ul li:nth-child(2) {
    --c: var(--page-fold);
    -webkit-animation-name: page-2;
    animation-name: page-2;
}

.loader div ul li:nth-child(3) {
    --c: var(--page-fold);
    -webkit-animation-name: page-3;
    animation-name: page-3;
}

.loader div ul li:nth-child(4) {
    --c: var(--page-fold);
    -webkit-animation-name: page-4;
    animation-name: page-4;
}

.loader div ul li:nth-child(5) {
    --c: var(--page-fold);
    -webkit-animation-name: page-5;
    animation-name: page-5;
}

.loader div ul li svg {
    width: 90px;
    height: 120px;
    display: block;
}

.loader div ul li:first-child {
    --r: 0deg;
    --o: 1;
}

.loader div ul li:last-child {
    --o: 1;
}

.loader span {
    display: block;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    margin-top: 20px;
    text-align: center;
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

@keyframes page-2 {
    0% {
        transform: rotateY(180deg);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    35%, 100% {
        opacity: 0;
    }

    50%, 100% {
        transform: rotateY(0deg);
    }
}

@keyframes page-3 {
    15% {
        transform: rotateY(180deg);
        opacity: 0;
    }

    35% {
        opacity: 1;
    }

    50%, 100% {
        opacity: 0;
    }

    65%, 100% {
        transform: rotateY(0deg);
    }
}

@keyframes page-4 {
    30% {
        transform: rotateY(180deg);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    65%, 100% {
        opacity: 0;
    }

    80%, 100% {
        transform: rotateY(0deg);
    }
}

@keyframes page-5 {
    45% {
        transform: rotateY(180deg);
        opacity: 0;
    }

    65% {
        opacity: 1;
    }

    80%, 100% {
        opacity: 0;
    }

    95%, 100% {
        transform: rotateY(0deg);
    }
}

.empty-state {
    text-align: center;
    padding: 50px;
    color: #666;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px; /* Limit height */
}

/* Top Candidate Card - Apple Style */
.top-candidate-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); /* Apple-like depth */
    margin-bottom: 40px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.02);
    transition: transform 0.3s ease;
}

/* All Results Card */
.all-results-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.all-results-card .card-header {
    background: linear-gradient(to right, #f9fafb, #fff);
    padding: 20px 30px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-download-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(0, 113, 227, 0.1);
    color: #0071e3;
    border-radius: 980px; /* Pill shape */
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-download-card:hover {
    background: #0071e3;
    color: white;
}

.btn-download-card svg {
    width: 16px;
    height: 16px;
}

.top-candidate-card:hover {
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(to right, #f9fafb, #fff);
    padding: 20px 30px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    margin: 0;
    font-size: 1.4rem;
    color: #1d1d1f;
}

.rank-badge {
    background: linear-gradient(135deg, #FFD700, #FDB931); /* Gold Gradient */
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(253, 185, 49, 0.4);
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.card-body {
    padding: 30px;
}

.info-row {
    display: flex;
    margin-bottom: 15px;
    align-items: baseline;
}

.info-row .label {
    width: 140px;
    font-weight: 600;
    color: #64748b;
    flex-shrink: 0;
}

.info-row .value {
    color: #1e293b;
    font-weight: 500;
    font-family: 'SF Mono', 'Menlo', monospace;
}

.info-row .value.highlight {
    color: #0071e3;
    font-weight: 700;
    font-size: 1.1rem;
}

.info-section {
    margin-top: 25px;
}

.info-section .label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #64748b;
}

.sequence-box {
    background: #f8fafc;
    padding: 15px;
    border-radius: 12px;
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 0.9rem;
    color: #334155;
    word-break: break-word;
    line-height: 1.6;
    border: 1px solid #e2e8f0;
}

.details-box {
    background: #f8fafc; /* Light theme for JSON */
    color: #334155;
    padding: 20px;
    border-radius: 12px;
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    margin: 0;
    line-height: 1.5;
    border: 1px solid #e2e8f0;
    box-shadow: none;
}

/* Fixed-sites viewer controls: final override to keep controls readable */
body[data-nav="interactive"] .viewer-sequence-card-embedded .viewer-sequence-header {
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
    gap: 12px !important;
}

body[data-nav="interactive"] .viewer-sequence-card-embedded .viewer-header-actions {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

body[data-nav="interactive"] .viewer-sequence-card-embedded .viewer-toolbar-control-pair {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
    min-width: 0 !important;
}

body[data-nav="interactive"] .viewer-sequence-card-embedded .viewer-toolbar-control-pair > .viewer-toolbar-dropdown {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
}

body[data-nav="interactive"] .viewer-sequence-card-embedded .viewer-toolbar-dropdown {
    position: static !important;
    width: 100% !important;
    min-width: 0 !important;
}

body[data-nav="interactive"] .viewer-sequence-card-embedded .viewer-toolbar-dropdown > summary,
body[data-nav="interactive"] .viewer-sequence-card-embedded .viewer-header-actions > .viewer-toolbar-control-pair > .viewer-toolbar-dropdown > summary.btn-sm {
    display: flex !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 260px !important;
    min-height: 26px !important;
    padding: 3px 8px !important;
    margin: 0 !important;
    justify-content: center !important;
    align-items: center !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    font-size: 0.68rem !important;
    line-height: 1.1 !important;
}

body[data-nav="interactive"] .viewer-sequence-card-embedded .viewer-toolbar-dropdown > .viewer-controls-card-embedded {
    display: none !important;
}

body[data-nav="interactive"] .viewer-sequence-card-embedded .viewer-controls-dropdown[open] > .viewer-controls-card-embedded {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    margin-top: 8px !important;
}

/* Keep scientific values readable when the viewport cannot fit the table. */
.sequence-design-candidates-scroll { overflow-x: auto; }
.sequence-design-candidates-table { min-width: 1050px; }
.sequence-design-candidates-table td { overflow-wrap: anywhere; }
.results-ligand-inline-checks { flex-wrap: wrap; min-width: 0; }
:where(input, select, textarea, button, a):focus { scroll-margin-top: 130px; scroll-margin-bottom: 48px; }
@media (max-width: 768px) {
  :where(input, select, textarea, button, a):focus { scroll-margin-top: 190px; }
}

/* Wrapped navigation must not cover titles or keyboard-focused inputs. */
@media (max-width: 600px) {
  .sequence-design-page .app-page { padding-inline: 12px; }
  .sequence-design-page .page-surface-shell .results-main { padding: 12px; }
  .sequence-design-page .page-surface-shell .results-main > .form-section {
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 20px;
  }
  .sequence-design-page .summary-table-compact-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .sequence-design-page #designConstraintsTable .summary-row,
  .sequence-design-page #designRunStatusTable .summary-row {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
  }
  .sequence-design-page #designConstraintsTable .summary-key,
  .sequence-design-page #designConstraintsTable .summary-value,
  .sequence-design-page #designRunStatusTable .summary-key,
  .sequence-design-page #designRunStatusTable .summary-value {
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
  }
}

@media (max-width: 900px) {
  .app-shell-header { position: relative; }
  body.has-app-shell { padding-top: 0; }
  .app-shell-notice-stack { top: 16px; }
}

/* Leave usable space for stage controls and scientific plots on narrow screens. */
@media (max-width: 600px) {
  .app-page { padding-inline: 12px; }
  .page-surface:not(.page-surface-shell) { padding: 12px; }
  .app-page .form-section {
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 20px;
  }
  .page-surface-shell .results-main,
  .page-surface-shell .results-main.fixed-sites-workbench-main,
  .page-surface-shell .page-section-pad { padding: 12px; }
  .page-surface-shell .progress-sidebar-inner { padding: 16px; }
  .project-lookup-form > * {
    min-width: 0;
    max-width: 100%;
  }
  .project-lookup-form { flex-direction: column; align-items: stretch; }
  .project-lookup-form input[type="text"] { width: 100%; flex: none; }
  .evaluation-tab-header,
  .evaluation-toolbar { flex-wrap: wrap; }
  .evaluation-graph-controls { padding: 12px; }
  .results-graph-grid { grid-template-columns: minmax(0, 1fr); }
  .page-hero-actions { flex-wrap: wrap; }
  .page-surface-shell .full-width-card { padding: 16px; }
  #resultsContent, #chartsGrid > .card { min-width: 0; }
  #taskIdDisplay { overflow-wrap: anywhere; }
}

@media (max-width: 600px) {
  .evaluation-plot-card { overflow-x: auto; overscroll-behavior-x: contain; }
  .evaluation-plot-host { min-width: 480px; }
}
