/* Console base styles. Every colour, size and space comes from tokens.css. */

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: var(--text-md);
    line-height: var(--leading);
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 var(--space-3); font-weight: 600; }
h1 { font-size: var(--text-lg); }
h2 { font-size: var(--text-md); margin-top: var(--space-5); }
h3, h4 { font-size: var(--text-md); }
h1:focus { outline: none; }
p { margin: 0 0 var(--space-4); }
hr { border: 0; border-top: 1px solid var(--color-border); margin: var(--space-4) 0; }
code, pre, kbd { font-family: var(--font-mono); font-size: 0.9em; }
code { background: var(--color-surface-2); padding: 0.1em 0.35em; border-radius: var(--radius-sm); }

a, .btn-link { color: var(--color-accent); text-decoration: none; }
a:hover, .btn-link:hover { text-decoration: underline; }

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

/* ---------- App shell (CDPR-0140) ---------- */

.shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    grid-template-rows: var(--topbar-height) 1fr;
    grid-template-areas: "brand topbar" "nav main";
    min-height: 100vh;
}
:root[data-nav="rail"] .shell { grid-template-columns: var(--sidebar-rail-width) minmax(0, 1fr); }
/* Signed out there is no menu (CDPR-0240), whatever the browser remembers of the rail: the page has the width under the top bar. */
.shell:not(:has(.sidenav)), :root[data-nav="rail"] .shell:not(:has(.sidenav)) {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    grid-template-areas: "brand topbar" "main main";
}
:root[data-nav="rail"] .shell:not(:has(.sidenav)) .brand-text { position: static; width: auto; height: auto; clip: auto; }

.shell-brand, .topbar { position: sticky; top: 0; z-index: 30; }
.shell-brand {
    grid-area: brand;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-3);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    font-weight: 700;
    color: var(--color-text);
    overflow: hidden;
    white-space: nowrap;
}
.shell-brand:hover { text-decoration: none; }
.shell-brand .logo {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 1.75rem;
    height: 1.75rem;
    margin-left: 0.125rem;
    border-radius: var(--radius-sm);
    background: var(--color-accent);
    color: var(--color-accent-text);
    font-size: var(--text-xs);
}

.topbar {
    grid-area: topbar;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 0 var(--page-pad-x);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}
.topbar-account { color: var(--color-text-muted); font-size: var(--text-sm); }
.topbar-actions { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.topbar-actions form { margin: 0; }
.topbar-user { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon { width: var(--icon-size); height: var(--icon-size); flex: none; }
.topbar-actions button.icon-btn, .icon-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    height: 2rem;
    min-width: 2rem;
    justify-content: center;
    padding: 0 var(--space-2);
    color: var(--color-text-muted);
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font: inherit;
    font-size: var(--text-sm);
    cursor: pointer;
}
.topbar-actions button.icon-btn:hover, .icon-btn:hover { background: var(--color-surface-2); color: var(--color-text); }

/* Account menu: a <details> dropdown. */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { background: var(--color-surface-2); color: var(--color-text); }
.menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + var(--space-1));
    min-width: 14rem;
    padding: var(--space-1);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgb(16 24 40 / 0.16);
    z-index: 40;
}
.menu-panel form { margin: 0; }
.menu-note { margin: 0; padding: var(--space-2) var(--space-3); color: var(--color-text-muted); font-size: var(--text-xs); overflow-wrap: anywhere; }
.menu-note strong { color: var(--color-text); font-size: var(--text-sm); }
.menu-item, .menu-panel button.menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    color: var(--color-text);
    background: none;
    border: 0;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 400;
    text-align: left;
    cursor: pointer;
}
.menu-item:hover, .menu-panel button.menu-item:hover { background: var(--color-surface-2); text-decoration: none; }

.sidenav {
    grid-area: nav;
    position: sticky;
    top: var(--topbar-height);
    align-self: start;
    height: calc(100vh - var(--topbar-height));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--space-3) var(--space-2);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
}
.sidenav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sidenav a, .sidenav button.nav-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0.4375rem var(--space-3);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: 500;
    white-space: nowrap;
}
.sidenav a:hover { background: var(--color-surface-2); color: var(--color-text); text-decoration: none; }
.sidenav a.active { background: var(--color-accent-soft); color: var(--color-accent); }
.sidenav button.nav-toggle { width: 100%; background: none; border: 0; cursor: pointer; justify-content: flex-start; }
.sidenav button.nav-toggle:hover { background: var(--color-surface-2); color: var(--color-text); }

/* Rail: icons only; labels stay in the accessibility tree and show as tooltips (title). */
:root[data-nav="rail"] .nav-label,
:root[data-nav="rail"] .brand-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:root[data-nav="rail"] .sidenav a,
:root[data-nav="rail"] .sidenav button.nav-toggle { justify-content: center; padding-left: 0; padding-right: 0; }
:root[data-nav="rail"] .shell-brand { justify-content: center; padding: 0; }

