:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-dark: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --accent-gradient: linear_gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    width: min(100% - 3rem, 1480px);
    max-width: 1480px;
    margin: 0 auto;
    padding: 2rem 0;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.025em;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(380px, 420px) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.sidebar {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    position: sticky;
    top: 1.25rem;
    max-height: calc(100vh - 2.5rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.main-content {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    min-width: 0;
    min-height: calc(100vh - 4rem);
}

.card {
    background: var(--card-bg);
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.card:hover {
    border-color: var(--primary-color);
    transform: scale(1.01);
}

.card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.proposal-card {
    border-left: 4px solid #f59e0b;
    display: flex;
    flex-direction: column;
}

.proposal-card:hover {
    border-color: #f59e0b;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    width: 90%;
    max-width: 800px;
    padding: 2rem;
    border-radius: 1.5rem;
    border: 1px solid var(--border-color);
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    /* Prevent content scroll, we use modal-body */
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-right: -0.5rem;
    /* Offset padding for scrollbar */
    min-height: 0;
    /* Critical for flex scrolling */
}

/* Ensure forms inside modals are also flex containers */
.modal-content form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Custom Scrollbar for Modal Body */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--bg-dark);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
    border: 2px solid var(--bg-dark);
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
}

input,
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: white;
    outline: none;
}

input:focus,
textarea:focus {
    border-color: var(--primary-color);
}

.agent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

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

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-blue {
    background: rgba(37, 99, 235, 0.2);
    color: #60a5fa;
}

.badge-gold {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.badge-red {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}


/* Percentage Visualization */
.perf-container {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.perf-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-dark);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    display: flex;
}

.perf-human {
    background: #10b981;
    transition: width 0.3s;
}

.perf-ai {
    background: #8b5cf6;
    transition: width 0.3s;
}

.perf-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    color: var(--text-muted);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Toast Notifications */
#notification-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: none;
}

.notification {
    min-width: 300px;
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 1rem;
    pointer-events: auto;
    animation: slideIn 0.3s ease-out forwards;
    transition: all 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.fade-out {
    opacity: 0;
    transform: translateX(100%);
}

.notification-success {
    border-left: 4px solid #10b981;
}

.notification-error {
    border-left: 4px solid #ef4444;
}

.notification-info {
    border-left: 4px solid var(--primary-color);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* API Config Enhancements */
#api-providers-list {
    padding-right: 0.5rem;
    margin-bottom: 1rem;
}

/* Scrollbar now handled globally by .modal-body */

.api-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
}

.api-icon {
    width: 40px;
    height: 40px;
    background: var(--card-bg);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.api-info {
    flex: 1;
}

.api-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.key-masked {
    font-family: monospace;
    color: var(--primary-color);
}

.btn-icon {
    padding: 0.5rem;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 0.4rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    border-color: var(--primary-color);
    color: white;
}

/* Tabs System */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab-link {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    color: var(--text-muted);
    font-weight: 600;
}

.tab-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.comp-item {
    background: var(--bg-dark);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.model-cost-preview {
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid var(--primary-color);
    padding: 1rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    color: #93c5fd;
}

.interaction-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--card-bg);
    padding: 0.4rem 0.8rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    margin: 0.25rem;
}

.multi-select-box {
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.5rem;
}

.select-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0.3rem;
}

.select-item:hover {
    background: var(--card-bg);
}

.org-list-item {
    padding: 0.9rem 0.95rem;
    border-radius: 0.65rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 0;
}

.org-list-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.org-list-item.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

.org-list-content {
    min-width: 0;
    flex: 1;
}

.org-list-title {
    color: var(--text-main);
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.3;
    margin-bottom: 0.35rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.org-list-description {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#org-list {
    overflow-y: auto;
    padding-right: 0.25rem;
    margin-right: -0.25rem;
}

.btn-delete-org {
    opacity: 0;
    transition: opacity 0.2s;
    padding: 0.25rem;
    border-radius: 0.4rem;
    color: #ef4444;
}

.org-list-item:hover .btn-delete-org {
    opacity: 1;
}

.btn-delete-org:hover {
    background: rgba(239, 68, 68, 0.1);
}

@media (max-width: 1100px) {
    .container {
        width: min(100% - 2rem, 100%);
    }

    .dashboard-grid {
        grid-template-columns: 320px minmax(0, 1fr);
    }
}

@media (max-width: 820px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        max-height: none;
    }
}

