:root {
    --ink: #17202a;
    --muted: #667085;
    --line: #d7dde5;
    --panel: #f7f9fb;
    --panel-strong: #eef3f8;
    --blue: #245a94;
    --green: #137a46;
    --red: #b42318;
    --amber: #b54708;
}

body {
    background: #fff;
    box-sizing: border-box;
    color: var(--ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    max-width: none;
    padding: 2rem;
    width: 100%;
}

main {
    margin: 0;
    max-width: none;
    width: 100%;
}

h1 {
    border-bottom: 3px solid var(--blue);
    font-size: 2.2rem;
    margin: 0 0 1.5rem;
    padding-bottom: 0.5rem;
}

h2 {
    border-bottom: 1px solid var(--line);
    margin-top: 2rem;
    padding-bottom: 0.35rem;
}

a {
    color: var(--blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

table {
    border-collapse: collapse;
    display: table;
    margin: 1rem 0 1.5rem;
    width: 100%;
}

.plot-toolbar {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    margin: 1rem 0 0.35rem;
}

.plot-toolbar label {
    align-items: center;
    color: var(--muted);
    display: flex;
    font-size: 0.88rem;
    gap: 0.75rem;
    width: min(720px, 100%);
}

.plot-selector-slider {
    accent-color: var(--blue);
    flex: 1;
    min-width: 180px;
}

.plot-counter {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.plot-title {
    color: var(--ink);
    font-weight: 650;
    overflow-wrap: anywhere;
}

.result-table-scroll {
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow-x: auto;
    width: 100%;
}

.result-table-scroll table {
    margin: 0;
    min-width: 760px;
}

.plot-browser {
    margin-top: 1rem;
}

.plot-stage {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.75rem;
}

.plot-frame {
    display: none;
}

.plot-frame.active-plot {
    display: block;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 0.45rem 0.7rem;
    text-align: left;
}

th {
    background: var(--panel-strong);
    color: #1f2937;
    font-weight: 650;
}

.topbar {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 1rem;
    margin: -2rem -2rem 1.5rem;
    min-height: 64px;
    padding: 0 2rem;
}

.brand {
    align-items: baseline;
    display: flex;
    gap: 0.7rem;
    min-width: 300px;
}

.brand strong {
    color: #102a43;
    font-size: 1.25rem;
}

.brand span,
.muted,
.hint {
    color: var(--muted);
}

.scope {
    align-items: center;
    display: flex;
    flex: 1;
    gap: 0.75rem;
    justify-content: flex-end;
}

.readonly {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.84rem;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem;
    white-space: nowrap;
}

.readonly::before {
    background: var(--blue);
    border-radius: 50%;
    content: "";
    height: 0.55rem;
    width: 0.55rem;
}

.dashboard {
    display: grid;
    gap: 22px;
}

.page-head {
    align-items: end;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.page-head h1 {
    margin-bottom: 0.35rem;
}

.filters {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 7px;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 14px;
}

.field {
    display: grid;
    gap: 0.35rem;
}

.field label {
    color: #344054;
    font-size: 0.84rem;
    font-weight: 650;
}

.field select,
.field input {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    min-height: 38px;
    min-width: 0;
    padding: 0.45rem 0.6rem;
    width: 100%;
}

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

.metric {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 7px;
    display: grid;
    gap: 0.2rem;
    min-height: 76px;
    padding: 0.85rem;
}

.metric span {
    color: var(--muted);
    font-size: 0.82rem;
}

.metric b {
    font-size: 1.3rem;
    line-height: 1.1;
}

.metric strong {
    font-size: 0.88rem;
}

.section {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 16px;
    padding-top: 16px;
}

.section-head {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.runs {
    border-collapse: collapse;
    width: 100%;
}

.runs th,
.runs td {
    border-bottom: 1px solid var(--line);
    padding: 0.55rem 0.65rem;
    text-align: left;
    vertical-align: top;
}

.runs th {
    background: var(--panel-strong);
    color: #344054;
    font-size: 0.82rem;
}

.mono {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.86rem;
}

.links {
    display: grid;
    gap: 0.55rem;
}

.result-link {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--blue);
    display: flex;
    justify-content: space-between;
    padding: 0.55rem 0.65rem;
    text-decoration: none;
}

.result-list {
    display: grid;
    gap: 0.45rem;
    margin-top: 1rem;
}

.result-entry {
    align-items: center;
    border-bottom: 1px solid #d8dde5;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.5rem 0;
}

.badge {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.78rem;
    gap: 0.35rem;
    min-height: 24px;
    padding: 0.12rem 0.5rem;
    white-space: nowrap;
}

.badge::before {
    background: #9aa3af;
    border-radius: 50%;
    content: "";
    display: inline-block;
    height: 0.65rem;
    width: 0.65rem;
}

.badge.ok::before {
    background: var(--green);
}

.badge.nok::before,
.badge.fail::before {
    background: var(--red);
}

.badge.warn::before {
    background: var(--amber);
}

.run-date,
.muted {
    color: var(--muted);
    font-size: 0.9rem;
}

.accordion {
    background-color: #eef3f8;
    border: 1px solid #d8dde5;
    color: #20242a;
    cursor: pointer;
    font: inherit;
    margin-top: 0.45rem;
    outline: none;
    padding: 0.75rem;
    text-align: left;
    transition: background-color 0.2s ease-out;
    width: 100%;
}

.active,
.accordion:hover {
    background-color: #dce8f5;
}

.accordion::after {
    color: #667085;
    content: "+";
    float: right;
    font-weight: 700;
    margin-left: 0.5rem;
}

.active::after {
    content: "-";
}

.accordion.fail {
    background-color: #fff4d5;
    border-color: #e2b842;
}

.accordion.fail:hover {
    background-color: #ffe8a3;
}

.panel {
    background-color: white;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    max-height: 0;
    overflow: hidden;
    padding: 0 0.75rem;
    transition: max-height 0.2s ease-out;
}

.plot-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    margin-top: 1rem;
}

figure {
    margin: 0;
}

figure img,
.plot-image {
    border: 1px solid var(--line);
    height: auto;
    max-width: 100%;
}

figcaption {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 0.35rem;
    overflow-wrap: anywhere;
}

@media (max-width: 1000px) {
    .filters,
    .summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .page-head,
    .topbar,
    .scope {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    body {
        padding: 1rem;
    }

    .topbar {
        margin: -1rem -1rem 1rem;
        padding: 1rem;
    }

    .filters,
    .summary {
        grid-template-columns: 1fr;
    }

    table,
    .runs {
        display: block;
        overflow-x: auto;
    }
}
