/* JMeter Enhanced Reporting Dashboard - Styles */

/* CSS Variables for theming */
:root {
    /* Light theme (default) */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    /* Brand colors */
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-primary-light: #dbeafe;
    --color-success: #10b981;
    --color-success-light: #d1fae5;
    --color-warning: #f59e0b;
    --color-warning-light: #fef3c7;
    --color-error: #ef4444;
    --color-error-light: #fee2e2;
    --color-info: #6366f1;
    --color-info-light: #e0e7ff;

    /* Chart colors */
    --chart-blue: #3b82f6;
    --chart-green: #10b981;
    --chart-orange: #f59e0b;
    --chart-red: #ef4444;
    --chart-purple: #8b5cf6;
    --chart-cyan: #06b6d4;
    --chart-pink: #ec4899;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --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);

    /* Layout */
    --sidebar-width: 280px;
    /* Height of the site bar the hosted build injects above the dashboard's own header.
       Zero here because the desktop app has no such bar; css/site-nav.css overrides it. */
    --site-nav-height: 0px;
    --header-height: 60px;
    --border-radius: 8px;
    --border-radius-lg: 12px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* Dark theme */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --border-light: #1e293b;

    --color-primary-light: #1e3a5f;
    --color-success-light: #064e3b;
    --color-warning-light: #78350f;
    --color-error-light: #7f1d1d;
    --color-info-light: #312e81;
}

/* Reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Ensure hidden attribute works with display: flex elements */
[hidden] {
    display: none !important;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.025em;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.file-name {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Main Wrapper */
.main-wrapper {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* Sidebar */
/*
 * The control that reveals the sidebar on narrow screens.
 *
 * Hidden by default and shown by the max-width: 768px block below. Until 2026-08-29 the
 * only rule for it in this file was that `display: flex` inside the media query, and no
 * markup or script ever created it — so at 768px and under the sidebar slid to
 * `left: -100%` and nothing could bring it back. The file input, the sample-data button,
 * the loaded-file list and every display option live in there, so the whole page was a
 * dead end on a phone: it rendered, and it could not be used.
 */
.header .menu-toggle {
    /* Scoped to .header so it outranks `.btn`, which the button also carries and which
       is declared later in this file with the same specificity — an unscoped
       `.menu-toggle { display: none }` loses to it and the hamburger shows on desktop. */
    display: none;
    flex: 0 0 auto;
}

/* Only present while the sidebar is open over the page; see the media query. */
.sidebar-backdrop {
    display: none;
}

.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--bg-tertiary);
}

.drop-zone:hover, .drop-zone:focus, .drop-zone.drag-over {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.drop-zone:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.drop-icon {
    width: 2.5rem;
    height: 2.5rem;
    margin: 0 auto 0.75rem;
    color: var(--text-muted);
}

.drop-text {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

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

/* Loaded Files List */
.loaded-files-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.loaded-file-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
}

.loaded-file-item .file-icon {
    width: 1rem;
    height: 1rem;
    color: var(--color-primary);
}

.loaded-file-item .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.loaded-file-item .remove-btn {
    padding: 0.25rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 4px;
}

.loaded-file-item .remove-btn:hover {
    color: var(--color-error);
    background: var(--color-error-light);
}

/* Time Filter */
.time-filter {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.preset-buttons {
    display: flex;
    gap: 0.5rem;
}

.preset-btn {
    flex: 1;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
}

.preset-btn.active {
    background: var(--color-primary);
    color: white;
}

.range-slider-container {
    position: relative;
    height: 2rem;
}

.range-slider {
    position: absolute;
    width: 100%;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
    top: 50%;
    transform: translateY(-50%);
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: var(--shadow);
}

.time-inputs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.time-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.time-input-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.time-input {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* Option Groups */
.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--color-primary);
}

.select-input {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    min-width: 0;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 2rem;
}

.empty-icon {
    width: 6rem;
    height: 6rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.empty-state h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 2rem;
}

.spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.progress-bar {
    width: 200px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 1rem;
}

.progress-fill {
    height: 100%;
    background: var(--color-primary);
    transition: width var(--transition-normal);
}

/* Dashboard Content */
.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.summary-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

.summary-card.clickable {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.summary-card.clickable:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-primary);
}

.summary-card.clickable:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.summary-card.clickable:active {
    transform: translateY(0);
}

/* Scroll offset for linked sections to show headings */
.chart-container,
.panel-content,
.advanced-insights-panel {
    scroll-margin-top: 4rem;
}

/* Electron app needs more scroll margin due to title bar + menu bar */
.electron-app .chart-container,
.electron-app .panel-content,
.electron-app .advanced-insights-panel {
    scroll-margin-top: 14rem;
}

.summary-card h3 {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.5rem;
}

.summary-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.summary-unit {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1rem;
}

.chart-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.chart-large {
    grid-column: span 12;
}

.chart-medium {
    grid-column: span 6;
}

.chart-small {
    grid-column: span 4;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

.chart-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
}

.chart-actions {
    display: flex;
    gap: 0.5rem;
}

.chart-body {
    padding: 1rem;
    height: 300px;
    position: relative;
    z-index: 1;
    background: var(--bg-secondary);
}

.chart-body canvas {
    width: 100% !important;
    height: 100% !important;
}

.chart-large .chart-body {
    height: 350px;
}

.chart-body-sm {
    height: 220px;
}

.chart-body-lg {
    height: 400px;
}

.chart-wide {
    grid-column: span 12;
}

.chart-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
    font-weight: normal;
}

/* Combined Charts Section */
.combined-charts-section {
    margin-bottom: 1.5rem;
}

