:root {
    color-scheme: light;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

* {
    box-sizing: border-box;
}

body {
    background: #f5f7fb;
    color: #172033;
    margin: 0;
}

header {
    align-items: center;
    background: #172033;
    color: #fff;
    display: flex;
    justify-content: space-between;
    padding: 16px 24px;
}

header h1 {
    font-size: 20px;
    margin: 0;
}

nav {
    align-items: center;
    display: flex;
    gap: 16px;
}

a {
    color: #2457d6;
}

header a {
    color: #fff;
}

.centered {
    align-items: center;
    display: flex;
    min-height: 100vh;
    justify-content: center;
}

.grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    padding: 24px;
}

.card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(23, 32, 51, .08);
    padding: 20px;
}

.wide {
    grid-column: 1 / -1;
}

.narrow {
    max-width: 420px;
    width: 100%;
}

form {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 600;
}

input,
select,
textarea,
button {
    border: 1px solid #cfd6e4;
    border-radius: 10px;
    font: inherit;
    padding: 10px 12px;
    max-width: 100%;
    min-width: 0;
    width: 100%;
}

button {
    background: #2457d6;
    border: 0;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}

.button-link {
    background: #2457d6;
    border-radius: 10px;
    color: #fff;
    display: inline-flex;
    font-weight: 700;
    padding: 10px 14px;
    text-decoration: none;
}

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

th,
td {
    border-bottom: 1px solid #e4e8f0;
    padding: 10px;
    text-align: left;
}

.inline {
    display: inline;
}

.error {
    color: #b42318;
}

.success {
    color: #067647;
}

.muted {
    color: #667085;
    font-size: 14px;
}

.qa {
    border-top: 1px solid #e4e8f0;
    padding: 12px 0;
}

.stages {
    display: grid;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

.stage {
    display: grid;
    gap: 14px;
    grid-template-columns: 28px minmax(0, 1fr);
    min-height: 72px;
    min-width: 0;
    padding: 0 0 18px;
    position: relative;
}

.stage::before {
    background: #e4e8f0;
    bottom: 0;
    content: "";
    left: 13px;
    position: absolute;
    top: 28px;
    width: 2px;
}

.stage:last-child {
    padding-bottom: 0;
}

.stage:last-child::before {
    display: none;
}

.stage-marker {
    background: #98a2b3;
    border: 4px solid #fff;
    border-radius: 999px;
    box-shadow: 0 0 0 2px #e4e8f0;
    height: 28px;
    position: relative;
    width: 28px;
    z-index: 1;
}

.stage-content {
    background: #fff;
    border: 1px solid #e4e8f0;
    border-radius: 12px;
    min-width: 0;
    padding: 14px 16px;
}

.stage-topline {
    align-items: flex-start;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.stage-topline span {
    background: #eef2f6;
    border-radius: 999px;
    color: #344054;
    flex: 0 0 auto;
    font-size: 12px;
    padding: 2px 8px;
}

.stage.completed .stage-marker {
    background: #12b76a;
    box-shadow: 0 0 0 2px #a6f4c5;
}

.stage.running .stage-marker {
    background: #f79009;
    box-shadow: 0 0 0 2px #fedf89;
}

.stage.failed .stage-marker {
    background: #f04438;
    box-shadow: 0 0 0 2px #fecdca;
}

.stage.failed .stage-content {
    border-color: #fecdca;
}

.stage-details {
    margin-top: 10px;
}

.stage-details summary {
    color: #2457d6;
    cursor: pointer;
    font-weight: 700;
}

.stage-details p {
    background: #f8fafc;
    border-radius: 10px;
    margin-top: 10px;
    max-height: 260px;
    overflow: auto;
    padding: 12px;
}

pre {
    background: #f8fafc;
    border: 1px solid #e4e8f0;
    border-radius: 10px;
    overflow: auto;
    padding: 12px;
    white-space: pre-wrap;
}

.agent-page {
    align-items: start;
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
    margin: 0 auto;
    max-width: 1480px;
    padding: 32px;
}

.agent-form-card {
    align-self: start;
}

.agent-stages-card {
    min-width: 0;
}

.section-heading {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.section-heading h2,
.section-heading p {
    margin: 0;
}

.summary-card,
.table-card {
    grid-column: 1 / -1;
}

.summary-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin: 16px 0 20px;
}

.summary-grid > div {
    background: #f8fafc;
    border: 1px solid #e4e8f0;
    border-radius: 12px;
    padding: 14px;
}

.summary-label {
    color: #667085;
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
}

.stage strong,
.stage p {
    overflow-wrap: anywhere;
}

.stage p {
    margin-bottom: 0;
}

@media (max-width: 980px) {
    header,
    nav {
        align-items: flex-start;
        flex-direction: column;
    }

    .agent-page {
        grid-template-columns: 1fr;
        padding: 20px;
    }

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