.main { grid-area: main; min-width: 0; padding: var(--page-pad-y) var(--page-pad-x) var(--space-6); }
.page-form { max-width: var(--content-max-form); }

@media (max-width: 720px) {
    .shell, :root[data-nav="rail"] .shell {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-rows: var(--topbar-height) auto 1fr;
        grid-template-areas: "brand topbar" "nav nav" "main main";
    }
    .shell:not(:has(.sidenav)), :root[data-nav="rail"] .shell:not(:has(.sidenav)) {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-rows: var(--topbar-height) 1fr;
        grid-template-areas: "brand topbar" "main main";
    }
    .shell-brand, .topbar, .sidenav { position: static; }
    .shell-brand { border-right: 0; }
    .topbar { padding: 0 var(--space-3); }
    .topbar-user, .topbar-actions a.btn-primary { display: none; }
    .topbar-account-menu, summary.topbar-account, .topbar-account span:first-child { min-width: 0; }
    .topbar-account span:first-child { overflow: hidden; text-overflow: ellipsis; }
    .topbar-actions { margin-left: auto; }
    .sidenav { height: auto; flex-direction: row; border-right: 0; border-bottom: 1px solid var(--color-border); padding: var(--space-2) var(--space-3); min-width: 0; } /* lets the list scroll instead of widening the page */
    .sidenav ul { flex-direction: row; overflow-x: auto; }
    :root[data-nav="rail"] .nav-label { position: static; width: auto; height: auto; clip: auto; }
    .sidenav button.nav-toggle { display: none; }
    .main { padding: var(--space-4) var(--space-4) var(--space-5); }
}

/* ---------- Page parts ---------- */