.combined-charts-section .section-title {
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.combined-charts-section .charts-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1rem;
}

.combined-charts-section .chart-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.combined-charts-section .chart-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

.combined-charts-section .chart-header h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
}

/* Apdex Card */
.apdex-card {
    position: relative;
}

.apdex-rating {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    text-transform: uppercase;
}

.apdex-excellent {
    background: var(--color-success-light);
    color: var(--color-success);
}

.apdex-good {
    background: #d1fae5;
    color: #059669;
}

.apdex-fair {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.apdex-poor {
    background: var(--color-error-light);
    color: var(--color-error);
}

.apdex-unacceptable {
    background: #7f1d1d;
    color: #fecaca;
}

/* Error Analysis Panel */
.error-analysis-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.section-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--color-error);
}

.error-analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.error-analysis-grid .chart-container {
    grid-column: span 1;
}

.error-analysis-grid .chart-header h4 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Recommendations Panel */
.recommendations-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast);
}

.panel-header:hover {
    background: var(--bg-tertiary);
}

.panel-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
}

.panel-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--color-info);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--color-primary);
    color: white;
    border-radius: 999px;
}

.chevron {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.panel-header[aria-expanded="false"] .chevron {
    transform: rotate(-90deg);
}

.panel-content {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-light);
}

.panel-header[aria-expanded="false"] + .panel-content {
    display: none;
}

.no-recommendations {
    color: var(--text-muted);
    text-align: center;
    padding: 1rem;
}

/* Recommendation Item */
.recommendation-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    margin-bottom: 0.75rem;
}

.recommendation-item:last-child {
    margin-bottom: 0;
}

.recommendation-icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recommendation-icon svg {
    width: 1rem;
    height: 1rem;
}

.recommendation-icon.critical {
    background: var(--color-error-light);
    color: var(--color-error);
}

.recommendation-icon.warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.recommendation-icon.info {
    background: var(--color-info-light);
    color: var(--color-info);
}

.recommendation-content {
    flex: 1;
}

.recommendation-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.recommendation-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.recommendation-metric {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    color: var(--text-muted);
}

/* Sampler Table */
.sampler-table-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.sampler-table-section h3 {
    padding: 1rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-light);
}

.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.data-table th:hover {
    background: var(--border-color);
}

.data-table th[data-sort]::after {
    content: '';
    display: inline-block;
    margin-left: 0.5rem;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid var(--text-muted);
    opacity: 0.3;
}

.data-table th.sort-asc::after {
    border-top: none;
    border-bottom: 4px solid var(--color-primary);
    opacity: 1;
}

.data-table th.sort-desc::after {
    border-top: 4px solid var(--color-primary);
    opacity: 1;
}

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.data-table td:first-child {
    font-weight: 500;
}

/* Sparkline cells in data table */
.sparkline-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 90px;
}

.sparkline {
    flex-shrink: 0;
    border-radius: 2px;
}

.trend-indicator {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
}

.trend-up {
    color: var(--color-error);
}

.trend-down {
    color: var(--color-success);
}

.trend-stable {
    color: var(--color-primary);
}