/* Document Cards */
.doc-card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 1.25rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.doc-card:hover {
    transform: translateY(-5px);
    background: rgba(30, 41, 59, 0.6);
    border-color: var(--primary-color);
}

.doc-title {
    font-weight: 600;
    color: #fff;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.doc-snippet {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.doc-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.doc-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}


.diagram-container-wrapper {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    padding: 2.5rem;
    margin-bottom: 4rem;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.diagram-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 1.5rem;
}

.diagram-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.4rem 1rem;
    border-radius: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.mermaid-box {
    background: rgba(10, 15, 30, 0.6);
    border-radius: 1.25rem;
    padding: 0;
    display: block;
    /* Changed from flex to block for absolute panzoom sizing */
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 800px;
    height: 800px;
    width: 100%;
    overflow: hidden;
    position: relative;
    cursor: grab;
}

.mermaid-box:active {
    cursor: grabbing;
}

.mermaid-box svg {
    display: block;
    width: 100% !important;
    height: 100% !important;
    background: transparent !important;
}

.mermaid {
    background: transparent !important;
}

/* Customizing Mermaid nodes via CSS variables or direct overrides if needed */
:root {
    --mermaid-node-bg: var(--card-bg);
    --mermaid-node-border: var(--primary-color);
    --mermaid-edge-color: var(--text-muted);
}

.audit-modal-content {
    max-width: 1320px;
    width: min(1320px, 96vw);
}

.audit-modal-shell {
    display: grid;
    gap: 1rem;
}

.audit-modal-header,
.audit-toolbar-actions,
.audit-panel-header,
.audit-card-head,
.audit-detail-top,
.audit-group-header,
.audit-history-head,
.audit-history-meta,
.audit-detail-actions,
.audit-modal-footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.audit-kicker,
.audit-panel-kicker,
.audit-summary-label,
.audit-detail-label,
.audit-stat-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fbbf24;
}

.audit-modal-header h2,
.audit-panel h3,
.audit-group-header h4,
.audit-proposal-card h4,
.audit-issue-card h4,
.audit-detail-top h4 {
    margin: 0.35rem 0 0.45rem;
}

.audit-subtitle,
.audit-summary-card p,
.audit-history-item p,
.audit-proposal-card p,
.audit-issue-card p,
.audit-detail-block p {
    color: var(--text-muted);
}

.audit-toolbar-actions {
    align-items: flex-end;
}

.audit-model-picker {
    min-width: 240px;
}

.audit-model-picker label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.audit-overview,
.audit-panel,
.audit-history-item,
.audit-proposal-card,
.audit-state-card,
.audit-issue-card {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.84));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
}

.audit-overview {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(0, 1.2fr);
    gap: 1rem;
    padding: 1rem;
}

.audit-summary-card {
    padding: 1rem 1.1rem;
}

.audit-summary-card strong {
    display: block;
    margin-top: 0.3rem;
    font-size: 1.15rem;
}

.audit-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.audit-stat-card {
    padding: 1rem;
    border-radius: 0.9rem;
    background: rgba(15, 23, 42, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.audit-stat-card strong {
    display: block;
    margin-top: 0.4rem;
    font-size: 1.5rem;
}

.audit-layout {
    display: grid;
    grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.45fr);
    gap: 1rem;
}

.audit-sidebar,
.audit-main,
.audit-proposal-groups,
.audit-proposal-list,
.audit-issues-list,
.audit-history-list,
.audit-proposal-detail {
    display: grid;
    gap: 1rem;
}

.audit-panel,
.audit-history-item,
.audit-proposal-card,
.audit-state-card,
.audit-issue-card {
    padding: 1rem;
}

.audit-empty-state,
.audit-empty-inline {
    padding: 1rem;
    border-radius: 0.85rem;
    border: 1px dashed rgba(148, 163, 184, 0.25);
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.28);
}