.page-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); min-height: 2.25rem; }
.page-header h1 { margin: 0; }
.muted, .text-secondary { color: var(--color-text-muted); }

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-4);
}
.card > :last-child { margin-bottom: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.stats .card { margin: 0; }
.stat-label { color: var(--color-text-muted); font-size: var(--text-sm); margin: 0 0 var(--space-1); }
.stat-value { font-size: var(--text-lg); font-weight: 600; margin: 0; overflow-wrap: anywhere; }

.badge {
    display: inline-block;
    padding: 0.05em 0.55em;
    border-radius: 999px;
    font-size: var(--text-xs);
    font-weight: 600;
    background: var(--color-surface-2);
    color: var(--color-text-muted);
}
.badge-ok { background: var(--color-success-soft); color: var(--color-success); }
.badge-bad { background: var(--color-danger-soft); color: var(--color-danger); }
.badge-warn { background: var(--color-warning-soft); color: var(--color-warning); }

/* Loading, empty and error states (Components/States). */
.state {
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    text-align: center;
    color: var(--color-text-muted);
    background: var(--color-surface);
}
.state-title { color: var(--color-text); font-weight: 600; margin-bottom: var(--space-2); }
.state > :last-child { margin-bottom: 0; }
.state-error { border-style: solid; border-color: var(--color-danger); background: var(--color-danger-soft); color: var(--color-text); }
.state-loading::before {
    content: "";
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-right: var(--space-2);
    vertical-align: -0.15em;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .state-loading::before { animation: none; } }

/* ---------- Tables (also QuickGrid, which renders table.quickgrid) ---------- */

/* Compact by default (console-ux §3.1). List tables clip instead of scrolling, so their header row
   can stick under the top bar; wide grids (.table-wrap.grid) and narrow screens scroll sideways. */
.table-wrap { position: relative; /* keeps visually hidden labels inside the frame */ overflow: clip; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); margin-bottom: var(--space-4); }
.table-wrap.grid { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th, td { text-align: left; padding: var(--table-cell-y) var(--table-cell-x); border-bottom: 1px solid var(--color-border); vertical-align: middle; }
th { color: var(--color-text-muted); font-weight: 600; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.03em; background: var(--color-surface-2); white-space: nowrap; }
.table-wrap:not(.grid) thead th { position: sticky; top: var(--topbar-height); z-index: 5; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.nowrap, .nowrap { white-space: nowrap; }
.truncate { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.shrink, th.shrink { width: 1%; white-space: nowrap; }
@media (max-width: 1024px) {
    .table-wrap { overflow-x: auto; }
    .table-wrap:not(.grid) thead th { position: static; }
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--color-surface-2); }
.quickgrid .col-title { gap: var(--space-2); }
.quickgrid button.col-title { color: inherit; font: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* ---------- Forms and buttons ---------- */

label, .form-label { display: block; font-weight: 500; font-size: var(--text-sm); margin-bottom: var(--space-1); }
.field { margin-bottom: var(--space-4); }
.actions select.run-pool { max-width: 14rem; }
.task-links { display: inline-flex; gap: var(--space-2); margin-left: var(--space-2); font-size: var(--text-sm); }
.log-tail { max-height: 16rem; overflow: auto; margin: var(--space-2) 0 0; padding: var(--space-2); font-size: var(--text-xs, 0.75rem); background: var(--color-surface-2, var(--color-surface)); border: 1px solid var(--color-border); border-radius: var(--radius-sm, 4px); white-space: pre-wrap; word-break: break-all; }
.job-inputs { border: 1px solid var(--color-border); border-radius: var(--radius-sm, 4px); padding: var(--space-3) var(--space-4); margin: 0 0 var(--space-4); }
.job-inputs legend { padding: 0 var(--space-1); font-weight: 600; }
.job-inputs .preview ul { margin: var(--space-1) 0 0; padding-left: var(--space-4); }
.job-inputs .preview code { overflow-wrap: anywhere; }
.download-group { display: inline-flex; align-items: center; gap: var(--space-1); }
.field .hint { display: block; margin-top: var(--space-1); font-size: var(--text-sm); color: var(--color-text-muted); }

input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea, .form-control {
    display: block;
    width: 100%;
    padding: var(--space-2) var(--space-3);
    font: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}
input:focus, select:focus, textarea:focus, .form-control:focus { outline: 2px solid var(--color-focus); outline-offset: 0; border-color: var(--color-focus); }
input[type=checkbox], .form-check-input { width: 1rem; height: 1rem; accent-color: var(--color-accent); vertical-align: -0.15em; margin-right: var(--space-2); }
textarea.code { font-family: var(--font-mono); font-size: var(--text-sm); line-height: 1.45; min-height: 28rem; resize: vertical; tab-size: 2; }

.btn, button[type=submit], button[type=button] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font: inherit;
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover, button[type=submit]:hover, button[type=button]:hover { background: var(--color-surface-2); text-decoration: none; }
.btn-primary, button.btn-primary {
    color: var(--color-accent-text);
    background: var(--color-accent);
    border-color: var(--color-accent);
}
.btn-primary:hover, button.btn-primary:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); }
.btn-danger, button.btn-danger { color: #fff; background: var(--color-danger); border-color: var(--color-danger); }
.btn-link, button.btn-link, button.link { background: none; border: 0; padding: 0; color: var(--color-accent); font-weight: 500; }
.btn-link:hover, button.btn-link:hover, button.link:hover { background: none; text-decoration: underline; }
.btn-lg { padding: var(--space-3) var(--space-5); font-size: var(--text-md); }
.btn-sm, a.btn-sm, button.btn-sm { padding: 0.125rem var(--space-3); font-size: var(--text-xs); }
button:disabled { opacity: 0.6; cursor: not-allowed; }
.actions { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }

.validation-message, .text-danger { color: var(--color-danger); font-size: var(--text-sm); }
.text-success { color: var(--color-success); }
.text-info { color: var(--color-accent); }
.valid.modified:not([type=checkbox]) { border-color: var(--color-success); }
.invalid { border-color: var(--color-danger) !important; }
ul.errors { margin: var(--space-3) 0; padding: var(--space-3) var(--space-3) var(--space-3) var(--space-6); background: var(--color-danger-soft); border-radius: var(--radius-md); color: var(--color-danger); font-size: var(--text-sm); }

/* ---------- Identity pages (scaffolded markup with Bootstrap-style class names) ---------- */

.row { display: flex; flex-wrap: wrap; gap: var(--space-6); }
.row > [class*="col-"] { flex: 1 1 22rem; max-width: 32rem; }
.col-md-12 { max-width: none !important; }
.form-floating { display: flex; flex-direction: column-reverse; margin-bottom: var(--space-4); }
.form-floating > .validation-message, .form-floating > .text-danger { order: -1; }
.form-floating > .form-control::placeholder { color: var(--color-text-muted); opacity: 0.6; }
.mb-3 { margin-bottom: var(--space-4); }
.mt-2 { margin-top: var(--space-2); }
.w-100 { width: 100%; }
.mx-auto { margin-left: auto; margin-right: auto; }
.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.checkbox label { display: flex; align-items: center; font-weight: 400; }
.alert { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); margin-bottom: var(--space-4); background: var(--color-info-soft); }
.alert-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.alert-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.alert-success { background: var(--color-success-soft); color: var(--color-success); }
.nav-pills { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.nav-pills .nav-link { display: block; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); color: var(--color-text-muted); }
.nav-pills .nav-link.active { background: var(--color-accent-soft); color: var(--color-accent); }
.input-group { display: flex; }
.input-group-text { padding: var(--space-2) var(--space-3); color: var(--color-success); }

/* ---------- Blazor ---------- */

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: var(--space-3) var(--space-5);
    background: var(--color-warning-soft);
    color: var(--color-text);
    box-shadow: 0 -1px 2px rgb(0 0 0 / 0.2);
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: var(--space-4); top: var(--space-3); }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.hero { padding: var(--space-8) var(--space-6); }
.hero h1 { font-size: 2.25rem; }
.hero p { max-width: 40rem; font-size: var(--text-lg); }
.card-title { margin-top: 0; }
.control-plane-status, .account-summary { margin: 0; }
.narrow { max-width: 28rem; }
.badge-run { background: var(--color-accent-soft); color: var(--color-accent); }
.run-now { margin-top: var(--space-4); scroll-margin-top: calc(var(--topbar-height) + var(--space-4)); }
.run-now textarea.code { min-height: 6rem; }