/* Comparison View */
.comparison-view {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comparison-header h2 {
    font-size: 1.25rem;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.comparison-chart-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1rem;
}

.comparison-chart-container h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.comparison-chart-body {
    position: relative;
    height: 300px;
}

.comparison-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.comparison-summary {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.comparison-stat {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
}

.comparison-stat h4 {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.comparison-values {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
}

.comparison-value {
    flex: 1 1 40%;
    min-width: 0;
    overflow: hidden;
}

.comparison-value .label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.comparison-value .value {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
}

.comparison-delta {
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.comparison-delta.positive {
    color: var(--color-success);
}

.comparison-delta.negative {
    color: var(--color-error);
}

/* Comparison: wide chart (spans full row) */
.comparison-chart-container--wide {
    grid-column: 1 / -1;
}

.comparison-chart-body--tall {
    height: 400px;
}

/* Comparison: summary enhancements */
.comparison-summary-sentence {
    grid-column: 1 / -1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.comparison-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    width: 100%;
}

/* Severity badges */
.severity-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 9999px;
    margin-right: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.severity-improved {
    background: rgba(16, 185, 129, 0.15);
    color: rgb(16, 185, 129);
}

.severity-stable {
    background: rgba(107, 114, 128, 0.15);
    color: rgb(107, 114, 128);
}

.severity-minor {
    background: rgba(234, 179, 8, 0.15);
    color: rgb(161, 123, 5);
}

.severity-moderate {
    background: rgba(249, 115, 22, 0.15);
    color: rgb(234, 88, 12);
}

.severity-major {
    background: rgba(239, 68, 68, 0.15);
    color: rgb(220, 38, 38);
}

/* Comparison: Top Regressions panel */
.top-regressions-panel {
    grid-column: 1 / -1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-top: 0.5rem;
}

.top-regressions-panel h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.regression-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.regression-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.825rem;
}

.regression-label {
    flex: 1;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.regression-delta {
    font-weight: 600;
    font-size: 0.8rem;
}

.positive { color: var(--color-success); }
.negative { color: var(--color-error); }

/* Test Health card */
.test-health-card {
    min-height: 140px;
}

.health-grade-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 700;
}

.health-a  { background: rgba(16,185,129,0.2); color: rgb(16,185,129); }
.health-b  { background: rgba(59,130,246,0.2); color: rgb(59,130,246); }
.health-c  { background: rgba(249,115,22,0.2); color: rgb(249,115,22); }
.health-f  { background: rgba(239,68,68,0.2);  color: rgb(239,68,68);  }
.health-unknown { background: rgba(107,114,128,0.2); color: rgb(107,114,128); }

.health-score-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.health-score-value {
    font-weight: 600;
}

.health-summary {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    line-height: 1.4;
}

.health-warnings-details {
    margin-top: 0.5rem;
    font-size: 0.75rem;
}

.health-warnings-details summary {
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem 0;
}

.health-warnings-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.health-warning-item {
    padding: 0.35rem 0.5rem;
    border-radius: var(--border-radius-sm, 4px);
    font-size: 0.72rem;
    line-height: 1.4;
}

.health-warning-item.health-error {
    background: rgba(239,68,68,0.08);
    border-left: 3px solid rgb(239,68,68);
}

.health-warning-item.health-warning {
    background: rgba(249,115,22,0.08);
    border-left: 3px solid rgb(249,115,22);
}

/* Impact column in sampler table */
.impact-high   { color: rgb(239,68,68); font-weight: 600; }
.impact-medium { color: rgb(249,115,22); font-weight: 500; }
.impact-low    { color: var(--text-secondary); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

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

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
}

.btn-icon:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.btn-icon svg, .btn-icon .icon {
    width: 1.25rem;
    height: 1.25rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-full {
    width: 100%;
}

/* Theme toggle icons */
.icon-sun, .icon-moon {
    width: 1.25rem;
    height: 1.25rem;
}

[data-theme="dark"] .icon-sun {
    display: none;
}

[data-theme="light"] .icon-moon,
:root:not([data-theme]) .icon-moon {
    display: none;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .chart-medium {
        grid-column: span 12;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        width: 100%;
        max-width: 320px;
        z-index: 200;
        transition: left var(--transition-normal);
    }

    .sidebar.open {
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }

    /*
     * `:not([hidden])` is load-bearing. The element is switched with the `hidden`
     * attribute from app.js, and `[hidden]`'s `display: none` comes from the user-agent
     * stylesheet — which any author `display` beats, whatever its specificity. Written
     * as a bare `.sidebar-backdrop { display: block }` the backdrop would ignore the
     * attribute entirely and sit over the page permanently on every narrow screen.
     */
    .sidebar-backdrop:not([hidden]) {
        display: block;
        position: fixed;
        inset: 0;
        background: rgb(0 0 0 / 45%);
        z-index: 150;               /* over the page, under the sidebar's 200 */
    }

    .header-left {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .header .menu-toggle {
        display: flex;
    }

    /*
     * Keeping the header inside its own height.
     *
     * `.header` is `position: fixed` at `--header-height` with `flex-wrap: nowrap`, and
     * the content below is offset by exactly that much. `.file-info` wraps to two lines
     * once the filename and the sample count stop fitting side by side, which made it
     * 66px tall inside a 60px header — so it centred itself to y = -3 and the top of the
     * pill was cut off by the top of the screen, overlapping the title on its way past.
     *
     * Two things fix it and both are needed. `min-width: 0` lets the flex children
     * actually shrink: their default `min-width: auto` means a flex item refuses to go
     * below its content width, which is what pushed the row wider than the bar. And
     * `flex-wrap: nowrap` with an ellipsis keeps the pill one line high whatever it
     * contains, so the header's height stops depending on the length of a filename.
     */
    .header {
        padding: 0 0.75rem;
        gap: 0.5rem;
    }

    .header-left,
    .header-center,
    .header-right {
        min-width: 0;
    }

    .header-center {
        flex: 1 1 auto;
        overflow: hidden;
    }

    /*
     * Scoped to `.header` for the same reason as `.menu-toggle` above: a media query
     * adds no specificity, so a plain `.file-info` here ties with the `.file-info` rule
     * further down this file and loses on source order. That rule sets
     * `flex-wrap: wrap`, which is precisely what makes the pill two lines tall and
     * pushes it out of the top of the header.
     */
    .header .file-info {
        display: block;             /* so the ellipsis applies to the whole pill */
        flex-wrap: nowrap;
        max-width: 100%;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    .header-left {
        flex: 0 1 auto;             /* may shrink; must not claim space it is not using */
    }

    .logo {
        font-size: 1.0625rem;
        white-space: nowrap;
        /* Without these the title overflows .header-left and runs underneath the file
           pill — `min-width: 0` on the parent lets the box shrink, but the text inside
           still needs telling what to do when it no longer fits. */
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* The word "Export" is the first thing worth losing; the icon still says what it is,
       and the button keeps its accessible name from the title attribute. */
    .header .export-btn {
        font-size: 0;
        padding: 0.5rem;
    }

    .header .export-btn svg {
        font-size: 1rem;
    }

    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 480px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }

    /*
     * On the narrowest phones the filename is squeezed to a few characters and tells
     * nobody anything, while it still costs the row the space the controls need. It is
     * not lost: the loaded-files list in the sidebar names every file in full.
     */
    .header-center {
        display: none;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Focus visible */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .sidebar,
    .header,
    .btn,
    .drop-zone {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .chart-container {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* ============================================
   NEW FEATURE STYLES
   ============================================ */

/* Export Menu */
.export-menu {
    position: absolute;
    z-index: 1000;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: 0.5rem 0;
}

.export-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
}

.export-menu-item:hover {
    background: var(--bg-tertiary);
}

.export-menu-item svg {
    width: 1rem;
    height: 1rem;
    color: var(--text-muted);
}

.export-menu-section {
    padding: 0.25rem 0;
}

.export-menu-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.export-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.25rem 0;
}

.export-menu-range {
    padding: 0.25rem 1rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

.export-menu-item-secondary {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.export-menu-item-secondary:hover {
    color: var(--text-primary);
}

.pro-badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.enterprise-badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
    font-weight: 700;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.trial-badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
    font-weight: 600;
    background: var(--color-success-light);
    color: var(--color-success);
    border-radius: 4px;
    margin-left: 0.25rem;
}

.trial-exhausted-badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
    font-weight: 600;
    background: var(--color-error-light);
    color: var(--color-error);
    border-radius: 4px;
    margin-left: 0.25rem;
}

.export-menu-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Enterprise Branding Form */
.branding-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.branding-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.branding-form label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.branding-form .form-input {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.15s ease;
}

.branding-form .form-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.branding-form .form-hint {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.branding-preview {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 0.5rem;
}

.branding-preview .preview-label {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.branding-preview .preview-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.branding-preview .preview-logo {
    max-height: 24px;
    max-width: 80px;
    object-fit: contain;
}

.branding-preview .preview-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-primary);
}

.branding-preview .preview-footer {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-align: center;
}

.sidebar-title .enterprise-badge {
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Upgrade CTA Banner */
.upgrade-cta {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--border-radius);
    padding: 1rem !important;
    margin: 0.5rem 0;
}

.upgrade-cta.hidden {
    display: none;
}

.upgrade-cta-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.upgrade-cta-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    color: #fbbf24;
}

.upgrade-cta-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
    stroke: currentColor;
}

.upgrade-cta-text {
    flex: 1;
    min-width: 0;
}

.upgrade-cta-text strong {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.125rem;
}

.upgrade-cta-text span {
    display: block;
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.3;
}

.btn-upgrade {
    flex-shrink: 0;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #7c3aed;
    background: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-upgrade:hover {
    background: #f5f3ff;
    transform: translateY(-1px);
}

.upgrade-cta-trial {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
}

.upgrade-cta-trial:empty {
    display: none;
}

.activate-license-link {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #ffffff;
    text-align: center;
    text-decoration: underline;
    opacity: 0.9;
    transition: opacity 0.15s ease;
}

.activate-license-link:hover {
    opacity: 1;
    color: #ffffff;
}

/* Dark mode adjustments for upgrade CTA */
[data-theme="dark"] .upgrade-cta {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

[data-theme="dark"] .btn-upgrade {
    color: #4f46e5;
}

[data-theme="dark"] .btn-upgrade:hover {
    background: #eef2ff;
}

/* SLA Thresholds */
.sla-config-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sla-config-panel h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.sla-thresholds-form {
    display: grid;
    gap: 0.75rem;
}

.sla-threshold-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sla-threshold-item label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sla-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sla-input-group input {
    flex: 1;
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
}

.sla-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 3rem;
}

.sla-actions {
    margin-top: 0.5rem;
}

.sla-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.sla-passed {
    background: var(--color-success-light);
    color: var(--color-success);
}

.sla-warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.sla-critical {
    background: var(--color-error-light);
    color: var(--color-error);
}

.sla-violations-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sla-violation {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
}

.sla-violation.critical {
    border-left: 3px solid var(--color-error);
}

.sla-violation.warning {
    border-left: 3px solid var(--color-warning);
}

.violation-icon {
    flex-shrink: 0;
}

/* Correlation Matrix */
.correlation-matrix {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.matrix-row {
    display: flex;
    gap: 2px;
}

.matrix-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    background: var(--bg-secondary);
    min-width: 60px;
    min-height: 40px;
}

.matrix-cell.header {
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    font-size: 0.7rem;
}

.matrix-cell.corner {
    background: var(--bg-tertiary);
}

.matrix-cell.data {
    font-weight: 500;
    cursor: help;
}

.correlation-legend {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 2px;
}

.correlation-insights {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.correlation-insights h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
}

.correlation-insights ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.insight-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    font-size: 0.8125rem;
}

.insight-icon {
    font-size: 1rem;
}

.insight-item.positive .insight-icon {
    color: var(--color-success);
}

.insight-item.negative .insight-icon {
    color: var(--color-error);
}

/* Percentile Heatmap */
.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1rem;
}

.heatmap-legend .legend-color {
    width: 20px;
    height: 12px;
}

.heatmap-legend .legend-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0 0.5rem;
}

/* Transaction Grouping */
.transaction-grouping-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.transaction-grouping-panel h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.transaction-groups-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.transaction-group-card {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 0.75rem;
}

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.group-samplers {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.group-metrics {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.transaction-suggestions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.suggestion-card {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    border-left: 3px solid var(--color-primary);
}

.suggestion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.suggestion-confidence {
    font-size: 0.65rem;
    text-transform: uppercase;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    background: var(--bg-secondary);
}

.suggestion-confidence.high {
    color: var(--color-success);
}

.suggestion-confidence.medium {
    color: var(--color-warning);
}

.suggestion-reason, .suggestion-samplers {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.25rem 0;
}

.transaction-actions {
    margin-top: 1rem;
}

/* Baseline Comparison */
.baseline-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.baseline-info {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 1rem;
}

.baseline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.baseline-header h4 {
    margin: 0;
    font-size: 0.875rem;
}

.baseline-name {
    font-weight: 600;
    margin: 0;
}

.baseline-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.25rem 0;
}

.baseline-metrics {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.no-baseline {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.baseline-actions {
    margin-top: 0.5rem;
}

.comparison-results {
    margin-top: 1rem;
}

.comparison-results h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.comparison-summary {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.comparison-table th,
.comparison-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.comparison-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.comparison-table tr.improved {
    background: var(--color-success-light);
}

.comparison-table tr.regressed {
    background: var(--color-error-light);
}

.change-cell {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.change-icon {
    font-size: 1rem;
}

tr.improved .change-icon {
    color: var(--color-success);
}

tr.regressed .change-icon {
    color: var(--color-error);
}

/* Recent Files */
.recent-files-panel h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
}

.recent-files-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.75rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.recent-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.recent-file-item:hover {
    background: var(--border-color);
}

.recent-file-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.recent-file-name {
    font-size: 0.875rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-file-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.no-recent {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 1rem;
}

/* Advanced Analysis Section */
.advanced-analysis-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    user-select: none;
}

.section-header:hover {
    background: var(--bg-tertiary);
}

.section-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
}

.section-content {
    padding: 1.25rem;
}

.section-header[aria-expanded="false"] + .section-content {
    display: none;
}

/* Analysis Tabs */
.analysis-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.5rem;
}

.analysis-tab {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.analysis-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.analysis-tab.active {
    background: var(--color-primary);
    color: white;
}

.analysis-tab-content {
    display: none;
}

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

/* Charts grid for new charts */
.analysis-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 1200px) {
    .analysis-charts-grid {
        grid-template-columns: 1fr;
    }
}

/* Header Export Button */
.header-actions {
    display: flex;
    gap: 0.5rem;
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* No data placeholder */
.no-data {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Chart insights */
.chart-analysis {
    margin-left: auto;
}

.chart-insight {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Loading Progress Overlay */
.loading-progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-progress-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.loading-progress-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 2rem 3rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    min-width: 350px;
    max-width: 90vw;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.loading-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.loading-file-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.loading-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.loading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-info));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.loading-progress-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.loading-cancel-btn {
    margin-top: 0.5rem;
}

/* Sampled indicator */
/*
 * Sampling notice.
 *
 * Deliberately a visible block rather than the tooltip on .sampled-indicator: a
 * title attribute is unreachable by keyboard and unread by most screen readers,
 * so the only explanation of what "Sampled" meant was hover-only. The wording
 * matters as much as the placement — the summary figures are exact, and saying
 * "sampled" without that qualification invites a reader to distrust numbers that
 * are correct.
 */
.sampling-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--color-warning-light, rgba(245, 158, 11, 0.12));
    border: 1px solid var(--color-warning, #f59e0b);
    border-radius: 0.5rem;
}

.sampling-notice::before {
    content: '~';
    flex: 0 0 auto;
    font-weight: 700;
    color: var(--color-warning, #f59e0b);
}

.sampling-notice strong {
    font-weight: 600;
}

.sampling-notice[hidden] {
    display: none;
}

.sampled-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-warning);
    background: var(--color-warning-light);
    padding: 0.125rem 0.5rem;
    border-radius: var(--border-radius);
    cursor: help;
    margin-left: 0.5rem;
}

.sampled-indicator::before {
    content: '~';
    font-weight: 700;
}

/* File stats with sampled indicator */
.file-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.file-stats {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Keyboard Shortcuts Modal */
.keyboard-shortcuts-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.keyboard-shortcuts-modal[hidden] {
    display: none;
}

.keyboard-shortcuts-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.keyboard-shortcuts-modal .modal-content {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
}

.keyboard-shortcuts-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.keyboard-shortcuts-modal .modal-header h2 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.keyboard-shortcuts-modal .modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.keyboard-shortcuts-modal .modal-close:hover {
    color: var(--text-primary);
}

.keyboard-shortcuts-modal .modal-body {
    padding: 1rem 1.5rem;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.shortcuts-table {
    width: 100%;
    border-collapse: collapse;
}

.shortcuts-table tr {
    border-bottom: 1px solid var(--border-light);
}

.shortcuts-table tr:last-child {
    border-bottom: none;
}

.shortcuts-table td {
    padding: 0.75rem 0;
}

.shortcut-keys {
    white-space: nowrap;
    width: 140px;
}

.shortcut-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

kbd {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

/* Small select for chart controls */
.select-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: var(--border-radius);
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ============================================
   License & Upgrade Modal Styles
   ============================================ */

/* License Badge */
.license-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 9999px;
    margin-left: 0.75rem;
}

.license-free {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.license-pro {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    box-shadow: 0 1px 3px rgba(245, 158, 11, 0.3);
}

.license-enterprise {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    border: none;
    box-shadow: 0 1px 3px rgba(139, 92, 246, 0.3);
}

/* Upgrade Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Upgrade Modal */
.upgrade-modal {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 480px;
    width: 90%;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.2s ease;
}

.modal-overlay.active .upgrade-modal {
    transform: scale(1) translateY(0);
}

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

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.upgrade-message {
    color: var(--text-secondary);
    margin: 0 0 1.5rem;
    line-height: 1.5;
}

.feature-list {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.feature-list h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
}

.feature-list ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.feature-list li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.feature-list li:last-child {
    margin-bottom: 0;
}

.feature-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.375rem;
    width: 0.625rem;
    height: 0.625rem;
    background: #10b981;
    border-radius: 50%;
}

.pricing {
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(217, 119, 6, 0.1) 100%);
    border-radius: 8px;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.price {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.price-note {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem 1.5rem;
    justify-content: flex-end;
}

/* Wide upgrade modal for pricing table */
.upgrade-modal-wide {
    max-width: 900px;
}

/* Pricing Table */
.pricing-table {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}

@media (max-width: 768px) {
    .pricing-table {
        grid-template-columns: 1fr;
    }
}

.pricing-tier {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: relative;
}

.pricing-tier.highlighted {
    border: 2px solid var(--color-primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.pricing-tier .tier-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pricing-tier h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
    text-align: center;
}

.tier-price {
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.tier-price .price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.tier-price .price-note {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 0.25rem;
}

.tier-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    flex: 1;
}

.tier-features li {
    padding: 0.375rem 0;
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.tier-features li::before {
    content: '';
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.tier-features li.included {
    color: var(--text-primary);
}

.tier-features li.included::before {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2310b981'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}

.tier-features li.not-included {
    color: var(--text-muted);
}

.tier-features li.not-included::before {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}

.tier-action {
    text-align: center;
    margin-top: auto;
}

.tier-action .btn-tier {
    width: 100%;
}

.tier-action .current-tier {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border-radius: 6px;
    width: 100%;
}

/* Trial info in modal */
.trial-info {
    margin-top: 1rem;
    text-align: center;
}

.trial-info .trial-remaining {
    color: var(--color-success);
    font-size: 0.875rem;
}

.trial-info .trial-exhausted {
    color: var(--color-error);
    font-size: 0.875rem;
}

/* License Input */
.license-input-group {
    margin-top: 1rem;
}

.license-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    letter-spacing: 1px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-transform: uppercase;
    transition: border-color 0.15s ease;
}

.license-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.license-input::placeholder {
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: normal;
}

.license-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    min-height: 1.25rem;
}

.license-status {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    min-height: 1.25rem;
    transition: color 0.2s ease;
}

/* Feature Locked State */
.feature-locked {
    position: relative;
    opacity: 0.6;
}

.feature-locked::after {
    content: 'PRO';
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    font-size: 0.5625rem;
    font-weight: 700;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* Upgrade link in sidebar */
.upgrade-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.15) 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--border-radius);
    color: #f59e0b;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-top: 1rem;
}

.upgrade-link:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.25) 0%, rgba(217, 119, 6, 0.25) 100%);
    border-color: rgba(245, 158, 11, 0.5);
}

.upgrade-link svg {
    width: 1rem;
    height: 1rem;
}

/* =====================================================
   Advanced Insights Panel Styles
   ===================================================== */

.advanced-insights-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    margin-top: 1.5rem;
    overflow: hidden;
}

.advanced-insights-panel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--bg-tertiary);
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.advanced-insights-panel .panel-header:hover {
    background: var(--bg-primary);
}

.advanced-insights-panel .panel-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.advanced-insights-panel .panel-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--color-primary);
}

.advanced-insights-panel .chevron {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--text-secondary);
    transition: transform var(--transition-fast);
}