.audit-history-item,
.audit-proposal-card {
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.audit-history-item.is-active,
.audit-proposal-card.is-active {
    border-color: rgba(251, 191, 36, 0.45);
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.18);
}

.audit-history-meta,
.audit-proposal-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.audit-category-badge,
.audit-severity-badge,
.audit-type-badge,
.audit-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.audit-category-badge,
.audit-type-badge {
    background: rgba(59, 130, 246, 0.16);
    color: #93c5fd;
}

.audit-severity-badge {
    background: rgba(250, 204, 21, 0.14);
    color: #fde68a;
}

.audit-status-badge {
    background: rgba(148, 163, 184, 0.16);
    color: #cbd5f5;
}

.audit-status-pending {
    background: rgba(245, 158, 11, 0.14);
    color: #fcd34d;
}

.audit-status-conflicted,
.audit-severity-alta {
    background: rgba(239, 68, 68, 0.14);
    color: #fca5a5;
}

.audit-status-applied {
    background: rgba(16, 185, 129, 0.14);
    color: #6ee7b7;
}

.audit-status-rejected {
    background: rgba(148, 163, 184, 0.14);
    color: #cbd5e1;
}

.audit-affected-line {
    font-size: 0.82rem;
    color: var(--text-main);
}

.audit-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.audit-detail-block {
    padding: 0.9rem 1rem;
    border-radius: 0.9rem;
    background: rgba(15, 23, 42, 0.54);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.audit-before-after {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.audit-state-card {
    display: grid;
    gap: 0.35rem;
}

.audit-state-card div span {
    color: var(--text-muted);
    font-weight: 600;
}

.audit-match-list,
.audit-state-card ul {
    margin: 0;
    padding-left: 1rem;
}

.audit-modal-footer {
    justify-content: flex-end;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 1100px) {
    .audit-overview,
    .audit-layout,
    .audit-before-after {
        grid-template-columns: 1fr;
    }
}

/* Audit UI v2 */
.audit-modal-content {
    max-width: 1560px;
    width: min(1560px, 97vw);
    padding: 1.35rem;
    height: min(92vh, 980px);
    max-height: 92vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    position: relative;
}

.audit-modal-shell {
    display: grid;
    grid-template-rows: auto auto auto auto auto;
    gap: 1rem;
    min-height: 100%;
}

.audit-close-btn {
    position: sticky;
    top: 0;
    margin-left: auto;
    z-index: 3;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.92);
    color: var(--text-main);
    font-size: 1.35rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.audit-close-btn:hover {
    transform: scale(1.04);
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(30, 41, 59, 0.98);
}

.audit-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) auto;
    gap: 1rem;
    align-items: stretch;
    padding: 1.2rem 1.25rem;
    border-radius: 1.1rem;
    border: 1px solid rgba(245, 158, 11, 0.22);
    background:
        radial-gradient(circle at top left, rgba(245, 158, 11, 0.18), transparent 38%),
        linear-gradient(180deg, rgba(92, 45, 13, 0.14), rgba(15, 23, 42, 0.66));
}

.audit-hero-main {
    display: grid;
    gap: 0.3rem;
}

.audit-hero-actions {
    display: grid;
    gap: 0.75rem;
    align-content: center;
    justify-items: stretch;
    min-width: 280px;
}

.audit-context-line {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.audit-context-pill,
.audit-results-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.78rem;
    color: var(--text-main);
}

.audit-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
    gap: 1rem;
}

.audit-overview,
.audit-focus-panel,
.audit-toolbar,
.audit-panel,
.audit-history-item,
.audit-proposal-card,
.audit-state-card,
.audit-issue-card {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.84));
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
}

.audit-focus-panel,
.audit-toolbar {
    border-radius: 1rem;
    padding: 1rem;
}