/* Dataset grid */
.toolbar { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-4); }
.toolbar input[type=search] { max-width: 20rem; }
.chip { display: inline-flex; gap: var(--space-2); align-items: center; padding: var(--space-1) var(--space-3); border-radius: 999px; background: var(--color-accent-soft); color: var(--color-accent); font-size: var(--text-sm); }
.chip a { font-weight: 700; }
.grid td { white-space: nowrap; max-width: 24rem; overflow: hidden; text-overflow: ellipsis; }
.col-detail { width: 2.5rem; }
.pager { margin-bottom: var(--space-5); }

/* List pager (CDPR-0051). */
.pager-bar { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: center; justify-content: space-between; margin: 0 0 var(--space-3); font-size: var(--text-sm); }
.pager-controls { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.pager-size { display: flex; gap: var(--space-2); align-items: center; margin: 0; font-weight: 400; color: var(--color-text-muted); }
.pager-size select { width: auto; padding: 0.125rem var(--space-2); font-size: var(--text-sm); }
.filters { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: flex-end; margin: 0 0 var(--space-3); }
.filters label { margin: 0; display: flex; flex-direction: column; gap: 2px; font-size: var(--text-xs); color: var(--color-text-muted); }
.filters input:not([type=checkbox]), .filters select { width: auto; min-width: 9rem; height: 2rem; padding: 0 var(--space-2); font-size: var(--text-sm); }
.filters label.check-row { flex-direction: row; align-items: center; gap: var(--space-2); height: 2rem; font-size: var(--text-sm); color: var(--color-text); }
.filters label.check-row input { margin: 0; }
.filters > .btn, .filters > button { height: 2rem; }
.filters input[type=search] { min-width: 16rem; }
@media (max-width: 720px) {
    .wide-only { display: none; }
    .filters input:not([type=checkbox]), .filters select { min-width: 0; width: 100%; }
    .filters label { flex: 1 1 calc(50% - var(--space-3)); }
    .filters label:has(input[type=search]) { flex-basis: 100%; }
    .pager-size-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.drawer { position: fixed; top: var(--topbar-height); right: 0; bottom: 0; width: min(28rem, 100vw); overflow-y: auto; z-index: 50; border-radius: 0; box-shadow: -4px 0 16px rgb(0 0 0 / 0.15); margin: 0; }
.props { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-4); font-size: var(--text-sm); margin: 0; }
.props dt { color: var(--color-text-muted); }
.props dd { margin: 0; overflow-wrap: anywhere; }

/* Column layout (CDPR-0050) */
.col-head { cursor: grab; overflow: hidden; text-overflow: ellipsis; padding: 2px 0; border-radius: var(--radius-sm); }
.col-head:hover { background: var(--color-surface-2); }
.grid .cell { overflow: hidden; text-overflow: ellipsis; }
.column-list { list-style: none; padding: 0; margin: 0 0 var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); }
.column-list li { display: grid; grid-template-columns: 1fr auto auto auto; gap: var(--space-2); align-items: center; }
.column-list select { width: auto; padding: var(--space-1) var(--space-2); font-size: var(--text-sm); }
.column-list .btn { padding: var(--space-1) var(--space-3); }
.column-visible { display: flex; align-items: center; margin: 0; font-weight: 400; }
.col-head { display: flex; align-items: center; gap: var(--space-1); }
.drag-handle { cursor: grab; color: var(--color-text-muted); opacity: 0.5; user-select: none; }
.col-head:hover .drag-handle { opacity: 1; }

/* Run screenshots (CDPR-0095): thumbnails and a full-size viewer. button.shot outranks the
   button[type=button] defaults. */
