:root {
    color-scheme: light;
    font-family: "Segoe UI", Arial, sans-serif;
    color: #18263a;
    background: #eef2f7;
    font-synthesis: none;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    margin: 0;
    background:
        radial-gradient(ellipse at top left, rgba(54, 112, 177, 0.12), transparent 36rem),
        #eef2f7;
}

.topology-shell {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 36px 0 28px;
}

.page-header,
.card-heading,
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.page-header {
    margin-bottom: 26px;
}

.eyebrow {
    margin: 0 0 6px;
    color: #61738a;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 7px;
    font-size: clamp(26px, 4vw, 36px);
    letter-spacing: -0.035em;
}

h2 {
    margin-bottom: 0;
    font-size: 21px;
    letter-spacing: -0.02em;
}

.page-subtitle {
    margin-bottom: 0;
    color: #64748b;
}

.refresh-indicator {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
    color: #50627a;
    font-size: 13px;
}

.refresh-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #94a3b8;
}

.refresh-indicator.is-current .refresh-dot {
    background: #16a36a;
    box-shadow: 0 0 0 4px rgba(22, 163, 106, 0.12);
}

.refresh-indicator.is-error .refresh-dot {
    background: #dc4b4b;
}

.master-card,
.client-card {
    border: 1px solid #dce4ee;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 30px rgba(37, 57, 82, 0.06);
}

.master-card {
    position: relative;
    padding: 25px 28px 26px;
    border-top: 4px solid #3578bd;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.master-card:hover {
    border-top-color: #1d65a8;
    box-shadow: 0 14px 34px rgba(37, 57, 82, 0.11);
    transform: translateY(-1px);
}

.master-run-timer {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
    padding: 7px 12px;
    border: 1px solid #dce7f2;
    border-radius: 9px;
    background: #f5f9fd;
    cursor: default;
}