.advanced-insights-panel .panel-header[aria-expanded="false"] .chevron {
    transform: rotate(-90deg);
}

.advanced-insights-panel .panel-content {
    padding: 1.25rem;
}

.advanced-insights-panel .panel-header[aria-expanded="false"] + .panel-content {
    display: none;
}

/* Insights Cards Grid */
.insights-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1200px) {
    .insights-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .insights-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* Insight Cards */
.insight-card {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.insight-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.insight-card .card-header h4 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.insight-card .card-body {
    padding: 1rem;
}

/* Stability Score Display */
.stability-score-display {
    text-align: center;
}

.stability-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.stability-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--color-primary);
}

.stability-value.excellent { color: var(--color-success); }
.stability-value.good { color: var(--color-primary); }
.stability-value.fair { color: var(--color-warning); }
.stability-value.poor { color: var(--color-error); }
.stability-value.critical { color: var(--color-error); }

.stability-rating {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.stability-rating.excellent { color: var(--color-success); }
.stability-rating.good { color: var(--color-primary); }
.stability-rating.fair { color: var(--color-warning); }
.stability-rating.poor { color: var(--color-error); }
.stability-rating.critical { color: var(--color-error); }

.stability-trend {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.stability-trend.improving { color: var(--color-success); }
.stability-trend.degrading { color: var(--color-error); }

.stability-breakdown {
    margin-top: 1rem;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
}

.breakdown-bar {
    height: 4px;
    background: var(--color-primary);
    border-radius: 2px;
    max-width: 100px;
    transition: width 0.3s ease;
}

.breakdown-label {
    color: var(--text-secondary);
    flex: 1;
}

.breakdown-value {
    font-weight: 500;
    color: var(--text-primary);
}

/* SLA Compliance */
.compliance-badge {
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: var(--color-success-light);
    color: var(--color-success);
}

.compliance-badge.warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.compliance-badge.critical {
    background: var(--color-error-light);
    color: var(--color-error);
}

.sla-summary {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sla-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border-light);
}

.sla-metric:last-child {
    border-bottom: none;
}

.sla-metric .metric-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sla-metric .metric-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.sla-metric .metric-value.compliant {
    color: var(--color-success);
}

.sla-metric .metric-value.violation {
    color: var(--color-error);
}

/* Thread Efficiency Gauge */
.efficiency-gauge-svg {
    width: 100%;
    max-width: 180px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.gauge-value-arc {
    transition: stroke-dasharray 0.5s ease;
}

.gauge-score {
    font-size: 2rem;
    font-weight: 700;
    fill: var(--text-primary);
}

.gauge-label {
    font-size: 0.75rem;
    fill: var(--text-secondary);
}

.efficiency-details {
    display: flex;
    justify-content: space-around;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.efficiency-stat {
    text-align: center;
}

.efficiency-stat .stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.efficiency-stat .stat-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.efficiency-placeholder {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 1rem;
}

/* Capacity Projection */
.capacity-card {
    grid-column: 1 / -1;
}

.capacity-summary {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
}

.capacity-summary .capacity-metric {
    flex: 1;
}

.capacity-metric {
    text-align: center;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
}

.capacity-metric .metric-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-primary);
}

.capacity-metric .metric-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Insights Charts Grid */
.insights-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1000px) {
    .insights-charts-grid {
        grid-template-columns: 1fr;
    }
}