.audit-focus-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.audit-focus-card {
    padding: 0.95rem;
    border-radius: 0.95rem;
    background: rgba(15, 23, 42, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.audit-focus-label {
    display: block;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.audit-focus-card strong {
    display: block;
    margin-top: 0.25rem;
    font-size: 1.6rem;
}

.audit-focus-card p {
    margin: 0.45rem 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.audit-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.audit-search-box label,
.audit-filter-label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.audit-search-box input {
    width: 100%;
    padding: 0.8rem 0.95rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.68);
    color: var(--text-main);
}

.audit-filter-block {
    min-width: 0;
}

.audit-filter-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.audit-filter-chip {
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.58);
    color: var(--text-main);
    cursor: pointer;
    font-size: 0.78rem;
    display: inline-flex;
    gap: 0.45rem;
    align-items: center;
}

.audit-filter-chip span {
    color: var(--text-muted);
}

.audit-filter-chip.is-active {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.14);
    color: #fde68a;
}

.audit-workspace {
    display: grid;
    grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.2fr) minmax(360px, 0.95fr);
    gap: 1rem;
    align-items: start;
}

.audit-sidebar,
.audit-main,
.audit-detail-column {
    min-height: 0;
}

.audit-sidebar {
    display: grid;
    grid-template-rows: minmax(220px, 1fr) minmax(220px, 1fr);
    gap: 1rem;
}

.audit-panel-scroll,
.audit-proposal-detail,
.audit-proposal-groups,
.audit-history-list,
.audit-issues-list {
    min-height: 0;
}

.audit-panel-scroll {
    display: grid;
    grid-template-rows: auto auto;
}

.audit-issues-list,
.audit-history-list,
.audit-proposal-groups,
.audit-proposal-detail {
    overflow-y: auto;
    padding-right: 0.2rem;
    overscroll-behavior: contain;
}

.audit-issues-list,
.audit-history-list {
    max-height: 22rem;
}

.audit-proposal-groups {
    max-height: 56vh;
}

.audit-proposal-detail {
    max-height: 62vh;
}

.audit-detail-panel {
    display: grid;
    grid-template-rows: auto auto;
}

.audit-proposal-group {
    display: grid;
    gap: 0.75rem;
}

.audit-group-header {
    align-items: center;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.audit-group-header span {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.audit-proposal-card,
.audit-history-item {
    margin: 0;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.audit-proposal-card:hover,
.audit-history-item:hover {
    transform: translateY(-1px);
    border-color: rgba(245, 158, 11, 0.24);
}

.audit-proposal-headline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.audit-confidence-pill {
    flex-shrink: 0;
    min-width: 56px;
    padding: 0.35rem 0.5rem;
    border-radius: 0.8rem;
    text-align: center;
    background: rgba(16, 185, 129, 0.14);
    color: #6ee7b7;
    font-weight: 700;
    font-size: 0.82rem;
}

.audit-validation-hint {
    margin-top: 0.5rem;
    padding: 0.7rem 0.85rem;
    border-radius: 0.8rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.18);
    color: #fcd34d;
    font-size: 0.8rem;
}

.audit-card-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    margin-top: 0.9rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.audit-card-btn {
    padding: 0.45rem 0.8rem;
    font-size: 0.78rem;
}

.audit-detail-top {
    padding-bottom: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.audit-detail-grid,
.audit-before-after {
    margin-top: 1rem;
}

.audit-state-card {
    background: rgba(15, 23, 42, 0.62);
}

.audit-state-card strong {
    font-size: 0.95rem;
}

.audit-modal-footer {
    margin-top: 0.25rem;
}

@media (max-width: 1320px) {
    .audit-top-grid,
    .audit-workspace {
        grid-template-columns: 1fr;
    }

    .audit-sidebar {
        grid-template-rows: auto;
    }
}

@media (max-width: 900px) {
    .audit-hero,
    .audit-toolbar,
    .audit-overview,
    .audit-before-after {
        grid-template-columns: 1fr;
    }

    .audit-hero-actions {
        min-width: 0;
    }

    .audit-focus-grid {
        grid-template-columns: 1fr;
    }

    .audit-modal-content {
        height: 92vh;
        padding: 1rem;
    }

    .audit-issues-list,
    .audit-history-list,
    .audit-proposal-groups,
    .audit-proposal-detail {
        max-height: none;
    }
}

/* Simulation UI */
.sim-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
    gap: 1.25rem;
    align-items: center;
    padding: 1.35rem 1.5rem;
    margin-bottom: 1.25rem;
    border-radius: 0.9rem;
    border: 1px solid rgba(96, 165, 250, 0.2);
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.2), transparent 40%),
        linear-gradient(180deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.72));
}

