.grader-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.grader-summary {
    display: flex;
    gap: 24px;
    padding: 20px;
    background: var(--surface);
    border-radius: var(--r-lg);
    border: 1px solid var(--border-200);
    box-shadow: var(--shadow-sm);
}

.summary-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 32px;
    background: var(--surface-50);
    border-radius: var(--r-lg);
    min-width: 140px;
}

.summary-label {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-600);
    margin-bottom: 4px;
}

.summary-value {
    font-size: 2em;
    font-weight: 700;
    color: var(--text-900);
}

.summary-value.score-good {
    color: #16a34a;
}

.summary-value.score-warn {
    color: #d97706;
}

.summary-value.score-bad {
    color: #dc2626;
}

.grader-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.scenario-card {
    background: var(--surface);
    border-radius: var(--r-lg);
    border: 1px solid var(--border-200);
    padding: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.scenario-card:hover {
    border-color: #035696;
    box-shadow: 0 2px 8px rgba(3, 86, 150, 0.15);
}

.scenario-card.running {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.scenario-card.completed {
    border-color: #16a34a;
}

.scenario-card.failed {
    border-color: #dc2626;
}

.scenario-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.scenario-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-900);
}

.scenario-score-badge {
    font-size: 1.4em;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: var(--r-full);
    min-width: 48px;
    text-align: center;
}

.scenario-score-badge.score-good {
    background: #d1fae5;
    color: #065f46;
}

.scenario-score-badge.score-warn {
    background: #fef3c7;
    color: #92400e;
}

.scenario-score-badge.score-bad {
    background: #fee2e2;
    color: #991b1b;
}

.scenario-score-badge.score-pending {
    background: var(--surface-100);
    color: var(--text-500);
    font-size: 0.9em;
}

.scenario-desc {
    font-size: 13px;
    color: var(--text-600);
    margin-bottom: 12px;
    line-height: 1.4;
}

.scenario-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.scenario-status {
    font-size: 12px;
    color: var(--text-500);
    display: flex;
    align-items: center;
    gap: 6px;
}

.scenario-status .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-300);
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.scenario-run-btn {
    padding: 6px 14px;
    font-size: 12px;
    background: #035696;
    color: white;
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background 0.15s;
}

.scenario-run-btn:hover {
    background: #024a84;
}

.scenario-run-btn:disabled {
    background: var(--text-400);
    cursor: not-allowed;
}

/* =========================
   Detail Panel
   ========================= */
.grader-detail {
    background: var(--surface);
    border-radius: var(--r-lg);
    border: 1px solid var(--border-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--surface-50);
    border-bottom: 1px solid var(--border-200);
}

.detail-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-900);
    margin: 0;
    flex: 1;
}

.detail-score {
    font-size: 1.8em;
    font-weight: 700;
    padding: 4px 16px;
    border-radius: var(--r-full);
}

.detail-score.score-good {
    background: #d1fae5;
    color: #065f46;
}

.detail-score.score-warn {
    background: #fef3c7;
    color: #92400e;
}

.detail-score.score-bad {
    background: #fee2e2;
    color: #991b1b;
}

.detail-body {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    min-height: 400px;
}

.detail-criteria {
    padding: 20px;
    border-right: 1px solid var(--border-200);
    background: var(--surface-50);
    overflow-y: auto;
    max-height: 600px;
}

.detail-criteria h3,
.detail-conversation h3,
.detail-analysis h3 {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-600);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-200);
}

.criteria-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-100);
}

.criteria-item:last-child {
    border-bottom: none;
}

.criteria-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.criteria-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-800);
}

.criteria-weight {
    font-size: 11px;
    color: var(--text-500);
    font-family: monospace;
}

.criteria-status {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--r-full);
}

.criteria-status.met {
    background: #d1fae5;
    color: #065f46;
}

.criteria-status.partial {
    background: #fef3c7;
    color: #92400e;
}

.criteria-status.unmet {
    background: #fee2e2;
    color: #991b1b;
}

.criteria-notes {
    font-size: 12px;
    color: var(--text-600);
    margin-top: 4px;
    line-height: 1.4;
}

.detail-conversation {
    padding: 20px;
    overflow-y: auto;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.conv-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: var(--r-lg);
    font-size: 13px;
    line-height: 1.5;
}

.conv-message.customer {
    align-self: flex-end;
    background: #e0f2fe;
    color: #0c4a6e;
    border-bottom-right-radius: var(--r-sm);
}

.conv-message.agent {
    align-self: flex-start;
    background: var(--surface-100);
    color: var(--text-900);
    border-bottom-left-radius: var(--r-sm);
}

.conv-role {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-500);
    margin-bottom: 2px;
}

.tool-call-entry {
    background: var(--surface-50);
    border: 1px solid var(--border-200);
    border-radius: var(--r-sm);
    padding: 8px 12px;
    font-size: 12px;
}

.tool-call-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.tool-call-name {
    font-weight: 600;
    font-family: monospace;
    color: var(--text-800);
}

.tool-call-result {
    font-size: 11px;
    color: var(--text-500);
    font-family: monospace;
}

.tool-call-args {
    margin: 0;
    padding: 4px 8px;
    background: var(--surface);
    border-radius: var(--r-sm);
    font-size: 11px;
    font-family: monospace;
    color: var(--text-700);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 120px;
    overflow-y: auto;
}

.detail-analysis {
    grid-column: 1 / -1;
    padding: 20px;
    border-top: 1px solid var(--border-200);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.analysis-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-800);
    margin: 0 0 8px 0;
}

.analysis-section ul {
    margin: 0;
    padding-left: 16px;
    font-size: 13px;
    line-height: 1.6;
}

.analysis-section .strength {
    color: #065f46;
}

.analysis-section .weakness {
    color: #991b1b;
}

.analysis-reasoning {
    grid-column: 1 / -1;
    padding: 12px;
    background: var(--surface-50);
    border-radius: var(--r-sm);
    font-size: 13px;
    color: var(--text-700);
    line-height: 1.5;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 13px;
}

/* =========================
   Mobile
   ========================= */
@media (max-width: 900px) {
    .grader-summary {
        flex-wrap: wrap;
    }

    .grader-grid {
        grid-template-columns: 1fr;
    }

    .detail-body {
        grid-template-columns: 1fr;
    }

    .detail-criteria {
        border-right: none;
        border-bottom: 1px solid var(--border-200);
        max-height: 200px;
    }

    .detail-analysis {
        grid-template-columns: 1fr;
    }
}
