/* ============================================================================
   RUN STATUS & RESPONSIVE
   Run status indicators, animations, responsive adjustments
   ============================================================================ */

/* Run Status Indicator */
.run-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 6px;
    font-size: 0.85rem;
    background: #1e293b;
    border: 1px solid #334155;
}

.run-status-icon {
    font-size: 1rem;
}

.run-status-label {
    font-weight: 500;
    text-transform: capitalize;
}

.run-status-message {
    flex: 1;
    color: #94a3b8;
}

.run-status-stats {
    color: #94a3b8;
    font-size: 0.8rem;
}

/* Status variants */
.run-status.status-setup {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.run-status.status-setup .run-status-icon {
    animation: pulse 1s infinite;
}

.run-status.status-running {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.run-status.status-running .run-status-icon {
    color: #3b82f6;
    animation: pulse 1s infinite;
}

.run-status.status-completed {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.run-status.status-completed .run-status-icon {
    color: #22c55e;
}

.run-status.status-error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.run-status.status-error .run-status-icon {
    color: #ef4444;
}

.run-status.status-stopped {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.run-status.status-stopped .run-status-icon {
    color: #f59e0b;
}

.run-status.status-starting,
.run-status.status-reset_pending {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.run-status.status-starting .run-status-icon,
.run-status.status-reset_pending .run-status-icon {
    color: #f59e0b;
    animation: pulse 1s infinite;
}

.run-status.status-idle {
    border-color: #475569;
    background: rgba(71, 85, 105, 0.1);
}

/* Pulse animation for status indicators */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Responsive adjustments */
@media (max-width: 1000px) {
    .mcp-builder-2col {
        grid-template-columns: 1fr;
        height: auto;
    }

    .mcp-trajectory-panel,
    .mcp-tool-panel {
        min-height: 400px;
    }
}

/* Hidden by filter */
.rubric-item.hidden-by-filter {
    display: none !important;
}

/* ============================================
   PROGRAMMATIC GRADING UI COMPONENTS
   Strategy selector, table editor, tags input
   ============================================ */

/* Strategy Selector */
.strategy-selector {
    margin-top: 12px;
}

.strategy-dropdown {
    max-width: 300px;
}

.strategy-description {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 4px;
}

/* Strategy Fields Container */
.strategy-fields {
    margin-top: 12px;
    width: 0;
    min-width: 100%;
    /* Force to parent width, prevent expansion */
}

.strategy-fields-inner {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid #334155;
    border-radius: 8px;
    max-width: 100%;
}

/* Individual Strategy Field */
.strategy-field {
    display: flex;
    flex-direction: column;
    max-width: 100%;
}

.strategy-field .form-label {
    margin-bottom: 4px;
}

/* Field Help Text */
.field-help {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 4px;
    margin-bottom: 8px;
}

.field-hint {
    font-size: 0.75rem;
    color: #475569;
    margin-top: 4px;
}

.field-examples {
    font-size: 0.75rem;
    color: #475569;
    margin-top: 4px;
    margin-bottom: 8px;
}

.field-examples code {
    background: #1e293b;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: 'Monaco', 'Courier New', monospace;
}

/* ============================================
   MARKDOWN TYPE SELECTOR
   Radio group for selecting markdown type
   ============================================ */

.markdown-type-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    padding: 8px;
    background: #0f172a;
    border-radius: 6px;
    border: 1px solid #334155;
}

.markdown-type-selector .radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.markdown-type-selector .radio-option:hover:not(.disabled) {
    background: #1e293b;
}

.markdown-type-selector .radio-option.selected {
    background: #1e40af;
    border-color: #3b82f6;
}

.markdown-type-selector .radio-option.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.markdown-type-selector .radio-option input[type="radio"] {
    accent-color: #3b82f6;
}

.markdown-type-selector .radio-label {
    font-size: 0.85rem;
    color: #e2e8f0;
}

/* ============================================
   GRID TABLE EDITOR COMPONENT
   Visual grid editor for list[dict] data
   ============================================ */

.grid-table-editor {
    display: flex;
    flex-direction: column;
    background: #020617;
    border: 2px solid #475569;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Table Location Input (selector_config) */
.grid-table-location {
    padding: 12px 16px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
}

.grid-table-location-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: #60a5fa;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.grid-table-location-input {
    width: 100%;
    padding: 10px 14px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: 6px;
    color: #f1f5f9;
    font-size: 0.9rem;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.grid-table-location-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.grid-table-location-input::placeholder {
    color: #64748b;
}

/* Actions column (add column button in header, delete row button in data rows) */
.grid-actions-col {
    width: 40px;
    min-width: 40px;
    padding: 0;
    border: none;
    vertical-align: middle;
    text-align: center;
    background: #020617;
}

.grid-add-col-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    background: #10b981;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
}

.grid-add-col-btn:hover {
    background: #059669;
    transform: scale(1.1);
}


/* Table wrapper for scrolling */
.grid-table-wrapper {
    overflow: auto;
    /* Both horizontal and vertical scroll on same container */
    max-height: 250px;
    /* Triggers vertical scroll after ~5 rows */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 16px;
    background: #020617;
}

/* Scrollbar styling */
.grid-table-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.grid-table-wrapper::-webkit-scrollbar-track {
    background: #0f172a;
    border-radius: 4px;
}

.grid-table-wrapper::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

.grid-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* The actual grid table */
.grid-table {
    border-collapse: separate;
    border-spacing: 0;
    background: #020617;
}

/* Header cells */
.grid-header-row {
    background: #1e3a5f;
}

/* Simple table structure - wrapper handles all scrolling */
.grid-table thead th {
    background: #1e3a5f;
    position: sticky;
    top: 0;
    z-index: 10;
}

.grid-header-cell {
    position: relative;
    padding: 0;
    border: none;
    min-width: 140px;
    border-bottom: 1px solid #334155;
    border-right: 1px solid #334155;
    background: #1e3a5f;
}

.grid-header-cell:last-of-type {
    border-right: none;
}

.grid-header-cell-content {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px 8px;
    padding-right: 28px;
    /* Make room for remove button */
}

.grid-header-cell .grid-column-name {
    flex: 1;
    padding: 6px 8px;
    background: transparent;
    border: none;
    color: #f8fafc;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    min-width: 60px;
}

.grid-header-cell .grid-column-name:focus {
    outline: none;
    background: rgba(59, 130, 246, 0.1);
}

/* Key Field Toggle */
.grid-key-field-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    background: transparent;
    border: none;
    transition: all 0.2s;
}

.grid-key-field-toggle:hover {
    background: rgba(59, 130, 246, 0.2);
}

.grid-key-checkbox {
    display: none;
}

.grid-key-icon {
    font-size: 0.85rem;
    opacity: 0.4;
    transition: all 0.2s;
    filter: grayscale(100%);
}

.grid-key-checkbox:checked+.grid-key-icon {
    opacity: 1;
    filter: grayscale(0%);
}

.grid-header-cell .grid-column-name::placeholder {
    color: #64748b;
    font-weight: 400;
}

/* Remove column button */
.grid-remove-col {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 0.9rem;
    line-height: 1;
    border-radius: 3px;
    opacity: 0;
    transition: all 0.2s;
}

.grid-header-cell:hover .grid-remove-col {
    opacity: 1;
}

.grid-remove-col:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}


/* Data rows - darker to stand out from form inputs */
.grid-data-row {
    background: #020617;
    transition: background 0.2s;
}

.grid-data-row:hover {
    background: #0f172a;
}

.grid-data-row:nth-child(even) {
    background: #0a0f1a;
}

.grid-data-row:nth-child(even):hover {
    background: #0f172a;
}

/* Data cells */
.grid-data-cell {
    padding: 0;
    border: none;
    border-bottom: 1px solid #1e293b;
    border-right: 1px solid #0f172a;
    min-width: 140px;
}

.grid-data-cell:last-of-type {
    border-right: none;
}

.grid-cell-input {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: none;
    color: #f1f5f9;
    font-size: 0.9rem;
    text-align: center;
}

.grid-cell-input:focus {
    outline: none;
    background: #1e3a5f;
    box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.grid-cell-input::placeholder {
    color: #64748b;
}


.grid-remove-row {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
    line-height: 1;
    border-radius: 3px;
    opacity: 0;
    transition: all 0.2s;
}

.grid-data-row:hover .grid-remove-row {
    opacity: 1;
}

.grid-remove-row:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Grid Table Footer with Add Row button and hint */
.grid-table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-top: 1px solid #1e293b;
    background: #020617;
}

.btn-add-row {
    font-size: 0.8rem !important;
    padding: 6px 12px !important;
    background: #10b981 !important;
    color: #fff !important;
    border: 1px solid #10b981 !important;
    border-radius: 4px !important;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-row:hover {
    background: #059669 !important;
    color: #fff !important;
    border-color: #059669 !important;
}

/* Add row controls container */
.grid-add-row-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.grid-row-count-input {
    width: 48px;
    padding: 6px 4px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: 4px;
    color: #f1f5f9;
    font-size: 0.8rem;
    text-align: center;
    -moz-appearance: textfield;
}

.grid-row-count-input::-webkit-outer-spin-button,
.grid-row-count-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.grid-row-count-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.grid-row-count-label {
    font-size: 0.75rem;
    color: #64748b;
}

.grid-table-hint {
    font-size: 0.75rem;
    color: #64748b;
}

/* Empty state placeholder */
.grid-table tbody:empty::after {
    content: 'No rows yet. Click "+ Add Row" to add data.';
    display: block;
    padding: 16px;
    text-align: center;
    color: #64748b;
    font-style: italic;
}

/* ============================================
   TAGS INPUT COMPONENT
   Tag-style input for arrays (key_fields)
   ============================================ */

.tags-input-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 8px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    min-height: 42px;
    transition: border-color 0.2s;
}

.tags-input-container:focus-within {
    border-color: #3b82f6;
}

/* Tags List */
.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Individual Tag */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: #3b82f6;
    color: #fff;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.tag button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1;
    margin-left: 2px;
    transition: color 0.2s;
}

.tag button:hover {
    color: #fff;
}

/* Tags Input Field */
.tags-input {
    flex: 1;
    min-width: 120px;
    border: none;
    background: transparent;
    color: #e2e8f0;
    font-size: 0.9rem;
    outline: none;
    padding: 4px;
}

.tags-input::placeholder {
    color: #475569;
}

/* ============================================
   PROBLEM RUNNER STYLES
   ============================================ */

.runner-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #1e293b;
    border-radius: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.runner-controls input[type="number"] {
    width: 60px;
    padding: 8px;
    border: 1px solid #334155;
    border-radius: 4px;
    background: #0f172a;
    color: #e2e8f0;
}

.runner-problem-select {
    min-width: 200px;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid #334155;
    border-radius: 4px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 0.9rem;
    cursor: pointer;
}

.runner-problem-select:hover {
    border-color: #475569;
}

.runner-problem-select:focus {
    outline: none;
    border-color: #3b82f6;
}

.runner-mode-select {
    min-width: 140px;
    padding: 8px 12px;
    border: 1px solid #334155;
    border-radius: 4px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 0.9rem;
    cursor: pointer;
}

.runner-mode-select:hover {
    border-color: #475569;
}

.runner-mode-select:focus {
    outline: none;
    border-color: #3b82f6;
}

.runner-mode-select option:disabled {
    color: #64748b;
}

.runner-taiga-hint {
    font-size: 0.8rem;
    color: #64748b;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(100, 116, 139, 0.1);
}

.runner-taiga-hint.runner-taiga-authenticated {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.runner-taiga-hint.runner-taiga-authenticated:hover {
    background: rgba(34, 197, 94, 0.2);
}

.runner-taiga-hint.runner-taiga-login {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.runner-taiga-hint.runner-taiga-login:hover {
    background: rgba(59, 130, 246, 0.2);
}

.runner-taiga-hint.runner-taiga-logging-in {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.runner-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 16px;
    height: calc(100vh - 280px);
    min-height: 400px;
}

.runner-list-panel {
    background: #1e293b;
    border-radius: 8px;
    padding: 16px;
    overflow-y: auto;
}

.runner-detail-panel {
    background: #1e293b;
    border-radius: 8px;
    padding: 16px;
    overflow-y: auto;
}

.runner-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.runner-table th,
.runner-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #334155;
}

.runner-table th {
    color: #94a3b8;
    font-weight: 600;
}

.runner-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.runner-table th.sortable:hover {
    color: #e2e8f0;
}

.runner-row {
    cursor: pointer;
    transition: background 0.15s;
}

.runner-row:hover {
    background: #334155;
}

.runner-row.selected {
    background: #1e3a5f;
}

.runner-row.selected:hover {
    background: #234b77;
}

.runner-row-empty {
    pointer-events: none;
}

.runner-empty-hint {
    text-align: center;
    color: #64748b;
    font-style: italic;
    padding: 24px !important;
}

.status-starting { color: #fcd34d; }
.status-running { color: #60a5fa; }
.status-reset_pending { color: #c4b5fd; }
.status-completed { color: #4ade80; }
.status-stopped { color: #cbd5e1; }
.status-error { color: #fb7185; }

.runner-actions {
    width: 60px;
    text-align: center;
}

.runner-stop-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.runner-stop-btn:hover:not(:disabled) {
    background: #b91c1c;
}

.runner-stop-btn:disabled {
    background: #4b5563;
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-small {
    padding: 4px 8px;
    font-size: 0.8rem;
}

.btn-small.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-small.btn-danger:hover {
    background: #b91c1c;
}

.btn-small.btn-disabled {
    background: #374151;
    color: #6b7280;
    cursor: not-allowed;
}

.runner-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #334155;
}

.runner-detail-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.status-completed { background: #065f46; }
.status-badge.status-running { background: #1e40af; }
.status-badge.status-error { background: #991b1b; }
.status-badge.status-stopped { background: #374151; }

.runner-detail-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 16px;
    height: calc(100% - 60px);
}

.runner-trajectory {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.runner-trajectory h4 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    color: #94a3b8;
}

.runner-trajectory-cards {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.runner-active-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, #1e3a5f 0%, #1e293b 100%);
    border: 1px solid #3b82f6;
    border-radius: 8px;
    margin-top: 8px;
}

.runner-active-indicator.starting {
    background: linear-gradient(135deg, #3d3215 0%, #1e293b 100%);
    border-color: #f59e0b;
}

.runner-active-dot {
    width: 12px;
    height: 12px;
    background: #3b82f6;
    border-radius: 50%;
    animation: runner-pulse 1.5s ease-in-out infinite;
}

.runner-active-indicator.starting .runner-active-dot {
    background: #fcd34d;
    animation: runner-pulse-yellow 1.5s ease-in-out infinite;
}

@keyframes runner-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0);
    }
}

@keyframes runner-pulse-yellow {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(252, 211, 77, 0.5);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
        box-shadow: 0 0 0 8px rgba(252, 211, 77, 0);
    }
}

.runner-active-text {
    color: #93c5fd;
    font-size: 0.9rem;
    font-weight: 500;
}

.runner-active-indicator.starting .runner-active-text {
    color: #fcd34d;
}

.runner-grade-panel {
    background: #0f172a;
    border-radius: 8px;
    padding: 16px;
    overflow-y: auto;
}

.runner-grade-panel h4 {
    margin: 0 0 16px 0;
    font-size: 0.9rem;
    color: #94a3b8;
}

.grade-overall {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #1e293b;
    border-radius: 8px;
    margin-bottom: 16px;
}

.grade-label {
    font-weight: 600;
    color: #94a3b8;
}

.grade-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.grade-pass { color: #34d399; }
.grade-fail { color: #f87171; }

.grade-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.grade-table th,
.grade-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #334155;
}

.grade-table th {
    color: #94a3b8;
    font-weight: 600;
}

/* ============================================
   PROBLEM RUNNER - LIST/DETAIL VIEW LAYOUT
   ============================================ */

/* List View - full width table */
.runner-list-view {
    background: #1e293b;
    border-radius: 8px;
    padding: 16px;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
}

.runner-list-view .runner-table {
    width: 100%;
}

.runner-list-view .runner-table th:first-child,
.runner-list-view .runner-table td:first-child {
    width: 140px;
    white-space: nowrap;
}

/* Detail View - icon sidebar + trajectory + grading (50/50 split) */
.runner-detail-view {
    display: grid;
    grid-template-columns: 48px 1fr 1fr;
    gap: 0;
}

/* Icon Sidebar */
.runner-icon-sidebar {
    background: #0f172a;
    border-radius: 8px 0 0 8px;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-right: 1px solid #334155;
    position: sticky;
    top: 120px;
    height: fit-content;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    align-self: start;
}

.sidebar-label {
    font-size: 0.65rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    margin-bottom: 2px;
}

.run-icon.back-icon {
    background: #334155;
    color: #e2e8f0;
    font-size: 1rem;
}

.run-icon.back-icon:hover {
    background: #475569;
}

.run-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.15s;
    flex-shrink: 0;
    position: relative;
}

.run-icon:hover {
    transform: scale(1.1);
}

.run-icon.selected {
    ring: 2px solid #60a5fa;
    box-shadow: 0 0 0 2px #60a5fa;
}

.run-icon.status-starting {
    background: rgba(252, 211, 77, 0.15);
    color: #fcd34d;
}

.run-icon.status-running {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
}

.run-icon.status-reset_pending {
    background: rgba(196, 181, 253, 0.15);
    color: #c4b5fd;
}

.run-icon.status-completed {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
}

.run-icon.status-stopped {
    background: rgba(203, 213, 225, 0.15);
    color: #cbd5e1;
}

.run-icon.status-error {
    background: rgba(251, 113, 133, 0.15);
    color: #fb7185;
}

/* Error message in empty trajectory */
.runner-error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px;
    color: #fb7185;
    text-align: center;
    line-height: 1.5;
}

.runner-error-message .error-icon {
    font-size: 2rem;
    display: block;
}


/* Detail Main Content (trajectory panel) */
.runner-detail-main {
    background: #1e293b;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}


.runner-detail-main-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
}

.runner-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.runner-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 13px;
    background: #334155;
    border: none;
    border-radius: 6px;
    color: #e2e8f0;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s;
}

.runner-back-btn:hover {
    background: #475569;
}

.runner-detail-title {
    font-size: 0.95rem;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.runner-detail-status {
    margin-left: auto;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.runner-detail-trajectory {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
}

/* Grading Panel (right side in detail view) */
.runner-grading-panel {
    background: #0f172a;
    border-radius: 0 8px 8px 0;
    border-left: 1px solid #334155;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: sticky;
    top: 120px;
    height: calc(100vh - 120px);
    overflow-y: auto;
}

.runner-grading-header {
    padding: 11px 16px;
    border-bottom: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.runner-grading-header h4 {
    margin: 0;
    font-size: 0.95rem;
    color: #94a3b8;
}

.runner-grading-score {
    font-size: 1.25rem;
    font-weight: 700;
}

.runner-grading-content {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

/* Grade Section Styling */
.grade-section {
    margin-bottom: 24px;
}

.grade-section:last-child {
    margin-bottom: 0;
}

.grade-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.grade-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Criterion Row Styling */
.criterion-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.criterion-row:hover {
    filter: brightness(1.1);
}

.criterion-row.programmatic {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.criterion-row.llm {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.criterion-row.llm.pending {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.criterion-score {
    min-width: 40px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    flex-shrink: 0;
}

.criterion-row.programmatic .criterion-score {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.criterion-row.llm .criterion-score {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
}

.criterion-row.llm.pending .criterion-score {
    background: rgba(251, 191, 36, 0.2);
    color: #fcd34d;
}

.criterion-text {
    flex: 1;
    font-size: 0.85rem;
    color: #e2e8f0;
    line-height: 1.4;
}

.criterion-type {
    font-size: 0.7rem;
    color: #64748b;
    padding: 3px 6px;
    background: rgba(100, 116, 139, 0.2);
    border-radius: 3px;
    flex-shrink: 0;
}

/* Grading Buttons */
.grade-action-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.grade-action-buttons .btn {
    flex: 1;
    padding: 8px;
    font-size: 0.85rem;
}

/* Expand/Collapse All buttons */
.grade-expand-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.grade-expand-buttons button {
    padding: 4px 12px;
    background: #334155;
    color: #94a3b8;
    border: 1px solid #475569;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s;
}

.grade-expand-buttons button:hover {
    background: #475569;
    color: #e2e8f0;
}

/* Placeholder styling */
.grade-placeholder {
    text-align: center;
    padding: 32px 16px;
    color: #64748b;
}

.grade-placeholder-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 600px) {
    .strategy-dropdown {
        max-width: 100%;
    }

    .kv-pairs {
        flex-direction: column;
    }

    .kv-pair {
        width: 100%;
    }

    .kv-key,
    .kv-value {
        flex: 1;
        width: auto;
        min-width: 60px;
    }

    .table-row {
        flex-direction: column;
    }

    .table-row-remove {
        align-self: flex-end;
    }
}