.sim-kicker,
.sim-section-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #93c5fd;
}

.sim-hero h3,
.sim-panel h4 {
    margin: 0.25rem 0 0.35rem;
    font-size: 1.35rem;
}

.sim-launcher h4 {
    margin: 0.25rem 0 0;
    font-size: 1.15rem;
}

.sim-hero p,
.sim-panel-caption,
.sim-run-meta,
.sim-progress-text,
.sim-step-meta,
.sim-stat-detail {
    color: var(--text-muted);
}

.sim-hero-actions,
.sim-run-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.sim-workflow-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
}

.sim-workflow-steps div {
    min-height: 4.1rem;
    padding: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 0.7rem;
    background: rgba(15, 23, 42, 0.44);
    color: #cbd5e1;
    font-size: 0.82rem;
    font-weight: 700;
}

.sim-workflow-steps span {
    display: flex;
    width: 1.45rem;
    height: 1.45rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.45rem;
    border-radius: 999px;
    background: rgba(96, 165, 250, 0.18);
    color: #93c5fd;
}

.sim-launcher,
.sim-run-shell,
.sim-panel,
.sim-stat-card,
.sim-insight-card,
.sim-summary-box,
.sim-generated-outputs,
.sim-step-card,
.sim-history-card,
.sim-artifact-card,
.sim-detail-summary,
.sim-metric-box {
    border-radius: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.42);
}

.sim-launcher,
.sim-run-shell,
.sim-panel,
.sim-insight-card,
.sim-summary-box,
.sim-generated-outputs {
    padding: 1.1rem;
}

.sim-launcher {
    margin-bottom: 1rem;
    border-color: rgba(96, 165, 250, 0.18);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.76), rgba(15, 23, 42, 0.58));
}

.sim-launcher-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.sim-launcher-grid {
    display: grid;
    grid-template-columns: minmax(190px, 0.95fr) minmax(230px, 1fr) 150px minmax(210px, 0.9fr);
    gap: 1rem;
    align-items: stretch;
}

.sim-toggle-card,
.sim-run-mode-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
    align-items: center;
    padding: 0.82rem 0.9rem;
    min-height: 100%;
    border-radius: 0.75rem;
    background: rgba(15, 23, 42, 0.38);
    cursor: pointer;
}

.sim-run-mode-card {
    grid-template-columns: 1fr;
    cursor: default;
}

.sim-toggle-card input {
    width: auto;
}

.sim-toggle-card strong,
.sim-run-mode-card strong,
.sim-step-title,
.sim-history-title {
    display: block;
    font-weight: 700;
}

.sim-toggle-card span,
.sim-run-mode-card span {
    display: block;
    color: var(--text-muted);
    font-size: 0.84rem;
}

.sim-empty-state {
    display: grid;
    justify-items: center;
    gap: 0.75rem;
    padding: 2.25rem;
    text-align: center;
    border: 1px dashed rgba(148, 163, 184, 0.25);
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.35);
}

.sim-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 5rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.14);
    color: #93c5fd;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sim-dashboard-body {
    display: grid;
    gap: 1rem;
}

.sim-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
}

.sim-stat-card {
    margin: 0;
    padding: 0.85rem 0.95rem;
    background: rgba(15, 23, 42, 0.36);
}

