:root {
    color-scheme: light;
    --bg: #f5f7fa;
    --surface: #ffffff;
    --text: #18202a;
    --muted: #657386;
    --line: #d8e0ea;
    --brand: #1664d9;
    --brand-dark: #0f4ea8;
    --success-bg: #dff5e7;
    --success-text: #12643e;
    --danger-bg: #fff0f0;
    --danger-text: #9a1c1c;
    --warning-bg: #fff4d8;
    --warning-text: #785100;
    --info-bg: #dceff3;
    --info-text: #245a66;
    --neutral-bg: #eef2f6;
    --neutral-text: #536173;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    letter-spacing: 0;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.topbar__inner,
.page {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 86px;
    gap: 20px;
}

h1,
h2 {
    margin: 0;
    font-weight: 700;
}

h1 {
    font-size: 24px;
}

h2 {
    font-size: 22px;
}

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

nav a {
    font-weight: 700;
}

.page {
    padding: 28px 0;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
}

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

.eyebrow {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.count {
    color: var(--muted);
    white-space: nowrap;
}

.search {
    margin-bottom: 22px;
}

.search label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-weight: 700;
}

.search__row {
    display: flex;
    gap: 10px;
}

input[type="search"] {
    min-width: 0;
    flex: 1;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
    font: inherit;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid var(--brand);
    border-radius: 6px;
    padding: 0 16px;
    background: var(--brand);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

button:hover,
.button:hover {
    background: var(--brand-dark);
}

.button--ghost {
    background: #ffffff;
    color: var(--brand);
}

.button--ghost:hover {
    background: #eef5ff;
}

.button--danger {
    border-color: #b42318;
    background: #b42318;
}

.button--danger:hover {
    background: #8f1d15;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

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

th {
    background: #f0f4f8;
    color: var(--muted);
    font-size: 13px;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.status,
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 0 10px;
    background: var(--success-bg);
    color: var(--success-text);
    font-size: 13px;
    font-weight: 700;
}

.badge--success {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge--danger {
    background: #ffd9d6;
    color: var(--danger-text);
}

.badge--warning {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.badge--info {
    background: var(--info-bg);
    color: var(--info-text);
}

.badge--neutral {
    background: var(--neutral-bg);
    color: var(--neutral-text);
}

.alert,
.notice,
.empty {
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.alert {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.empty {
    background: #f0f4f8;
    color: var(--muted);
}

.notice {
    background: #eaf4ff;
    color: #134d86;
}

.button--small {
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
    white-space: nowrap;
}

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

.summary-grid--compact {
    margin-top: 14px;
}

.summary-grid > div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.label {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.logs,
.section-block {
    margin-top: 24px;
}

.action-bar {
    display: flex;
    justify-content: flex-end;
    margin: -6px 0 18px;
}

.logs h3,
.section-block h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
    font-size: 18px;
}

.step-card {
    margin-top: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    background: #ffffff;
}

.step-card__header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 14px;
}

.step-card__header h3 {
    margin: 0;
    font-size: 19px;
}

.step-card__header p {
    margin: 4px 0 0;
    color: var(--muted);
}

.step-card__number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    border-radius: 999px;
    padding: 0 11px;
    background: var(--brand);
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.collapse {
    margin-top: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.collapse summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 58px;
    padding: 14px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    list-style: none;
}

.collapse summary::-webkit-details-marker {
    display: none;
}

.collapse summary::after {
    content: "+";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--neutral-bg);
    color: var(--neutral-text);
    font-weight: 800;
}

.collapse[open] summary::after {
    content: "-";
}

.collapse > :not(summary) {
    margin: 0 14px 14px;
}

.collapse--logs summary .button {
    margin-left: auto;
}

.collapse--logs[open] summary .button {
    color: var(--brand);
}

.section-heading {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
}

.section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-right: 8px;
    border-radius: 8px;
    background: #eaf4ff;
    color: var(--brand);
    font-size: 11px;
    font-weight: 800;
    vertical-align: middle;
}

.section-count {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 0 10px;
    background: var(--neutral-bg);
    color: var(--neutral-text);
    font-size: 13px;
    font-weight: 700;
}

.timeline {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 20px;
}

.plain-list {
    margin: 10px 0 0;
    padding-left: 20px;
}

.timeline li {
    padding-left: 4px;
}

.timeline span,
.timeline small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.timeline code {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin-top: 6px;
    overflow-wrap: anywhere;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 8px;
    background: #f7fafc;
    color: #26313f;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
}

.payload-preview {
    max-height: 420px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #f7fafc;
    color: #26313f;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.progress-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    background: rgba(24, 32, 42, 0.38);
}

.progress-overlay[hidden] {
    display: none;
}

.progress-modal {
    width: min(420px, calc(100% - 32px));
    border-radius: 8px;
    padding: 22px;
    background: #ffffff;
    box-shadow: 0 18px 45px rgba(24, 32, 42, 0.2);
}

.progress-modal h2 {
    margin-bottom: 16px;
    font-size: 20px;
}

.progress-modal ol {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 22px;
}

.progress-modal li {
    position: relative;
    color: var(--muted);
}

.progress-modal li::marker {
    color: var(--muted);
}

.progress-modal li.is-active {
    color: var(--brand);
    font-weight: 700;
}

.progress-modal li.is-done {
    color: var(--success-text);
    font-weight: 700;
}

.progress-modal li.is-done::after {
    content: "OK";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 18px;
    margin-left: 8px;
    border-radius: 999px;
    background: var(--success-bg);
    color: var(--success-text);
    font-size: 11px;
    font-weight: 800;
}

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

@media (max-width: 680px) {
    .topbar__inner,
    .panel__header,
    .search__row {
        align-items: stretch;
        flex-direction: column;
    }

    .count {
        white-space: normal;
    }

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