:root {
    color-scheme: light;
    --bg: #f6f8fb;
    --panel: #ffffff;
    --text: #18202f;
    --muted: #657086;
    --line: #dfe5ee;
    --primary: #1769e0;
    --primary-dark: #0f55bd;
    --danger: #b42318;
    --success: #067647;
    --warning: #a15c00;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

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

a:hover {
    text-decoration: underline;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 64px;
    padding: 0 32px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.brand {
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
}

.brand:hover {
    text-decoration: none;
}

.nav {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.nav a {
    color: var(--muted);
    font-weight: 600;
}

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

.center-page {
    width: min(560px, 100%);
    margin: 48px auto;
}

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

.panel + .panel {
    margin-top: 20px;
}

.hero {
    display: grid;
    gap: 20px;
}

h1, h2, h3 {
    margin: 0 0 16px;
    line-height: 1.25;
}

h1 {
    font-size: 30px;
}

h2 {
    font-size: 22px;
}

p {
    margin: 0 0 16px;
}

.muted {
    color: var(--muted);
}

.form-grid {
    display: grid;
    gap: 16px;
}

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

label {
    color: var(--text);
    font-weight: 650;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    color: var(--text);
    background: #fff;
    font: inherit;
}

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

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(23, 105, 224, 0.15);
}

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

.button:hover,
button:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

.button.secondary,
button.secondary {
    background: #eef2f7;
    color: var(--text);
}

.button.danger,
button.danger {
    background: var(--danger);
}

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

.alert {
    margin-bottom: 16px;
    border-radius: 6px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: #fff;
}

.alert-error {
    border-color: #f3b3ad;
    color: var(--danger);
    background: #fff4f2;
}

.alert-success {
    border-color: #a9dbc5;
    color: var(--success);
    background: #effaf5;
}

.alert-warning {
    border-color: #f0c47a;
    color: var(--warning);
    background: #fff7e8;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 11px 10px;
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

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

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

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

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 0 9px;
    background: #eef2f7;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.badge.success {
    color: var(--success);
    background: #e8f7ef;
}

.badge.warning {
    color: var(--warning);
    background: #fff2d8;
}

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

@media (max-width: 760px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 16px;
    }

    .page {
        width: min(100% - 24px, 1080px);
        margin: 20px auto;
    }

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

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