.sim-stat-label {
    font-size: 0.74rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sim-stat-value {
    margin-top: 0.35rem;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
}

.sim-run-header,
.sim-panel-header,
.sim-card-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.sim-progress-shell {
    display: grid;
    gap: 0.45rem;
    margin-top: 0.85rem;
}

.sim-progress-track {
    height: 0.7rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.9);
}

.sim-progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #3b82f6, #22c55e);
    transition: width 0.25s ease;
}

.sim-btn-outline-danger {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.5);
}

.sim-layout {
    display: grid;
    grid-template-columns: minmax(460px, 1.05fr) minmax(380px, 0.8fr);
    gap: 1.25rem;
    align-items: start;
}

.sim-primary-column,
.sim-secondary-column {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.sim-step-list,
.sim-history-list,
.sim-step-detail,
.sim-run-insights,
.sim-detail-shell {
    display: grid;
    gap: 0.75rem;
}

.sim-step-list,
.sim-history-list {
    max-height: none;
    overflow: auto;
    padding-right: 0.1rem;
}

.sim-run-insights {
    display: grid;
    gap: 0.6rem;
}

.sim-run-insights-panel {
    padding: 0.85rem;
}

.sim-step-detail {
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.sim-step-card,
.sim-history-card {
    padding: 0.85rem 0.95rem;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.sim-step-card:hover,
.sim-history-card:hover {
    transform: translateY(-1px);
    border-color: rgba(96, 165, 250, 0.35);
    background: rgba(15, 23, 42, 0.72);
}

.sim-step-card.is-active,
.sim-history-card.is-active {
    border-color: rgba(96, 165, 250, 0.65);
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.22) inset;
}

.sim-step-actor {
    margin-top: 0.4rem;
    color: #93c5fd;
    font-size: 0.92rem;
}

.sim-step-content {
    margin-top: 0.55rem;
    color: #dbe7ff;
    white-space: pre-wrap;
    line-height: 1.55;
}

.sim-step-card .sim-step-content,
.sim-history-card .sim-step-content {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sim-step-meta-row,
.sim-metric-lines {
    display: grid;
    gap: 0.25rem;
    font-size: 0.84rem;
    color: var(--text-muted);
}

.sim-step-meta-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 0.65rem;
}

.sim-summary-box {
    margin-top: 0.9rem;
    background: rgba(59, 130, 246, 0.08);
    border-left: 4px solid #60a5fa;
    max-height: 18rem;
    overflow: auto;
}

.sim-generated-outputs {
    margin-top: 1rem;
    background: rgba(15, 23, 42, 0.48);
}

.sim-artifact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.85rem;
    margin-top: 1rem;
}

.sim-artifact-card {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 0.95rem;
    padding: 0.85rem;
    min-width: 0;
    min-height: 132px;
    background: rgba(2, 6, 23, 0.34);
}

.sim-artifact-card.is-compact {
    grid-template-columns: 88px minmax(0, 1fr);
    min-height: 104px;
}

.sim-artifact-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 112px;
    height: 112px;
    overflow: hidden;
    border-radius: 0.65rem;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.sim-artifact-card.is-compact .sim-artifact-preview {
    min-height: 82px;
    height: 82px;
}

.sim-artifact-preview img {
    width: 100%;
    height: 100%;
    min-height: 100%;
    object-fit: cover;
    display: block;
}

.sim-artifact-file-icon {
    display: inline-flex;
    width: 3.2rem;
    height: 3.2rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    background: rgba(96, 165, 250, 0.16);
    color: #bfdbfe;
    font-weight: 900;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
}

.sim-artifact-body {
    display: grid;
    align-content: start;
    gap: 0.38rem;
    min-width: 0;
}

.sim-artifact-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
}

.sim-artifact-type {
    color: #93c5fd;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
}

