* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: #202123;
    background: #f7f7f8;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 18px 12px;
    background: #111827;
    color: #f9fafb;
}

.brand {
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    margin-bottom: 14px;
    font-weight: 700;
}

.nav-item {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 0 12px;
    margin-bottom: 4px;
    color: #d1d5db;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
}

.nav-item:hover,
.nav-item.active {
    color: #fff;
    background: #1f2937;
}

.nav-sub {
    min-height: 34px;
    padding-left: 24px;
    margin-left: 8px;
    font-size: 13px;
    color: #aeb7c4;
}

.content {
    width: min(1180px, calc(100vw - 300px));
    margin: 0 auto;
    padding: 28px 0 48px;
}

.content.narrow {
    width: min(920px, calc(100vw - 300px));
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: 0;
}

h2 {
    font-size: 16px;
    margin: 22px 0 14px;
    letter-spacing: 0;
}

.page-head p {
    color: #6b7280;
    margin-top: 6px;
}

.surface,
.stat {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.surface {
    padding: 20px;
    margin-bottom: 16px;
}

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

.stat {
    padding: 16px;
}

.stat span,
dt {
    display: block;
    color: #6b7280;
    font-size: 13px;
}

.stat strong {
    display: block;
    margin-top: 6px;
    font-size: 18px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #202123;
    text-decoration: none;
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.button.primary {
    background: #111827;
    border-color: #111827;
    color: #fff;
}

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

.table th,
.table td {
    padding: 13px 12px;
    border-bottom: 1px solid #edf0f3;
    text-align: left;
    vertical-align: middle;
}

.table th {
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
}

.empty,
.empty-state {
    color: #6b7280;
    text-align: center;
}

.empty-state {
    padding: 42px 12px;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 13px;
    font-weight: 600;
}

.badge.large {
    min-height: 34px;
    padding: 0 14px;
}

.form h2:first-child,
.surface h2:first-child {
    margin-top: 0;
}

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

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

label {
    display: block;
    font-weight: 600;
    font-size: 14px;
}

input,
select,
textarea {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    font: inherit;
}

input {
    height: 42px;
}

select {
    height: 42px;
}

textarea {
    min-height: 168px;
    padding-top: 10px;
    padding-bottom: 10px;
    resize: vertical;
    line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #c7d2fe;
    border-color: #818cf8;
}

.checkline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.checkline input {
    width: 18px;
    height: 18px;
    margin: 0;
}

.error {
    display: block;
    margin-top: 6px;
    color: #b42318;
    font-size: 13px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 18px;
}

.statusline {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 18px;
}

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

.split.align-start {
    align-items: start;
}

dl {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 10px 14px;
    margin: 0;
}

dd {
    margin: 0;
}

.break {
    overflow-wrap: anywhere;
}

.notice {
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
}

.result-status {
    display: grid;
    gap: 4px;
    padding: 12px;
    margin-bottom: 16px;
    border-radius: 8px;
}

.result-status.ok {
    background: #ecfdf5;
    color: #065f46;
}

.result-status.fail {
    background: #fef2f2;
    color: #991b1b;
}

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

.flow > div {
    min-height: 118px;
    padding: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
}

.flow strong,
.flow span {
    display: block;
}

.flow span {
    margin-top: 8px;
    color: #6b7280;
    line-height: 1.5;
    font-size: 13px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.feature-card {
    display: grid;
    gap: 8px;
    min-height: 150px;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    color: #202123;
    text-decoration: none;
}

.feature-card:hover {
    border-color: #9ca3af;
    background: #fff;
}

.feature-card span,
.muted {
    color: #6b7280;
    line-height: 1.55;
}

.feature-card small {
    align-self: end;
    color: #4b5563;
    overflow-wrap: anywhere;
}

.explain-list {
    margin: 0;
    padding-left: 18px;
    color: #4b5563;
    line-height: 1.7;
}

.compact-dl {
    margin-top: 16px;
}

h3 {
    margin: 16px 0 8px;
    font-size: 14px;
    letter-spacing: 0;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.action-button {
    min-height: 44px;
    justify-content: flex-start;
}

.action-button.selected {
    border-color: #111827;
    background: #f3f4f6;
    font-weight: 700;
}

pre {
    overflow: auto;
    max-height: 360px;
    padding: 14px;
    border-radius: 8px;
    background: #111827;
    color: #f9fafb;
    font-size: 13px;
}

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

    .sidebar {
        position: static;
        height: auto;
    }

    .sidebar nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px;
    }

    .content,
    .content.narrow {
        width: min(100vw - 24px, 100%);
        padding-top: 20px;
    }

    .page-head,
    .stats,
    .split,
    .form-grid,
    .flow,
    .feature-grid,
    .action-grid {
        grid-template-columns: 1fr;
    }

    .page-head {
        display: grid;
    }

    .table {
        display: block;
        overflow-x: auto;
    }
}
