:root {
    --bg: #f4faf5;
    --panel: #ffffff;
    --ink: #1b4332;
    --muted: #5c7a6e;
    --line: #d4e5da;
    --brand: #1b4332;
    --brand-dark: #081c15;
    --accent: #f48c06;
    --danger: #d62828;
    --warn: #f48c06;
    --ok: #2d6a4f;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: linear-gradient(180deg, #e9f5eb 0%, #ffffff 55%, #f4faf5 100%);
    color: var(--ink);
    min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout {
    display: flex;
    min-height: 100vh;
    align-items: flex-start;
}
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    width: 232px;
    height: 100vh;
    overflow-y: auto;
    background: #1b4332;
    color: #e8f2ee;
    padding: 22px 14px 28px;
    flex-shrink: 0;
    box-shadow: 4px 0 24px rgba(8, 28, 21, .12);
}
.side-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    padding: 4px 6px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.side-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255,255,255,.06);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.sidebar h2 {
    margin: 0;
    font-size: 22px;
    letter-spacing: .08em;
    line-height: 1.2;
}
.sidebar .side-sub {
    margin: 4px 0 0;
    color: #9fb5ad;
    font-size: 12px;
    line-height: 1.35;
}
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d7e8e2;
    padding: 11px 12px;
    border-radius: 12px;
    margin-bottom: 4px;
    text-decoration: none;
    font-size: 14px;
    transition: background .15s ease, color .15s ease;
}
.sidebar nav a .nav-ico {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: .88;
}
.sidebar nav a:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
    text-decoration: none;
}
.sidebar nav a.active {
    background: rgba(244, 140, 6, .18);
    color: #fff;
    box-shadow: inset 3px 0 0 #f48c06;
}
.sidebar nav a.active .nav-ico {
    opacity: 1;
    color: #f48c06;
}
.main {
    flex: 1;
    margin-left: 232px;
    padding: 28px;
    min-width: 0;
    min-height: 100vh;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.topbar h1 { margin: 0; font-size: 26px; }
.btn, button, .btn-link {
    display: inline-block;
    border: none;
    border-radius: 10px;
    padding: 8px 14px;
    background: var(--brand);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
}
.btn:hover, button:hover { background: var(--brand-dark); }
.btn.secondary { background: #4b635b; }
.btn.danger, button.danger { background: var(--danger); }
.btn.small, button.small { padding: 5px 10px; font-size: 12px; }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
}
.card .label { color: var(--muted); font-size: 13px; }
.card .value { font-size: 28px; font-weight: 700; margin-top: 8px; }

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 18px;
}
.panel h3 { margin: 0 0 14px; font-size: 18px; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
th, td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
th { color: var(--muted); font-weight: 600; }
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    background: #e7f2ef;
    color: var(--brand-dark);
}
.tag.elder { background: #e8f5e9; color: var(--ok); }
.tag.child { background: #e3f2fd; color: #1565c0; }
.tag.off { background: #eeeeee; color: #757575; }
.tag.danger { background: #ffebee; color: var(--danger); }
.tag.warn { background: #fff8e1; color: var(--warn); }

.alert {
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 14px;
}
.alert.ok { background: #e8f5e9; color: var(--ok); }
.alert.error { background: #ffebee; color: var(--danger); }

.form-grid { display: grid; gap: 12px; max-width: 480px; }
.form-grid label { font-size: 13px; color: var(--muted); }
.form-grid input, .form-grid select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 15px;
}

.login-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    background:
        radial-gradient(circle at 20% 20%, rgba(15,118,110,.18), transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(46,125,50,.12), transparent 35%),
        linear-gradient(160deg, #eef6f2, #f7faf8);
}
.login-card {
    width: min(400px, 92vw);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 32px 28px;
    box-shadow: 0 16px 40px rgba(21, 35, 29, .08);
}
.login-card h1 { margin: 0; font-size: 28px; color: var(--brand-dark); }
.login-card .sub { margin: 6px 0 22px; color: var(--muted); }
.login-card label { display: block; margin: 12px 0 6px; font-size: 13px; color: var(--muted); }
.login-card input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 15px;
}
.login-card button {
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    font-size: 16px;
}
.login-card .hint { margin-top: 14px; color: var(--muted); font-size: 12px; text-align: center; }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
@media (max-width: 900px) {
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        max-height: none;
    }
    .main { margin-left: 0; }
    .grid-2 { grid-template-columns: 1fr; }
    .layout { flex-direction: column; }
}
