:root {
    --bg: #f6f5f2;
    --surface: #ffffff;
    --line: #eceae4;
    --ink: #333a3b;
    --muted: #8a908e;
    --brand: #7c9a96;
    --brand-deep: #5f7d79;
    --ok: #dcece6;
    --ok-ink: #4f7a68;
    --off: #f0e9e4;
    --off-ink: #9a7864;
    --danger: #b9706b;
    --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--ink);
    font: 14px/1.6 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0; font-weight: 600; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    flex: 0 0 232px;
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 28px 18px 20px;
    display: flex;
    flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 26px; }
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--brand); color: #fff; font-weight: 700; font-size: 18px;
}
.brand-text { font-size: 16px; font-weight: 600; line-height: 1.2; }
.brand-text small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
    display: block; padding: 10px 12px; border-radius: 8px;
    color: var(--ink); font-size: 14px;
}
.nav-item:hover { background: #f3f4f1; text-decoration: none; }
.nav-item.active { background: #eaf0ee; color: var(--brand-deep); font-weight: 600; }

.sidebar-foot { margin-top: auto; padding: 18px 8px 0; border-top: 1px solid var(--line); }
.who { font-weight: 600; }
.role { color: var(--muted); font-size: 12px; margin-bottom: 12px; }

.main { flex: 1; min-width: 0; }
.topbar { padding: 26px 34px 0; }
.topbar h1 { font-size: 22px; }
.content { padding: 22px 34px 48px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.stat-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stat-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 22px;
    box-shadow: 0 2px 12px rgba(31, 41, 40, .03);
}
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 30px; font-weight: 600; margin: 8px 0 4px; letter-spacing: -.5px; }
.stat-value small { font-size: 14px; font-weight: 400; color: var(--muted); }
.stat-note { color: var(--muted); font-size: 12px; }

.panel {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 22px; margin-top: 18px;
    box-shadow: 0 2px 12px rgba(31, 41, 40, .03);
}
.panel-title { font-size: 16px; margin-bottom: 16px; }
.profile { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.profile-name { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.muted { color: var(--muted); }
.ta-right { text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 28px 0; }

.filter { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
input[type="text"], input[type="password"] {
    border: 1px solid var(--line); border-radius: 8px;
    padding: 8px 12px; font: inherit; color: var(--ink);
    background: #fcfcfa; outline: none;
}
input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(124, 154, 150, .14); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field span { color: var(--muted); font-size: 12px; }
.form-inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.form-inline .field { margin-bottom: 0; min-width: 200px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 500; font-size: 12px; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fbfbf9; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; }
.badge-ok { background: var(--ok); color: var(--ok-ink); }
.badge-off { background: var(--off); color: var(--off-ink); }

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid transparent; border-radius: 8px;
    padding: 8px 16px; font: inherit; cursor: pointer; line-height: 1.4;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-deep); text-decoration: none; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: #f5f6f3; text-decoration: none; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.inline { display: inline; }

.alert { background: #eef3f0; border: 1px solid #d9e6df; color: var(--ok-ink); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.alert-error { background: #f8eeec; border-color: #edd7d3; color: var(--danger); }

.pagination { margin-top: 16px; }
.pagination nav { display: flex; gap: 6px; flex-wrap: wrap; }
.pagination nav a, .pagination nav span {
    border: 1px solid var(--line); border-radius: 6px;
    padding: 4px 10px; font-size: 12px; color: var(--ink); background: #fff;
}
.pagination nav span[aria-current="page"] { background: var(--brand); color: #fff; border-color: var(--brand); }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
    width: 100%; max-width: 380px; background: var(--surface);
    border: 1px solid var(--line); border-radius: 16px;
    padding: 36px; box-shadow: 0 10px 40px rgba(31, 41, 40, .06);
}
.login-brand { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.login-sub { color: var(--muted); margin: 6px 0 24px; font-size: 13px; }

@media (max-width: 1100px) {
    .stat-grid, .stat-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; flex: none; border-right: none; border-bottom: 1px solid var(--line); }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .topbar, .content { padding-left: 18px; padding-right: 18px; }
    .stat-grid, .stat-grid-3 { grid-template-columns: 1fr; }
}