.shots { list-style: none; padding: 0; margin: 0 0 var(--space-5); display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-4); }
.shots li { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
button.shot { display: block; width: 100%; padding: 0; aspect-ratio: 4 / 3; overflow: hidden; background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-md); cursor: zoom-in; }
button.shot:hover { background: var(--color-surface-2); border-color: var(--color-accent); }
button.shot:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.shot img { width: 100%; height: 100%; object-fit: cover; object-position: top left; display: block; }
.shot-caption { font-size: var(--text-sm); color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); background: rgb(0 0 0 / 0.85); outline: none; }
.viewer-bar { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: space-between; align-items: center; color: #fff; }
.viewer-bar span:last-child { display: flex; gap: var(--space-2); }
.viewer img { flex: 1; min-height: 0; max-width: 100%; object-fit: contain; align-self: center; }

/* Run pages (CDPR-0054). */
.run-meta { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin: 0 0 var(--space-4); padding: 0; }
.run-meta div { display: flex; gap: var(--space-2); }
.run-meta dt { color: var(--color-text-muted); }
.run-meta dd { margin: 0; }
.task-url { display: inline-block; max-width: min(48rem, 45vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.task-error { min-width: 16rem; } /* the table scrolls on narrow screens instead of squeezing the message */
.task-error summary { cursor: pointer; color: var(--color-danger); }
.task-error dl { display: grid; grid-template-columns: auto 1fr; gap: var(--space-1) var(--space-3); margin: var(--space-2) 0 0; }
.task-error dt { color: var(--color-text-muted); }
.task-error dd { margin: 0; white-space: pre-wrap; overflow-wrap: break-word; }
.task-dialogs { min-width: 16rem; }
.task-dialogs summary { cursor: pointer; }
.task-dialogs ul { margin: var(--space-2) 0 0; padding-left: var(--space-4); overflow-wrap: break-word; }
.table-tools { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.runs-table td:first-child { min-width: 11rem; }
.runs-table td:not(:first-child) { white-space: nowrap; } /* narrow screens scroll the table instead of wrapping badges */

/* Dataset values (CDPR-0058). */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.flag-yes { color: var(--color-success); font-weight: 600; }
.flag-no { color: var(--color-text-muted); }

/* Settings (CDPR-0119). */
.settings-card { max-width: 44rem; }
.switch-row, .check-row { display: flex; gap: var(--space-3); align-items: flex-start; cursor: pointer; }
.switch-row input, .check-row input { margin-top: 0.3rem; width: 1.1rem; height: 1.1rem; flex: none; }
.switch-row > span { display: flex; flex-direction: column; gap: var(--space-1); }
.check-row { margin-bottom: var(--space-3); font-size: var(--text-sm); }

/* ---------- Density parts (CDPR-0140) ---------- */

.crumbs { display: flex; align-items: center; gap: var(--space-1); margin: 0 0 var(--space-1); font-size: var(--text-sm); color: var(--color-text-muted); min-width: 0; }
.crumbs .icon { width: 0.875rem; height: 0.875rem; }
.crumbs span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-sub { color: var(--color-text-muted); font-weight: 400; font-size: var(--text-sm); }
.badge-version { background: none; border: 1px solid var(--color-border); font-weight: 500; margin-left: var(--space-2); }
.name-cell { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.name-cell a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Progress: a thin bar with "n of m" next to it. */
.progress { display: inline-flex; align-items: center; gap: var(--space-2); white-space: nowrap; }
.progress-bar { width: 4.5rem; height: 0.375rem; border-radius: 999px; background: var(--color-surface-2); overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--color-success); }
.progress-bar > span.has-failed { background: var(--color-warning); }

/* Key figures as one strip instead of a wall of cards. */
.kpis { display: flex; flex-wrap: wrap; margin: 0 0 var(--space-4); padding: 0; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.kpis > div { flex: 1 1 8rem; padding: var(--space-2) var(--space-4); border-right: 1px solid var(--color-border); min-width: 0; }
.kpis > div:last-child { border-right: 0; }
.kpis dt { color: var(--color-text-muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.03em; }
.kpis dd { margin: 0; font-size: var(--text-md); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Jobs (CDPR-0052). */
.form-row { display: flex; flex-wrap: wrap; gap: 0 var(--space-4); }
.form-row > .field { flex: 1 1 14rem; }
.job-form textarea.code { min-height: 8rem; }
.btn-danger-outline, button.btn-danger-outline { color: var(--color-danger); border-color: var(--color-danger); background: var(--color-surface); }
.btn-danger-outline:hover, button.btn-danger-outline:hover { background: var(--color-danger-soft); }
.confirm-delete { max-width: var(--content-max-form); border-color: var(--color-danger); }
.url-list { margin: 0 0 var(--space-4); padding-left: var(--space-5); font-size: var(--text-sm); }
.url-list li { overflow-wrap: anywhere; }
.section-header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-5); }
.section-header h2 { margin: 0 0 var(--space-3); }
.check-row.inline { margin: 0; align-self: center; }
td .badge + time, td .badge + .badge { margin-left: var(--space-1); }

/* Dataset views and rejects (CDPR-0078). */
.tabs { display: flex; gap: var(--space-1); margin: 0 0 var(--space-3); border-bottom: 1px solid var(--color-border); }
.tabs a { padding: var(--space-2) var(--space-3); margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--color-text-muted); font-size: var(--text-sm); font-weight: 500; }
.tabs a:hover { color: var(--color-text); text-decoration: none; }
.tabs a.active { color: var(--color-accent); border-bottom-color: var(--color-accent); }
.raw-value { display: inline-block; max-width: 28rem; vertical-align: bottom; white-space: pre; }

/* Grid filters (CDPR-0059). */
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-3); padding: 0; }
.chips .chip { gap: var(--space-1); }
.chip-label, button.chip-label { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.chip-label:hover, button.chip-label:hover { background: none; text-decoration: underline; }
.chip-remove, button.chip-remove { background: none; border: 0; padding: 0 0.125rem; color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.chip-remove:hover, button.chip-remove:hover { background: none; }
.chip-error { background: var(--color-danger-soft); color: var(--color-danger); }
.chip-message { font-size: var(--text-xs); margin-left: var(--space-1); }
.grid-count { margin-left: auto; font-size: var(--text-sm); }
.filter-editor { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: flex-end; padding: var(--space-3); }
.filter-editor > label { display: flex; flex-direction: column; gap: 2px; margin: 0; font-size: var(--text-xs); color: var(--color-text-muted); }
.filter-editor input:not([type=checkbox]), .filter-editor select { width: auto; min-width: 10rem; height: 2rem; padding: 0 var(--space-2); font-size: var(--text-sm); }
.filter-editor .actions { margin-left: auto; }
.filter-values { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); border: 0; margin: 0; padding: 0; max-width: 40rem; }
.filter-values .check-row { margin: 0; }

/* Recipe editor (CDPR-0056): the text beside its problems and fields, stacked on narrow screens. */
.recipe-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem); gap: var(--space-5); align-items: start; }
.editor-main { min-width: 0; }
.editor-bar { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-1); }
.editor-tools { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.editor-side { display: flex; flex-direction: column; gap: var(--space-4); font-size: var(--text-sm); position: sticky; top: var(--space-4); }
.editor-side h3 { margin: 0 0 var(--space-2); font-size: var(--text-sm); }
.editor-side table { font-size: var(--text-sm); }
.editor-side .badge { margin-left: var(--space-1); }
.problem-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }
.problem-list li { padding: var(--space-2) var(--space-3); border-left: 3px solid var(--color-danger); background: var(--color-danger-soft); border-radius: var(--radius-sm); overflow-wrap: anywhere; }
.problem-list .btn-link { display: block; font-size: var(--text-xs); }
@media (max-width: 960px) {
    .recipe-editor { grid-template-columns: minmax(0, 1fr); }
    .editor-side { position: static; }
}