.insight-chart {
    min-height: 250px;
}

.insight-chart .chart-body {
    height: 200px;
}

/* Insights List Section */
.insights-list-section {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 1rem;
}

.insights-list-section h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.insights-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.insight-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    border-left: 3px solid var(--color-info);
}

.insight-item.warning {
    border-left-color: var(--color-warning);
}

.insight-item.critical {
    border-left-color: var(--color-error);
}

.insight-item.success {
    border-left-color: var(--color-success);
}

.insight-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    color: var(--color-info);
}

.insight-item.warning .insight-icon {
    color: var(--color-warning);
}

.insight-item.critical .insight-icon {
    color: var(--color-error);
}

.insight-item.success .insight-icon {
    color: var(--color-success);
}

.insight-icon svg {
    width: 100%;
    height: 100%;
}

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

.insight-message {
    display: block;
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.insight-source {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.no-insights {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ==========================================================================
   Timeline Brush Component
   ========================================================================== */

/* Standalone section styling (between summary cards and charts) */
.timeline-brush-section {
    position: relative;
    height: 60px;
    margin-bottom: 1.5rem;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    user-select: none;
    overflow: hidden;
    isolation: isolate;
}

.timeline-brush-section canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Legacy container styling (inside chart) - kept for backwards compatibility */
.timeline-brush-container {
    position: relative;
    height: 50px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-tertiary);
    user-select: none;
    overflow: hidden;
    isolation: isolate;
}

.timeline-brush-container canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.brush-selection {
    position: absolute;
    top: 4px;
    bottom: 4px;
    background: rgba(59, 130, 246, 0.15);
    border: 2px solid var(--color-primary);
    border-radius: 4px;
    cursor: move;
    transition: background-color var(--transition-fast);
    z-index: 2;
}

.brush-selection:hover {
    background: rgba(59, 130, 246, 0.25);
}

.timeline-brush-container.is-dragging .brush-selection,
.timeline-brush-section.is-dragging .brush-selection {
    background: rgba(59, 130, 246, 0.3);
}

/* Adjust brush selection for standalone section (has its own padding) */
.timeline-brush-section .brush-selection {
    top: 0;
    bottom: 0;
}

.timeline-brush-section .brush-overlay {
    top: 0;
    bottom: 0;
}

.brush-handle {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 8px;
    background: var(--color-primary);
    cursor: ew-resize;
    border-radius: 2px;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
    z-index: 3;
}

.brush-handle:hover {
    background: var(--color-primary-hover);
    transform: scaleX(1.2);
}

.brush-handle-left {
    left: -4px;
}

.brush-handle-right {
    right: -4px;
}

/* Arrow indicators on handles */
.brush-handle::before,
.brush-handle::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    opacity: 0.9;
    transition: opacity var(--transition-fast);
}

.brush-handle:hover::before,
.brush-handle:hover::after {
    opacity: 1;
}

/* Left handle - arrows pointing left/right */
.brush-handle-left::before {
    top: 8px;
    border-width: 5px 6px 5px 0;
    border-color: transparent white transparent transparent;
}

.brush-handle-left::after {
    bottom: 8px;
    border-width: 5px 0 5px 6px;
    border-color: transparent transparent transparent white;
}

/* Right handle - arrows pointing right/left */
.brush-handle-right::before {
    top: 8px;
    border-width: 5px 0 5px 6px;
    border-color: transparent transparent transparent white;
}

.brush-handle-right::after {
    bottom: 8px;
    border-width: 5px 6px 5px 0;
    border-color: transparent white transparent transparent;
}

/* Unselected regions overlay */
.brush-overlay {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    pointer-events: none;
    z-index: 1;
}

.brush-overlay-left {
    left: 0;
}

.brush-overlay-right {
    right: 0;
}

/* Dark theme adjustments */
[data-theme="dark"] .timeline-brush-container {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .brush-selection {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--color-primary);
}

[data-theme="dark"] .brush-selection:hover {
    background: rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .brush-overlay {
    background: rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   View Toggle Buttons
   ========================================================================== */

.chart-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-right: auto;
    margin-left: 1rem;
}

.btn-group {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.btn-group .btn-toggle {
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 0;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-group .btn-toggle:not(:last-child) {
    border-right: 1px solid var(--border-color);
}

.btn-group .btn-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-group .btn-toggle.active {
    background: var(--color-primary);
    color: white;
}

.btn-group .btn-toggle svg {
    width: 14px;
    height: 14px;
}

/* Chart header layout adjustment */
.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chart-header h3 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Dark theme for view toggle */
[data-theme="dark"] .btn-group {
    border-color: var(--border-color);
}

[data-theme="dark"] .btn-group .btn-toggle {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

[data-theme="dark"] .btn-group .btn-toggle:hover {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .btn-group .btn-toggle.active {
    background: var(--color-primary);
    color: white;
}

/* ===========================
   Tool Badge Styles
   Multi-tool support badges
   =========================== */

.tool-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 9999px;
    margin-left: 0.5rem;
}

.tool-badge-sm {
    padding: 0.0625rem 0.375rem;
    font-size: 0.5625rem;
    margin-left: 0.25rem;
}

.tool-badge-jmeter {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.tool-badge-k6 {
    background: rgba(127, 86, 217, 0.15);
    color: #7f56d9;
}

.tool-badge-gatling {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
}

.tool-badge-unknown {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

[data-theme="dark"] .tool-badge-jmeter {
    background: rgba(59, 130, 246, 0.25);
    color: #60a5fa;
}

[data-theme="dark"] .tool-badge-k6 {
    background: rgba(127, 86, 217, 0.25);
    color: #a78bfa;
}

[data-theme="dark"] .tool-badge-gatling {
    background: rgba(249, 115, 22, 0.25);
    color: #fb923c;
}

[data-theme="dark"] .tool-badge-unknown {
    background: rgba(107, 114, 128, 0.25);
    color: #9ca3af;
}

/* ============================================
   Update Notification Banner
   ============================================ */

.update-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(135deg, var(--color-primary) 0%, #2563eb 100%);
    color: white;
    padding: 0;
    box-shadow: var(--shadow-md);
    transform: translateY(-100%);
    transition: transform var(--transition-normal);
}

.update-notification-visible {
    transform: translateY(0);
}

.update-notification-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.update-notification-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.update-notification-icon svg {
    stroke: white;
}

.update-notification-text {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.update-notification-text strong {
    font-weight: 600;
}

.update-notification-text span {
    opacity: 0.9;
}

.update-notification-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.update-notification .btn-primary {
    background: white;
    color: var(--color-primary);
    border: none;
}

.update-notification .btn-primary:hover {
    background: rgba(255, 255, 255, 0.9);
}

.update-notification .btn-secondary {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.update-notification .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
}

/* Adjust header position when update notification is visible */
.update-notification-visible ~ .main-wrapper {
    margin-top: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .update-notification-content {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }

    .update-notification-text {
        justify-content: center;
    }

    .update-notification-actions {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================
   License Activation Modal (Electron in-app license key entry)
   ============================================================ */

.license-activation-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 1rem;
}

.license-activation-overlay.license-activation-visible {
    opacity: 1;
}

.license-activation-modal {
    background: var(--bg-secondary, #1e2035);
    border: 1px solid var(--border-color, #2d3055);
    border-radius: 12px;
    padding: 2rem;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.license-activation-overlay.license-activation-visible .license-activation-modal {
    transform: translateY(0);
}

.license-activation-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
    margin: 0 0 0.5rem;
}

.license-activation-body {
    color: var(--text-secondary, #a0a0b0);
    font-size: 0.9rem;
    margin: 0 0 0.75rem;
    line-height: 1.5;
}

.license-activation-counter {
    font-size: 0.8rem;
    color: var(--text-muted, #6b7280);
    background: var(--bg-tertiary, rgba(255,255,255,0.04));
    border-left: 3px solid var(--accent-primary, #6366f1);
    padding: 0.4rem 0.65rem;
    border-radius: 0 4px 4px 0;
    margin: 0 0 1rem;
    line-height: 1.4;
}

.license-activation-counter strong {
    color: var(--text-secondary, #a0a0b0);
    font-weight: 600;
}

.license-activation-checkout-link {
    color: var(--accent-primary, #6366f1);
    text-decoration: none;
}

.license-activation-checkout-link:hover {
    text-decoration: underline;
}

.license-activation-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.license-activation-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary, #e0e0e0);
}

.license-activation-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-primary, #12132a);
    border: 1px solid var(--border-color, #2d3055);
    border-radius: 6px;
    color: var(--text-primary, #e0e0e0);
    font-size: 0.875rem;
    font-family: monospace;
    letter-spacing: 0.05em;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.license-activation-input:focus {
    outline: none;
    border-color: var(--accent-primary, #6366f1);
}

.license-activation-error {
    color: #f87171;
    font-size: 0.8rem;
    min-height: 1.2em;
    margin: 0;
}

.license-activation-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.license-activation-submit,
.license-activation-dismiss {
    flex: 1;
}

/* ============================================================
   Email Prompt Modal (Electron in-app email capture)
   ============================================================ */

.email-prompt-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 1rem;
}

.email-prompt-overlay.email-prompt-visible {
    opacity: 1;
}

.email-prompt-modal {
    background: var(--bg-secondary, #1e2035);
    border: 1px solid var(--border-color, #2d3055);
    border-radius: 12px;
    padding: 2rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.email-prompt-overlay.email-prompt-visible .email-prompt-modal {
    transform: translateY(0);
}

.email-prompt-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
    margin: 0 0 0.5rem;
}

.email-prompt-body {
    color: var(--text-secondary, #a0a0b0);
    font-size: 0.9rem;
    margin: 0 0 1.25rem;
    line-height: 1.5;
}

.email-prompt-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.email-prompt-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary, #e0e0e0);
}

.email-prompt-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-primary, #12132a);
    border: 1px solid var(--border-color, #2d3055);
    border-radius: 6px;
    color: var(--text-primary, #e0e0e0);
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.email-prompt-input:focus {
    outline: none;
    border-color: var(--accent-primary, #6366f1);
}

.email-prompt-error {
    color: #f87171;
    font-size: 0.8rem;
    min-height: 1.2em;
    margin: 0;
}

.email-prompt-consent {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary, #a0a0b0);
    cursor: pointer;
    line-height: 1.4;
}

.email-prompt-consent input[type="checkbox"] {
    flex-shrink: 0;
    margin-top: 0.15em;
    accent-color: var(--accent-primary, #6366f1);
}

.email-prompt-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.email-prompt-submit,
.email-prompt-dismiss {
    flex: 1;
}
