* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif; font-size: 14px; color: #333; }

/* ===== Header ===== */
.header {
    position: fixed; top: 0; left: 0; right: 0; height: 50px;
    background: #1a237e; color: #fff;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; z-index: 100; box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.header .logo { font-size: 17px; font-weight: bold; letter-spacing: 1px; }
.header .user-info { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #c5cae9; }
.header .user-info .logout-btn {
    color: #c5cae9; cursor: pointer; text-decoration: none;
    padding: 4px 10px; border: 1px solid #3949ab; border-radius: 3px;
    transition: background .2s;
}
.header .user-info .logout-btn:hover { background: #3949ab; color: #fff; }

/* ===== Sidebar ===== */
.sidebar {
    position: fixed; top: 50px; left: 0; bottom: 0; width: 200px;
    background: #263238; overflow-y: auto; z-index: 99;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #37474f; }

.menu-group { border-bottom: 1px solid #2e3c43; }
.menu-parent {
    display: flex; align-items: center; padding: 12px 16px;
    color: #b0bec5; cursor: pointer; font-size: 13px; user-select: none;
    transition: background .15s;
}
.menu-parent:hover { background: #37474f; color: #fff; }
.menu-parent .m-icon { margin-right: 8px; font-size: 15px; }
.menu-parent .arrow { margin-left: auto; font-size: 11px; transition: transform .2s; color: #546e7a; }
.menu-parent.open .arrow { transform: rotate(90deg); }

.menu-children { display: none; background: #1c272b; }
.menu-children.open { display: block; }
.menu-child {
    display: block; padding: 10px 16px 10px 36px;
    color: #78909c; cursor: pointer; font-size: 13px;
    transition: background .15s, color .15s;
}
.menu-child:hover { background: #263238; color: #b0bec5; }
.menu-child.active { background: #1565c0; color: #fff; }

/* ===== Main Content ===== */
.main-content {
    margin-top: 50px; margin-left: 200px;
    padding: 20px; min-height: calc(100vh - 50px); background: #f0f2f5;
}

/* ===== Welcome ===== */
.welcome {
    text-align: center; padding: 80px 20px; color: #90a4ae;
}
.welcome .w-icon { font-size: 60px; }
.welcome h2 { font-size: 22px; margin-top: 16px; color: #607d8b; font-weight: 400; }
.welcome p { font-size: 13px; margin-top: 8px; }

/* ===== Card ===== */
.card {
    background: #fff; border-radius: 4px; padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: 16px;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid #f0f0f0;
}
.card-title { font-size: 15px; font-weight: 600; color: #1a237e; }

/* ===== Table ===== */
table { width: 100%; border-collapse: collapse; }
th {
    padding: 10px 12px; text-align: left; font-size: 13px;
    font-weight: 600; color: #546e7a; background: #f8f9fa;
    border-bottom: 2px solid #e8ecef;
}
td {
    padding: 10px 12px; font-size: 13px; color: #444;
    border-bottom: 1px solid #f0f0f0;
}
tr:hover td { background: #fafbfc; }

/* ===== Buttons ===== */
.btn {
    padding: 6px 14px; border: none; border-radius: 3px;
    cursor: pointer; font-size: 13px; transition: background .15s; line-height: 1.4;
}
.btn-primary { background: #1976d2; color: #fff; }
.btn-primary:hover { background: #1565c0; }
.btn-success { background: #388e3c; color: #fff; }
.btn-success:hover { background: #2e7d32; }
.btn-danger { background: #e53935; color: #fff; }
.btn-danger:hover { background: #c62828; }
.btn-default { background: #e8eaf6; color: #3949ab; border: 1px solid #c5cae9; }
.btn-default:hover { background: #c5cae9; }
.btn-sm { padding: 3px 10px; font-size: 12px; margin-right: 4px; }

/* ===== Badge ===== */
.badge { padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge-on  { background: #e8f5e9; color: #2e7d32; }
.badge-off { background: #ffebee; color: #c62828; }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.45); display: flex; align-items: center;
    justify-content: center; z-index: 1000;
}
.modal-box {
    background: #fff; border-radius: 6px; width: 500px; max-width: 95%;
    max-height: 88vh; overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity:0; transform:scale(.96); } to { opacity:1; transform:scale(1); } }

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #eee;
    background: #fafafa; border-radius: 6px 6px 0 0;
}
.modal-header .m-title { font-size: 15px; font-weight: 600; color: #1a237e; }
.modal-header .m-close {
    background: none; border: none; font-size: 22px; cursor: pointer;
    color: #999; line-height: 1; padding: 0 4px;
}
.modal-header .m-close:hover { color: #333; }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 14px 20px; border-top: 1px solid #eee;
    display: flex; justify-content: flex-end; gap: 10px;
    background: #fafafa; border-radius: 0 0 6px 6px;
}

/* ===== Form ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 5px; font-size: 13px; color: #555; font-weight: 500; }
.form-control {
    width: 100%; padding: 8px 10px; border: 1px solid #ddd; border-radius: 3px;
    font-size: 13px; outline: none; transition: border-color .15s;
    font-family: inherit; color: #333;
}
.form-control:focus { border-color: #1976d2; box-shadow: 0 0 0 2px rgba(25,118,210,.1); }
select.form-control { background: #fff; cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 72px; }

/* ===== Checkbox group ===== */
.checkbox-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px; background: #f8f9fa; border-radius: 3px; border: 1px solid #eee; }
.checkbox-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #444; cursor: pointer; }
.checkbox-item input { cursor: pointer; }

/* ===== Login ===== */
.login-page {
    min-height: 100vh; background: linear-gradient(135deg, #1a237e 0%, #283593 60%, #1565c0 100%);
    display: flex; align-items: center; justify-content: center;
}
.login-card {
    background: #fff; border-radius: 8px; width: 380px; padding: 44px 40px;
    box-shadow: 0 12px 48px rgba(0,0,0,.25);
}
.login-logo { text-align: center; font-size: 36px; margin-bottom: 8px; }
.login-title { text-align: center; font-size: 20px; font-weight: bold; color: #1a237e; margin-bottom: 4px; }
.login-sub { text-align: center; font-size: 12px; color: #90a4ae; margin-bottom: 32px; }
.login-btn {
    width: 100%; padding: 11px; background: #1976d2; color: #fff;
    border: none; border-radius: 4px; cursor: pointer; font-size: 15px;
    margin-top: 8px; transition: background .15s; letter-spacing: 2px;
}
.login-btn:hover { background: #1565c0; }
.login-error { color: #e53935; font-size: 13px; text-align: center; margin-top: 10px; min-height: 18px; }

/* ===== Empty state ===== */
.empty { text-align: center; padding: 40px; color: #90a4ae; font-size: 13px; }