/* Run files (CDPR-0126). */
.file-hint { font-size: var(--text-xs); overflow-wrap: anywhere; }

/* Recipe lifecycle (CDPR-0055): inline rename, the More menu, past versions. */
.page-header h1 .icon-btn { vertical-align: middle; margin-left: var(--space-1); }
.page-header h1 .badge { vertical-align: middle; font-size: var(--text-xs); }
.rename { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); flex: 1 1 20rem; }
.rename input { flex: 1 1 14rem; font-size: var(--text-lg); }
.menu-panel button.menu-item.danger { color: var(--color-danger); }
.menu > summary.btn { cursor: pointer; }
tr.selected td { background: var(--color-accent-soft); }
.version-view { margin-top: var(--space-3); }
.version-view pre.code { margin: 0; max-height: 28rem; overflow: auto; padding: var(--space-3); background: var(--color-surface-2); border-radius: var(--radius-md); font-size: var(--text-sm); }
.run-version { margin: 0 0 var(--space-3); font-size: var(--text-sm); }

/* API health in the top bar (CDPR-0062): a dot, or a banner when the API is unreachable. */
.api-dot { flex: none; width: 0.6rem; height: 0.6rem; margin-left: auto; border-radius: 50%; background: var(--color-border); }
.api-dot.ok { background: var(--color-success); }
.api-dot.bad { background: var(--color-danger); }
.api-banner { flex: 1 1 auto; margin-left: auto; padding: var(--space-1) var(--space-3); border-radius: var(--radius-md); background: var(--color-danger-soft); color: var(--color-danger); font-size: var(--text-sm); }

/* Home (CDPR-0062): the first-run guide and the dashboard. */
.guide { list-style: none; margin: 0 0 var(--space-5); padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--space-3); }
.guide li { display: flex; flex-direction: column; gap: var(--space-2); }
.guide li.done { opacity: 0.75; }
.guide .step-title { margin: 0; font-weight: 600; display: flex; align-items: center; gap: var(--space-2); }
.guide .step-mark { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 1px solid var(--color-border); font-size: var(--text-xs); }
.guide li.done .step-mark { background: var(--color-success-soft); color: var(--color-success); border-color: var(--color-success); }
.guide p { margin: 0; }

/* Workers (CDPR-0063): the one-time enroll command, copyable and wrapping on narrow screens. */
.page-header h2 { margin: 0; }
.enroll-token { margin-bottom: var(--space-4); }
.copy-row { display: flex; gap: var(--space-2); align-items: flex-start; margin-bottom: var(--space-2); }
.copy-row code { flex: 1; min-width: 0; overflow-wrap: anywhere; padding: var(--space-2); }
[data-testid=confirm-revoke] .btn { margin-left: var(--space-2); }

