:root {
    --bpw-ink: #161a1d;
    --bpw-muted: #5f6b63;
    --bpw-paper: #f5f6f1;
    --bpw-panel: #ffffff;
    --bpw-panel-soft: #faf8f1;
    --bpw-line: #d9ded5;
    --bpw-teal: #087f8c;
    --bpw-coral: #c9513d;
    --bpw-gold: #b88414;
    --bpw-green: #247b5b;
    --bpw-shadow: 0 18px 50px rgba(30, 38, 31, 0.08);
}

html {
    background: var(--bpw-paper);
}

body {
    min-height: 100vh;
    background:
        linear-gradient(90deg, rgba(22, 26, 29, 0.035) 1px, transparent 1px),
        linear-gradient(180deg, rgba(22, 26, 29, 0.035) 1px, transparent 1px),
        linear-gradient(135deg, #f7f8f4 0%, #eef4f2 45%, #f8f1e7 100%);
    background-size: 42px 42px, 42px 42px, auto;
    color: var(--bpw-ink);
}

.container {
    max-width: 1440px !important;
    padding: 28px !important;
}

header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 -4px 1.5rem !important;
    padding: 0.85rem 1rem !important;
    border: 1px solid rgba(22, 26, 29, 0.08) !important;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 10px 36px rgba(22, 26, 29, 0.08);
    backdrop-filter: blur(16px);
}

header h1,
h1 {
    color: var(--bpw-ink) !important;
    font-size: clamp(1.35rem, 2vw, 2rem) !important;
    font-weight: 760 !important;
    letter-spacing: 0 !important;
}

.meta {
    color: var(--bpw-muted) !important;
}

.back-link,
.back-home-link {
    color: var(--bpw-teal) !important;
    font-weight: 650;
}

.run-header-bar {
    position: relative;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end !important;
    min-height: 170px;
    margin-bottom: 1rem !important;
    padding: 1.35rem !important;
    overflow: hidden;
    color: #fff;
    border: 0 !important;
    border-radius: 8px !important;
    background:
        linear-gradient(130deg, rgba(22, 26, 29, 0.97), rgba(8, 127, 140, 0.91) 58%, rgba(201, 81, 61, 0.86));
    box-shadow: var(--bpw-shadow);
}

.run-header-bar::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.10) 1px, transparent 1px);
    background-size: 36px 36px;
    opacity: 0.36;
    pointer-events: none;
}

.run-header-main,
.run-header-refresh {
    position: relative;
    z-index: 1;
}

.run-header-main {
    align-items: flex-start !important;
    gap: 0.65rem !important;
}

.run-header-main .run-id {
    flex-basis: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
    color: #fff !important;
    font-size: clamp(1.35rem, 2.2vw, 2.4rem);
    line-height: 1.05;
}

.run-header-main .run-status,
.run-header-main .run-stat {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.13);
    color: rgba(255, 255, 255, 0.94) !important;
    font-weight: 700;
}

.run-header-main .run-status.done {
    background: rgba(36, 123, 91, 0.36) !important;
    color: #fff !important;
}

.run-header-main .run-status.live {
    background: rgba(184, 132, 20, 0.42) !important;
    color: #fff !important;
}

.run-header-main .run-stat.muted {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.72) !important;
}

.run-header-refresh {
    align-self: start;
    padding: 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
}

.run-header-refresh label {
    color: rgba(255, 255, 255, 0.86) !important;
    font-weight: 700;
}

.run-header-refresh select,
select,
input[type="file"] {
    border: 1px solid var(--bpw-line) !important;
    border-radius: 8px !important;
    background: #fff;
    color: var(--bpw-ink);
}

.run-kpi-strip,
.status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 0 0 1.2rem;
}

.run-kpi,
.status-card {
    min-height: 108px;
    padding: 1rem !important;
    border: 1px solid rgba(22, 26, 29, 0.08) !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 12px 34px rgba(22, 26, 29, 0.06);
    text-align: left !important;
}

