* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: #1f2937;
    background: #f5f7fa;
    font-family: Arial, "Microsoft YaHei", sans-serif;
    font-size: 14px;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-layout {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 18px;
    align-items: stretch;
}

.login-box {
    width: 360px;
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.login-box h1 {
    margin: 0 0 20px;
    font-size: 22px;
}

.login-guide {
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.login-guide h2 {
    margin: 0 0 16px;
    font-size: 18px;
}

.steps {
    margin: 0;
    padding-left: 22px;
}

.steps li {
    margin-bottom: 14px;
}

.steps strong,
.steps span,
.steps code {
    display: block;
}

.steps span {
    margin: 4px 0;
    color: #475569;
    line-height: 1.6;
}

.steps code {
    width: fit-content;
    max-width: 100%;
    padding: 5px 7px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #0f172a;
    overflow-wrap: anywhere;
}

.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 220px 1fr;
}

.sidebar {
    background: #172033;
    color: #dbeafe;
    padding: 20px 14px;
}

.brand {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 24px;
    color: #fff;
}

.nav a {
    display: block;
    padding: 10px 12px;
    margin-bottom: 4px;
    color: #cbd5e1;
    border-radius: 6px;
}

.nav a.active,
.nav a:hover {
    background: #24324d;
    color: #fff;
    text-decoration: none;
}

.main {
    min-width: 0;
}

.topbar {
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: #fff;
    border-bottom: 1px solid #dbe3ef;
}

.topbar h1 {
    margin: 0;
    font-size: 18px;
}

.content {
    padding: 20px 24px 36px;
}

.panel {
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    margin-bottom: 16px;
}

.panel-head {
    padding: 14px 16px;
    border-bottom: 1px solid #e5edf7;
    font-weight: 700;
}

.panel-body {
    padding: 16px;
}

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

.stat {
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 14px;
}

.stat strong {
    display: block;
    font-size: 22px;
    margin-bottom: 4px;
}

.filters,
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}

label {
    display: block;
    color: #475569;
    font-size: 12px;
    margin-bottom: 5px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 34px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 7px 9px;
    background: #fff;
    color: #111827;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

.field {
    min-width: 150px;
}

.field.wide {
    min-width: 260px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #1f2937;
    cursor: pointer;
    font: inherit;
}

.btn.primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.btn.danger {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.btn:hover {
    text-decoration: none;
    filter: brightness(0.98);
}

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

th,
td {
    padding: 10px 12px;
    border-bottom: 1px solid #edf2f7;
    text-align: left;
    vertical-align: top;
}

th {
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    background: #f8fafc;
}

.muted {
    color: #64748b;
}

.subject {
    max-width: 420px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge {
    display: inline-block;
    padding: 3px 7px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 12px;
}

.badge.warn {
    background: #fef3c7;
    color: #92400e;
}

.badge.ok {
    background: #dcfce7;
    color: #166534;
}

.badge.danger {
    background: #fee2e2;
    color: #991b1b;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.inline {
    display: inline;
}

.pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 12px;
}

.api-docs {
    max-width: 1180px;
}

.api-summary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 20px;
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
}

.api-summary h2 {
    margin: 2px 0 8px;
    font-size: 22px;
}

.api-summary p {
    margin: 0;
    color: #475569;
    line-height: 1.7;
}

.eyebrow {
    color: #2563eb;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
}

.api-kv code {
    overflow-wrap: anywhere;
}

.endpoint-list {
    padding: 0 16px;
}

.endpoint-row {
    padding: 16px 0;
    border-bottom: 1px solid #edf2f7;
}

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

.endpoint-row p {
    margin: 8px 0 12px;
    color: #475569;
    line-height: 1.7;
}

.endpoint-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.endpoint-title code {
    padding: 5px 7px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #0f172a;
    overflow-wrap: anywhere;
}

.endpoint-title strong {
    font-size: 15px;
}

.endpoint-row.compact {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.method {
    min-width: 58px;
    padding: 4px 7px;
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.method.get {
    background: #2563eb;
}

.method.post {
    background: #059669;
}

.method.put {
    background: #7c3aed;
}

.method.delete {
    background: #dc2626;
}

.param-table {
    margin: 10px 0 12px;
    border: 1px solid #edf2f7;
}

.param-table td:first-child {
    width: 190px;
}

.param-table code,
.response-note code {
    overflow-wrap: anywhere;
}

.response-note {
    margin: 10px 0 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f8fafc;
    color: #475569;
    line-height: 1.7;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 14px 16px;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 14px 16px;
}

.template-grid .full {
    grid-column: 1 / -1;
}

.template-vars {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.template-vars code {
    padding: 4px 7px;
    border-radius: 6px;
    background: #e2e8f0;
}

.check-field {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    margin: 0;
    color: #1f2937;
    font-size: 14px;
}

.check-field input {
    width: auto;
    min-height: auto;
}

.table-check {
    width: auto;
    min-height: auto;
}

.log-error {
    max-width: 320px;
    word-break: break-word;
}

.body-box,
pre {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 14px;
    white-space: pre-wrap;
    overflow: auto;
}

.fold-block summary {
    cursor: pointer;
    color: #2563eb;
}

.fold-block pre {
    margin-top: 12px;
}

.html-frame {
    width: 100%;
    min-height: 360px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
}

.alert {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    background: #fee2e2;
    color: #991b1b;
}

@media (max-width: 900px) {
    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .login-layout {
        grid-template-columns: 1fr;
    }

    .login-box {
        width: 100%;
    }

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

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

    .content {
        padding: 16px;
    }

    .api-summary {
        display: block;
    }

    .api-summary form {
        margin-top: 14px;
    }

    .endpoint-row.compact {
        grid-template-columns: 1fr;
    }

    .param-table td:first-child {
        width: auto;
    }
}