/* Usage (CDPR-0061): one thin-bar chart per meter, in the accent colour; bars meet the baseline. */
.daily-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--space-4); margin-bottom: var(--space-3); }
.daily-bars { margin: 0; padding: var(--space-3) var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.daily-bars figcaption { display: flex; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-2); }
.daily-bars-title { color: var(--color-text-muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.03em; }
.daily-bars-total { font-weight: 600; font-variant-numeric: tabular-nums; }
.daily-bars-plot { display: flex; align-items: flex-end; gap: 2px; height: 6rem; border-bottom: 1px solid var(--color-border); }
.daily-bar { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; }
.daily-bar:hover { background: var(--color-surface-2); }
.daily-bar-fill { display: block; width: 100%; background: var(--color-accent); border-radius: 4px 4px 0 0; }
.daily-bars-axis { display: flex; justify-content: space-between; font-size: var(--text-xs); margin-top: var(--space-1); }
.daily-table { margin-bottom: var(--space-4); }
.daily-table summary { cursor: pointer; margin-bottom: var(--space-2); }
.proxy-card { margin-bottom: var(--space-4); }
.proxy-card p { margin: 0; }
.proxy-card .proxy-figure { font-size: var(--text-md); margin-bottom: var(--space-1); }
summary.topbar-account { display: flex; align-items: center; gap: var(--space-1); color: inherit; cursor: pointer; padding: var(--space-1) var(--space-2); border-radius: var(--radius-md); white-space: nowrap; }
summary.topbar-account:hover { background: var(--color-surface-2); }
.topbar-account-menu .menu-panel { left: 0; right: auto; }
.member-role { min-width: 8rem; }
/* Statistics (CDPR-0222): runs per day, stacked by how they ended. The status colours are reserved for this, and
   each is also named in the legend and the table: never colour alone. */
.status-bars { --stat-good: #0ca30c; --stat-warning: #fab219; --stat-critical: #d03b3b; --stat-neutral: #8a93a3;
    margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.status-bars figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-2); }
.status-bars-title { color: var(--color-text-muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.03em; }
.status-legend { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: 0; padding: 0; list-style: none; font-size: var(--text-xs); color: var(--color-text-muted); }
.status-legend li { display: inline-flex; align-items: center; gap: var(--space-1); }
.status-swatch { display: inline-block; width: 0.625rem; height: 0.625rem; border-radius: 2px; }
.status-bars-plot { display: flex; align-items: stretch; gap: 2px; height: 9rem; border-bottom: 1px solid var(--color-border); }
.status-bars-day { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column-reverse; justify-content: flex-start; align-items: center; gap: 2px; }
.status-bars-day:hover { background: var(--color-surface-2); }
.status-seg { display: block; width: 100%; max-width: 24px; min-height: 2px; }
.status-seg:last-child { border-radius: 4px 4px 0 0; }
.status-seg:hover, .status-seg:focus-visible { filter: brightness(1.15); outline: 2px solid var(--color-text-muted); outline-offset: 1px; }
.seg-succeeded { background: var(--stat-good); }
.seg-with-errors { background: var(--stat-warning); }
.seg-failed { background: var(--stat-critical); }
.seg-stopped { background: var(--stat-neutral); }
.stats-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }
.invite-form fieldset { border: 0; padding: 0; margin: 0 0 var(--space-3); }
.invite-form legend { padding: 0; margin-bottom: var(--space-1); }
.invite-form .checkbox { display: block; margin-bottom: var(--space-1); }
.invite-form h2 { margin-top: 0; }
.invite-form [data-testid=invite-link-note] { margin: var(--space-3) 0 var(--space-2); }

/* Stored pictures (CDPR-0142): a thumbnail in the row height in the grid, larger in row details. */
.cell-picture { display: inline-block; line-height: 0; }
.cell-picture img { height: 1.75rem; width: auto; max-width: 3.5rem; object-fit: cover; border-radius: var(--radius-sm); background: var(--color-surface-2); vertical-align: middle; }
.props .cell-picture img { height: auto; max-height: 160px; max-width: 160px; }

/* Recipe test (CDPR-0057): one URL and the draft's result under the editor. */
.recipe-test { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-3); }
.recipe-test input { flex: 1 1 16rem; min-width: 0; }
.recipe-preview { margin-top: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); }
.recipe-preview .preview-head { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.recipe-preview .preview-head h3 { margin: 0; }
.recipe-preview .preview-head a { margin-left: auto; }
.recipe-preview h4 { margin: var(--space-3) 0 var(--space-2); }
.preview-shot img { max-width: 100%; max-height: 240px; border: 1px solid var(--color-border); border-radius: var(--radius-md); }

/* Task logs (CDPR-0130): one line per entry, the source and step as quiet labels, warnings and errors coloured. */
.task-logs { margin-top: var(--space-2); }
.log-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); font-size: var(--text-sm); }
.log-tools input[type=search] { flex: 1 1 10rem; min-width: 0; }
.log-lines { list-style: none; margin: 0; padding: var(--space-2); max-height: 24rem; overflow: auto; background: var(--color-surface-2); border-radius: var(--radius-md); font-family: var(--font-mono); font-size: var(--text-xs); }
.log-line { display: flex; flex-wrap: wrap; column-gap: var(--space-2); align-items: baseline; padding: 1px 0; }
.log-line time { color: var(--color-text-muted); flex: none; }
.log-source, .log-step { flex: none; color: var(--color-text-muted); }
.log-source { min-width: 7.5em; }
.log-message { flex: 1 1 16rem; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.log-line.level-warn .log-message { color: var(--color-warning); }
.log-line.level-error .log-message { color: var(--color-danger); }

/* Robot import (CDPR-0117): the file picker under the template choice, and the report above the editor. */
.import-robot { margin: var(--space-3) 0; }
.import-report { margin: var(--space-4) 0; }
.import-report h2 { margin: 0 0 var(--space-2); }
.import-report td:nth-child(3) { overflow-wrap: anywhere; }

/* Admin Limits (CDPR-0106): forms with their values side by side, a required reason, the history. */
.admin-form { margin: var(--space-3) 0; }
.admin-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: var(--space-3); margin-bottom: var(--space-3); }
.admin-fields label, .admin-reason { display: flex; flex-direction: column; gap: var(--space-1); }
.admin-reason { margin-bottom: var(--space-3); }
.admin-form textarea.code { min-height: 6rem; }
.change-history ol { list-style: none; padding: 0; margin: 0; }
.change-history li { padding: var(--space-1) 0; border-bottom: 1px solid var(--color-border); display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: baseline; }
.change-history code { overflow-wrap: anywhere; }
.plain-list { list-style: none; padding: 0; }

