:root {
    color-scheme: light;
    --bg: #f7f8fb;
    --panel: #ffffff;
    --line: #dfe4ee;
    --text: #172033;
    --muted: #667085;
    --primary: #1f6feb;
    --primary-dark: #185abc;
    --danger: #c2410c;
    --ok: #087f5b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button,
input,
select {
    font: inherit;
}

button {
    border: 0;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    min-height: 36px;
    padding: 0 14px;
}

button:hover {
    background: var(--primary-dark);
}

button.ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
}

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

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

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px;
    background: #101828;
    color: #fff;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #fff;
    color: #101828;
    font-weight: 800;
}

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

.brand p {
    margin: 4px 0 0;
    color: #b8c1d6;
    font-size: 12px;
}

.nav {
    display: grid;
    gap: 8px;
}

.nav button {
    justify-content: flex-start;
    width: 100%;
    background: transparent;
    color: #d8deeb;
    text-align: left;
}

.nav button.active,
.nav button:hover {
    background: #263348;
    color: #fff;
}

.logout {
    margin-top: auto;
}

.main {
    min-width: 0;
}

.login-panel {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.login-box {
    display: grid;
    gap: 16px;
    width: min(380px, 100%);
    padding: 28px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

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

.login-box label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.workspace {
    padding: 24px;
}

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

.topbar h2 {
    margin: 0;
    font-size: 24px;
}

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

.metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    gap: 14px;
}

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

.metric span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.metric strong {
    display: block;
    margin-top: 8px;
    font-size: 30px;
}

.toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 10px;
    margin-bottom: 14px;
}

.form-grid {
    grid-template-columns: repeat(7, minmax(110px, 1fr)) auto;
    align-items: center;
}

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

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

th,
td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    font-size: 14px;
}

th {
    color: var(--muted);
    background: #fbfcfe;
    font-weight: 600;
}

td.actions {
    display: flex;
    gap: 8px;
    min-width: 170px;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #eef4ff;
    color: #1d4ed8;
    font-size: 12px;
}

.badge.ok {
    background: #e7f8f1;
    color: var(--ok);
}

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

.notice {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #fff4e6;
    color: var(--danger);
}

.hidden {
    display: none !important;
}

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

    .sidebar {
        min-height: auto;
    }

    .metrics,
    .form-grid {
        grid-template-columns: 1fr;
    }
}