.run-kpi-label,
.status-card h3 {
    margin-bottom: 0.35rem !important;
    color: var(--bpw-muted) !important;
    font-size: 0.76rem !important;
    font-weight: 760 !important;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.run-kpi-value,
.status-card p {
    color: var(--bpw-ink) !important;
    font-size: clamp(1.3rem, 2vw, 2.1rem) !important;
    font-weight: 780 !important;
    line-height: 1.08;
}

.run-kpi-note {
    margin-top: 0.45rem;
    color: var(--bpw-muted);
    font-size: 0.82rem;
}

.chart-container,
.process-info-section,
.compare-controls,
.upload-controls {
    border: 1px solid rgba(22, 26, 29, 0.09) !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.92) !important;
    box-shadow: var(--bpw-shadow);
}

.chart-container {
    padding: 1rem !important;
}

.chart-container h3,
.chart-container h4,
.process-info-section h2,
.compare-header h2 {
    color: var(--bpw-ink) !important;
    font-weight: 760 !important;
    letter-spacing: 0 !important;
}

.downloads-toolbar,
.chart-filters,
.replay-controls,
.compare-controls,
.upload-controls {
    gap: 0.65rem !important;
}

.downloads-toolbar,
.chart-filters {
    padding: 0.65rem;
    border: 1px solid rgba(22, 26, 29, 0.08);
    border-radius: 8px;
    background: var(--bpw-panel-soft);
}

.chart-filters label {
    min-height: 2rem;
    padding: 0.25rem 0.55rem;
    border: 1px solid rgba(22, 26, 29, 0.08);
    border-radius: 999px;
    background: #fff;
    color: var(--bpw-ink);
    font-weight: 650;
}

.btn {
    min-height: 2.2rem;
    border: 1px solid rgba(8, 127, 140, 0.25) !important;
    border-radius: 8px !important;
    background: var(--bpw-teal) !important;
    box-shadow: 0 8px 18px rgba(8, 127, 140, 0.18);
    color: #fff !important;
    font-weight: 740;
}

.btn.secondary {
    border-color: rgba(22, 26, 29, 0.12) !important;
    background: #f3efe6 !important;
    box-shadow: none;
    color: var(--bpw-ink) !important;
}

.btn:hover {
    filter: brightness(0.96);
}

.replay-controls {
    border: 1px solid rgba(8, 127, 140, 0.18) !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, rgba(8, 127, 140, 0.10), rgba(184, 132, 20, 0.10)) !important;
}

.replay-controls input[type="range"] {
    accent-color: var(--bpw-coral);
}

.process-info-card {
    border: 1px solid rgba(22, 26, 29, 0.08) !important;
    border-radius: 8px !important;
    background: var(--bpw-panel-soft) !important;
}

.process-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.65rem;
    margin: 1rem 0;
}

.process-metric {
    padding: 0.75rem;
    border: 1px solid rgba(22, 26, 29, 0.08);
    border-radius: 8px;
    background: #fff;
}

.process-metric strong {
    display: block;
    color: var(--bpw-muted);
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.process-metric span {
    display: block;
    margin-top: 0.2rem;
    color: var(--bpw-ink);
    font-size: 1.05rem;
    font-weight: 760;
}

.vm-flag {
    border: 1px solid rgba(22, 26, 29, 0.08);
    border-radius: 999px !important;
    background: #fff !important;
    color: #30423c !important;
}

.compare-section,
.replay-section {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
}

.compare-grid {
    gap: 1rem !important;
}

.compare-column {
    min-width: 0;
}

.loading,
.error,
.not-found {
    border-radius: 8px !important;
    box-shadow: var(--bpw-shadow);
}

footer {
    background: rgba(255, 255, 255, 0.72);
}

@media (max-width: 920px) {
    .container {
        padding: 14px !important;
    }

    header,
    .run-header-bar {
        position: relative;
    }

    .run-header-bar {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .run-kpi-strip,
    .status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chart-container {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

@media (max-width: 560px) {
    .run-kpi-strip,
    .status-grid {
        grid-template-columns: 1fr;
    }

    .run-header-main .run-id {
        font-size: 1.25rem;
    }
}