.master-run-timer-copy {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.master-run-timer-label {
    color: #61738a;
    font-size: 11px;
    font-weight: 700;
}

.master-run-timer-copy strong {
    color: #18395b;
    font-size: 18px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
}

.master-run-timer-state {
    color: #718096;
    font-size: 11px;
    font-weight: 700;
}

.master-run-timer-state.is-running {
    color: #12734c;
}

.master-run-timer-state.is-waiting {
    color: #9a5b07;
}

.master-run-timer-state.is-complete {
    color: #52647a;
}

.master-card:focus-visible {
    outline: 3px solid rgba(53, 120, 189, 0.45);
    outline-offset: 3px;
}

.master-card-hint {
    margin: 16px 0 0;
    color: #718096;
    font-size: 11px;
    text-align: right;
}

.master-card::after {
    position: absolute;
    bottom: -27px;
    left: 50%;
    width: 2px;
    height: 27px;
    background: #bfccda;
    content: "";
}

.status-pill,
.client-count,
.job-state {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 11px;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.status-pill.is-enabled {
    color: #12734c;
    background: #e5f6ee;
}

.status-pill.is-paused {
    color: #9a5b07;
    background: #fff2d6;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 23px;
}

.metric {
    min-height: 75px;
    padding: 14px 15px;
    border: 1px solid #e8edf3;
    border-radius: 11px;
    background: #f8fafc;
}

.metric-value {
    display: block;
    margin-bottom: 4px;
    font-size: 24px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.metric-label {
    color: #64748b;
    font-size: 12px;
}

.metric.is-failed .metric-value {
    color: #a62b2b;
}

.queue-progress {
    display: grid;
    gap: 8px;
    margin-top: 17px;
}

.queue-progress-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    color: #64748b;
    font-size: 12px;
}

.queue-progress-heading strong {
    color: #26374d;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.queue-progress progress {
    display: block;
    width: 100%;
    height: 12px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: #e2eaf2;
    accent-color: #16a36a;
}

.queue-progress progress::-webkit-progress-bar {
    border-radius: 999px;
    background: #e2eaf2;
}

.queue-progress progress::-webkit-progress-value {
    border-radius: 999px;
    background: linear-gradient(90deg, #2b9b68, #16a36a);
    transition: width 0.35s ease;
}

.queue-progress progress::-moz-progress-bar {
    border-radius: 999px;
    background: linear-gradient(90deg, #2b9b68, #16a36a);
}

.client-section {
    position: relative;
    padding-top: 54px;
}

.section-heading {
    margin-bottom: 17px;
}

.client-count {
    color: #52647a;
    background: #e1e9f2;
}

.client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
    gap: 16px;
}

.client-card {
    min-width: 0;
    padding: 19px 20px;
    border-top: 3px solid #c5d0dd;
}

.client-card.has-running {
    border-top-color: #16a36a;
}

.client-card.has-failed {
    border-top-color: #dc4b4b;
}

.client-card.has-takeover {
    border-top-color: #d28b16;
}

.client-card.is-offline {
    border-top-color: #dc4b4b;
}

.client-connectivity {
    margin: 10px 0;
    color: #64748b;
    font-size: 12px;
}

.client-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.client-status-group {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex: 0 0 auto;
}

.server-role-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 8px;
    color: #245d91;
    background: #e5f0fb;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.client-title {
    overflow-wrap: anywhere;
    font-size: 17px;
    font-weight: 800;
}

.client-acceptance {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    margin: 5px 0 16px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 700;
}

.client-acceptance.is-enabled {
    color: #12734c;
    background: #e5f6ee;
}

.client-acceptance.is-paused {
    color: #a62b2b;
    background: #fdeaea;
}

.client-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.client-metric {
    color: #54677f;
    font-size: 12px;
}

.client-metric strong {
    color: #1d2d42;
    font-variant-numeric: tabular-nums;
}

.job-list {
    display: grid;
    gap: 9px;
    padding-top: 12px;
    border-top: 1px solid #e9eef4;
}

.job-row {
    min-width: 0;
}

.job-row-button {
    display: block;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: inherit;
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.job-row-button:hover {
    border-color: #dce6f0;
    background: #f8fafc;
}

.job-row-button:focus-visible,
.job-dialog-close:focus-visible {
    outline: 3px solid rgba(53, 120, 189, 0.45);
    outline-offset: 2px;
}

.job-row-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.job-row-state-group {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    flex: 0 0 auto;
}

.job-description {
    overflow: hidden;
    color: #26374d;
    font-size: 12px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.job-state {
    padding: 3px 8px;
    color: #52647a;
    background: #edf2f7;
    font-size: 10px;
}

.job-state.is-running {
    color: #11734b;
    background: #e5f6ee;
}

.job-state.is-failed {
    color: #a62b2b;
    background: #fdeaea;
}

.takeover-badge {
    display: inline-flex;
    align-items: center;
    max-width: 180px;
    overflow: hidden;
    border-radius: 999px;
    padding: 3px 8px;
    color: #85530b;
    background: #fff1d5;
    font-size: 10px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.takeover-notice {
    margin: 8px 0 0;
    padding: 8px 10px;
    border-left: 3px solid #d28b16;
    border-radius: 0 7px 7px 0;
    color: #75500f;
    background: #fff8e9;
    font-size: 11px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.job-detail {
    margin: 4px 0 0;
    color: #7a899b;
    font-size: 11px;
    line-height: 1.5;
}

.job-progress {
    display: grid;
    gap: 5px;
    margin-top: 8px;
}

.job-progress-label {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: #64748b;
    font-size: 11px;
}

.job-progress-label strong {
    color: #33465e;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.job-progress progress {
    display: block;
    width: 100%;
    height: 7px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: #e7edf4;
    accent-color: #16a36a;
}

.job-progress progress::-webkit-progress-bar {
    border-radius: 999px;
    background: #e7edf4;
}

.job-progress progress::-webkit-progress-value {
    border-radius: 999px;
    background: #16a36a;
}

.job-progress progress::-moz-progress-bar {
    border-radius: 999px;
    background: #16a36a;
}

.job-failure {
    margin: 7px 0 0;
    padding: 8px 10px;
    border-radius: 7px;
    color: #932e2e;
    background: #fff1f1;
    font-size: 11px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.job-dialog {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(540px, 100%);
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    margin: 0;
    padding: 26px;
    border: 0;
    border-left: 1px solid #dce4ee;
    color: #18263a;
    background: #fff;
    box-shadow: -18px 0 55px rgba(24, 38, 58, 0.18);
    overflow: auto;
}

.job-dialog::backdrop {
    background: rgba(16, 35, 62, 0.42);
    backdrop-filter: blur(2px);
}

.job-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e7edf4;
}

.job-dialog-header h2 {
    overflow-wrap: anywhere;
}

.job-dialog-close {
    display: inline-grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid #dce4ee;
    border-radius: 10px;
    color: #3d4d62;
    background: #f8fafc;
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
}

.job-dialog-content {
    padding-top: 18px;
}

.job-detail-list {
    display: grid;
    gap: 0;
    margin: 0;
}

.job-detail-row {
    display: grid;
    grid-template-columns: minmax(125px, 0.7fr) minmax(0, 1.3fr);
    gap: 14px;
    padding: 11px 0;
    border-bottom: 1px solid #edf1f5;
}

.job-detail-row dt {
    color: #718096;
    font-size: 12px;
}

.job-detail-row dd {
    min-width: 0;
    margin: 0;
    color: #26374d;
    font-size: 13px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.job-dialog-failure {
    margin: 18px 0 0;
    padding: 12px;
    border-radius: 9px;
    color: #932e2e;
    background: #fff1f1;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.job-dialog-section {
    margin-top: 24px;
}

.summary-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 21px;
}

.summary-metrics > div {
    display: grid;
    gap: 3px;
    padding: 12px;
    border: 1px solid #e8edf3;
    border-radius: 9px;
    background: #f8fafc;
}

.summary-metrics strong {
    font-size: 20px;
    font-variant-numeric: tabular-nums;
}

.summary-metrics span {
    color: #64748b;
    font-size: 11px;
}

.client-summary-list {
    display: grid;
    gap: 10px;
}

.client-summary-row {
    min-width: 0;
    padding: 13px 14px;
    border: 1px solid #e3eaf2;
    border-radius: 10px;
}

.client-summary-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.client-summary-heading h3 {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 14px;
}

.client-summary-acceptance,
.client-summary-activity {
    margin: 7px 0 0;
    color: #5f7086;
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.client-summary-row.has-takeover {
    border-color: #ecd8ae;
    background: #fffdf8;
}

.client-summary-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 9px;
    color: #75849a;
    font-size: 11px;
}

.summary-note {
    margin: 18px 0 0;
    color: #718096;
    font-size: 11px;
    line-height: 1.5;
}

.job-dialog-section h3 {
    margin: 0 0 12px;
    font-size: 15px;
}

.job-timeline {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.timeline-step {
    display: grid;
    gap: 3px;
    padding: 10px 0 10px 14px;
    border-left: 2px solid #dce6f0;
}

.timeline-step-label {
    color: #33465e;
    font-size: 12px;
    font-weight: 700;
}

.timeline-step-detail {
    color: #718096;
    font-size: 11px;
    overflow-wrap: anywhere;
}

.empty-jobs {
    margin: 0;
    color: #75849a;
    font-size: 13px;
}

.error-banner {
    margin: 20px 0 0;
    padding: 12px 15px;
    border: 1px solid #f1baba;
    border-radius: 10px;
    color: #962e2e;
    background: #fff0f0;
    font-size: 13px;
}

.page-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
    color: #718096;
    font-size: 11px;
}

@media (max-width: 980px) {
    .metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .topology-shell {
        width: min(100% - 24px, 1180px);
        padding-top: 22px;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .master-card {
        padding: 20px 17px;
    }

    .master-run-timer {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
        margin-left: 0;
    }

    .card-heading {
        flex-wrap: wrap;
    }

    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .page-footer {
        flex-direction: column;
    }

    .job-dialog {
        inset: auto 0 0;
        width: 100%;
        height: min(85vh, 760px);
        border-top: 1px solid #dce4ee;
        border-left: 0;
        border-radius: 18px 18px 0 0;
        padding: 21px 18px;
    }
}