.sim-artifact-model {
    max-width: 7.5rem;
    padding: 0.16rem 0.42rem;
    border-radius: 999px;
    background: rgba(96, 165, 250, 0.12);
    color: #bfdbfe;
    font-size: 0.68rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sim-artifact-body strong {
    color: #e2e8f0;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sim-artifact-body span,
.sim-artifact-body p {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.45;
    margin: 0;
}

.sim-artifact-meta,
.sim-artifact-filename {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sim-artifact-filename {
    color: #64748b;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.74rem;
}

.sim-artifact-warning {
    color: #fbbf24;
    font-size: 0.76rem;
    font-weight: 700;
}

.sim-artifact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.2rem;
}

.sim-artifact-btn {
    padding: 0.38rem 0.62rem;
    font-size: 0.76rem;
}

.sim-step-artifacts {
    display: grid;
    gap: 0.65rem;
}

.sim-summary-text {
    color: #dbe7ff;
}

.sim-list-block strong {
    display: block;
    margin: 0.8rem 0 0.35rem;
}

.sim-list-block ul {
    margin: 0 0 0 1rem;
    color: var(--text-muted);
}

.sim-run-insights .sim-list-block ul {
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.sim-inspector {
    display: grid;
    gap: 1rem;
}

.sim-inspector-hero {
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.sim-inspector-hero-top {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 0.7rem;
}

.sim-inspector-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
}

.sim-inspector-agent {
    margin-top: 0.25rem;
    color: #93c5fd;
    font-size: 0.9rem;
}

.sim-inspector-message {
    color: #dbe7ff;
    line-height: 1.58;
}

.sim-inspector-section {
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.sim-inspector-section:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.sim-inspector-section h5 {
    margin: 0 0 0.55rem;
    font-size: 0.82rem;
    color: #bfdbfe;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sim-inspector-lines {
    display: grid;
    gap: 0.42rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.sim-inspector-lines strong {
    color: #e2e8f0;
    font-weight: 700;
}

.sim-inspector-list {
    margin: 0;
    padding-left: 1.05rem;
    color: var(--text-muted);
}

.sim-inspector-list li + li {
    margin-top: 0.3rem;
}

@media (max-width: 980px) {
    .sim-hero,
    .sim-layout,
    .sim-launcher-grid,
    .sim-summary-grid {
        grid-template-columns: 1fr;
    }

    .sim-step-list {
        max-height: 30rem;
    }

    .sim-hero-actions,
    .sim-run-actions {
        justify-content: flex-start;
    }

    .sim-workflow-steps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .sim-detail-grid,
    .sim-step-meta-row {
        grid-template-columns: 1fr;
    }

    .sim-hero,
    .sim-launcher,
    .sim-run-shell,
    .sim-panel {
        padding: 1rem;
    }

    .sim-stat-value {
        font-size: 1.35rem;
    }

    .sim-workflow-steps {
        grid-template-columns: 1fr;
    }
}

/* Stress UI */
.stress-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) auto;
    gap: 1.5rem;
    align-items: center;
    padding: 1.75rem 2rem;
    margin-bottom: 1.5rem;
    border-radius: 1.25rem;
    border: 1px solid rgba(239, 68, 68, 0.2);
    background:
        radial-gradient(circle at top left, rgba(239, 68, 68, 0.18), transparent 40%),
        linear-gradient(180deg, rgba(127, 29, 29, 0.16), rgba(15, 23, 42, 0.55));
}

.stress-kicker,
.stress-section-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fca5a5;
}

.stress-hero h3,
.stress-panel h4 {
    margin: 0.35rem 0 0.45rem;
    font-size: 1.35rem;
}

.stress-hero p,
.stress-panel-caption,
.stress-run-meta,
.stress-progress-text {
    color: var(--text-muted);
}

.stress-hero-actions,
.stress-run-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.stress-btn-danger {
    background: linear-gradient(135deg, #dc2626, #f97316);
}

.stress-btn-outline-danger {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.5);
}

.stress-empty-state {
    display: grid;
    justify-items: center;
    gap: 0.75rem;
    padding: 2.25rem;
    text-align: center;
    border: 1px dashed rgba(148, 163, 184, 0.25);
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.35);
}

.stress-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 5rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stress-dashboard-body {
    display: grid;
    gap: 1rem;
}

.stress-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.9rem;
}