/* Proxies (CDPR-0103): the account's own proxies on Settings, and the form to add one. */
.proxy-form-title { font-size: var(--text-md); margin: var(--space-4) 0 var(--space-2); }
.proxy-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: var(--space-3); align-items: end; }
.proxy-form-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }

/* Job schedules (CDPR-0161): the triggers table, its history rows and the form with a live preview. */
.job-schedules { margin: var(--space-4) 0; }
.job-schedules td.actions { white-space: nowrap; text-align: right; }
.schedule-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: var(--space-3); align-items: end; margin-top: var(--space-3); }
.schedule-form .check-row, .schedule-preview, .schedule-actions { grid-column: 1 / -1; }
.schedule-actions { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }

/* Input dataset (CDPR-0152): the dataset, its rows choice and the parameter mapping on the job form. */
.input-dataset { margin-bottom: var(--space-3); }
.input-dataset code { overflow-wrap: anywhere; white-space: normal; }
.input-dataset .form-row { flex-wrap: wrap; }
/* Plain datasets (CDPR-0153) */
.form-stack { display: flex; flex-direction: column; gap: var(--space-3); max-width: var(--content-max-form); }
.form-stack fieldset { border: 0; padding: 0; margin: 0; }
.plain-upload { display: flex; flex-direction: column; gap: var(--space-2); }
.plain-upload textarea { width: 100%; font-family: var(--font-mono); }
.tabs-inline { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.plain-fields input:not([type=checkbox]), .plain-fields select { width: 100%; min-width: 7rem; }
.plain-fields td { vertical-align: middle; }
.sample summary, .plain-import-list summary { cursor: pointer; }
.plain-import-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.plain-import-list li { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: baseline; }
.plain-import-list details { flex-basis: 100%; }
.plain-row-form { display: flex; flex-direction: column; gap: var(--space-2); }
.column-label { min-width: 0; flex: 1; }
/* Dataset history (CDPR-0162) */
.dataset-history { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); font-size: var(--text-sm); }
.dataset-history label { margin: 0; font-weight: 600; }
.dataset-history select { width: auto; height: 2rem; padding: 0 var(--space-2); }
.dataset-history input[type=number] { width: 4.5rem; height: 2rem; }
/* Dataset changes (CDPR-0176) */
td.change-field { background: var(--color-warn-soft, rgba(255, 196, 0, 0.15)); font-weight: 600; }
/* Worker downloads (CDPR-0201) */
code.checksum { overflow-wrap: anywhere; font-size: var(--text-xs, 0.75rem); }
/* Saved views (CDPR-0170) */
.view-bar { margin-bottom: var(--space-3); }
.view-bar-main { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.view-bar-main label { margin: 0; font-weight: 600; }
.view-bar-main select { width: auto; min-width: 12rem; max-width: 100%; height: 2.25rem; padding: 0 var(--space-2); }
.view-more { position: relative; }
.view-more > summary { list-style: none; }
.view-more > summary::-webkit-details-marker { display: none; }
.view-menu { position: absolute; z-index: 20; top: calc(100% + var(--space-1)); right: 0; display: flex; flex-direction: column; gap: var(--space-1);
    min-width: 14rem; padding: var(--space-2); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.view-menu .btn { width: 100%; text-align: left; }
.view-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2) var(--space-4); margin-top: var(--space-2); }
.view-form .field { flex: 1 1 14rem; max-width: 24rem; }
@media (max-width: 40rem) {
    .view-bar-main select { flex: 1 1 100%; min-width: 0; }
    .view-menu { right: auto; left: 0; }
}

/* The job page's optional cap for one run, beside its Run now (CDPR-0053). As specific as the base input rule, and after it. */
.page-header .actions input.run-parallel { width: 9rem; flex: none; }

/* CDPR-0209: a name, a value and its remove button on one line, stacked when narrow. */
.header-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.header-row input {
    flex: 1 1 12rem;
    min-width: 0;
}

/* Where a run's limit came from (CDPR-0267). */
.limit-from {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
}

