:root {
    --bg: #f7f8fa;
    --surface: #ffffff;
    --surface-2: #f1f4f7;
    --text: #17202a;
    --muted: #627182;
    --line: #d9e0e8;
    --accent: #1476d4;
    --accent-2: #0f5fa8;
    --good: #147a4a;
    --bad: #b42318;
    --shadow: 0 18px 45px rgba(20, 35, 50, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--text);
    font-family: "Segoe UI", Arial, sans-serif;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
}

.shell {
    min-height: 100vh;
    padding: 28px;
}

.workspace {
    max-width: 1360px;
    margin: 0 auto;
}

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

.topbar h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.15;
    font-weight: 700;
}

.topbar p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.swagger-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    background: var(--surface);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.control-panel,
.status-strip,
.table-panel,
.detail-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.control-panel {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 120px 120px auto;
    gap: 14px;
    align-items: end;
    padding: 18px;
}

.field {
    display: grid;
    gap: 7px;
}

.field span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.field input {
    width: 100%;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
    color: var(--text);
    background: #fff;
    outline: none;
}

.field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(20, 118, 212, 0.12);
}

.button-row {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.button-row button {
    height: 42px;
    min-width: 92px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 14px;
    color: var(--text);
    background: #fff;
    cursor: pointer;
    font-weight: 700;
}

.button-row button:hover {
    background: var(--surface-2);
}

.button-row .primary {
    border-color: var(--accent);
    color: #fff;
    background: var(--accent);
}

.button-row .primary:hover {
    background: var(--accent-2);
}

.button-row button:disabled {
    cursor: wait;
    opacity: 0.68;
}

.status-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    margin: 16px 0;
    background: var(--line);
}

.status-strip div {
    min-width: 0;
    padding: 16px;
    background: var(--surface);
}

.status-strip span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.status-strip strong {
    display: block;
    overflow: hidden;
    margin-top: 6px;
    font-size: 15px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
    gap: 16px;
    align-items: start;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
}

.panel-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.panel-head span {
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-list {
    display: grid;
}

.result-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 76px 90px 78px;
    gap: 12px;
    align-items: center;
    width: 100%;
    min-height: 66px;
    border: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 16px;
    color: var(--text);
    background: #fff;
    text-align: left;
    cursor: pointer;
}

.result-row:last-child {
    border-bottom: 0;
}

.result-row:hover,
.result-row.selected {
    background: #f5f9fd;
}

.endpoint-name {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.endpoint-title {
    overflow: hidden;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.endpoint-slug {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.endpoint-version,
.endpoint-count,
.endpoint-status {
    color: var(--muted);
    font-size: 13px;
}

.endpoint-status.ok {
    color: var(--good);
    font-weight: 700;
}

.endpoint-status.error {
    color: var(--bad);
    font-weight: 700;
}

.detail-panel {
    position: sticky;
    top: 18px;
    overflow: hidden;
}

.api-detail-summary {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
    background: #fbfcfd;
}

.sample-url-list {
    display: grid;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.sample-url-row {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.sample-url-row span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.sample-url-row a {
    display: block;
    color: var(--accent);
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.35;
    text-decoration: none;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.sample-url-row a:hover {
    text-decoration: underline;
}

.field-list {
    max-height: 260px;
    overflow: auto;
    border-bottom: 1px solid var(--line);
}

.field-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    line-height: 1.35;
}

.field-table th,
.field-table td {
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
}

.field-table th {
    position: sticky;
    top: 0;
    color: var(--muted);
    background: var(--surface-2);
    font-weight: 700;
}

.field-table td:first-child {
    width: 34%;
    color: var(--text);
    font-family: Consolas, "Courier New", monospace;
    font-weight: 700;
}

.field-table tr:last-child td {
    border-bottom: 0;
}

#payloadPreview {
    min-height: 260px;
    max-height: 420px;
    margin: 0;
    overflow: auto;
    padding: 16px;
    color: #18212d;
    background: #fbfcfd;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.55;
    white-space: pre-wrap;
}

@media (max-width: 980px) {
    .shell {
        padding: 16px;
    }

    .control-panel,
    .status-strip,
    .content-grid {
        grid-template-columns: 1fr;
    }

    .button-row {
        justify-content: stretch;
    }

    .button-row button {
        flex: 1;
        min-width: 0;
    }

    .detail-panel {
        position: static;
    }

    #payloadPreview {
        min-height: 320px;
        max-height: none;
    }
}

@media (max-width: 620px) {
    .topbar {
        flex-direction: column;
    }

    .result-row {
        grid-template-columns: 1fr 70px;
        gap: 4px 10px;
        padding: 10px 14px;
    }

    .endpoint-name {
        grid-column: 1 / -1;
    }

    .endpoint-title {
        white-space: normal;
    }

    .endpoint-count,
    .endpoint-status {
        justify-self: end;
    }
}