.stress-stat-card {
    margin: 0;
    padding: 1rem 1.1rem;
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.94), rgba(15, 23, 42, 0.85));
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.stress-stat-label {
    font-size: 0.74rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stress-stat-value {
    margin-top: 0.35rem;
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.1;
}

.stress-stat-detail {
    margin-top: 0.35rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.stress-run-shell,
.stress-panel {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.82), rgba(15, 23, 42, 0.72));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.1rem;
    padding: 1.1rem;
}

.stress-run-header,
.stress-panel-header,
.stress-card-header,
.stress-step-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.stress-progress-shell {
    display: grid;
    gap: 0.45rem;
    margin-top: 1rem;
}

.stress-progress-track {
    height: 0.7rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.9);
}

.stress-progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #ef4444, #f59e0b);
    transition: width 0.25s ease;
}

.stress-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.95fr);
    gap: 1rem;
}

.stress-primary-column,
.stress-secondary-column {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.stress-panel-caption {
    font-size: 0.82rem;
}

.stress-case-list,
.stress-history-list,
.stress-live-steps,
.stress-case-detail {
    display: grid;
    gap: 0.75rem;
}

.stress-case-card,
.stress-history-card,
.stress-step-card,
.stress-detail-summary,
.stress-highlight-box,
.stress-metric-box,
.stress-detail-step {
    border-radius: 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.58);
}

.stress-case-card,
.stress-history-card,
.stress-step-card,
.stress-detail-step {
    padding: 0.95rem 1rem;
}

.stress-case-card,
.stress-history-card {
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.stress-case-card:hover,
.stress-history-card:hover {
    transform: translateY(-1px);
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(15, 23, 42, 0.72);
}

.stress-case-card.is-active,
.stress-history-card.is-active {
    border-color: rgba(248, 113, 113, 0.65);
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.25) inset;
}

.stress-case-title,
.stress-history-title,
.stress-step-title {
    font-weight: 700;
}

.stress-case-scenario,
.stress-step-content,
.stress-detail-scenario {
    margin-top: 0.55rem;
    color: #dbe7ff;
    white-space: pre-wrap;
}

.stress-meta-stack,
.stress-case-meta,
.stress-history-meta {
    display: grid;
    gap: 0.2rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.stress-live-steps,
.stress-detail-steps {
    max-height: 28rem;
    overflow: auto;
    padding-right: 0.1rem;
}

.stress-step-actor {
    margin-top: 0.45rem;
    color: #93c5fd;
    font-size: 0.92rem;
}

.stress-judge-box {
    padding: 1rem;
    border-radius: 0.95rem;
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.12), rgba(120, 53, 15, 0.1));
    border: 1px solid rgba(245, 158, 11, 0.22);
}

.stress-detail-shell {
    display: grid;
    gap: 0.8rem;
}

.stress-detail-summary {
    padding: 1rem;
}

.stress-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.stress-metric-box {
    padding: 0.9rem;
}

.stress-metric-box strong {
    display: block;
    margin-bottom: 0.45rem;
}

.stress-metric-lines {
    display: grid;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stress-highlight-box {
    padding: 0.95rem 1rem;
    background: rgba(245, 158, 11, 0.08);
    border-left: 4px solid #f59e0b;
}

.stress-list-block strong {
    display: block;
    margin-bottom: 0.4rem;
}

.stress-list-block ul {
    margin: 0 0 0 1rem;
    color: var(--text-muted);
}

.stress-detail-steps-shell strong {
    display: block;
    margin-bottom: 0.55rem;
}

@media (max-width: 980px) {
    .stress-hero,
    .stress-layout {
        grid-template-columns: 1fr;
    }

    .stress-hero-actions,
    .stress-run-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .stress-detail-grid {
        grid-template-columns: 1fr;
    }

    .stress-hero,
    .stress-run-shell,
    .stress-panel {
        padding: 1rem;
    }

    .stress-stat-value {
        font-size: 1.35rem;
    }
}
