* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f4f6fa; --panel: #fff; --line: #e3e8f0; --text: #1f2a3d;
  --sub: #6b7a90; --primary: #2f6bff; --primary-d: #1e52d0;
  --danger: #e5484d; --ok: #12a150; --warn: #e08a00;
}
body { font-family: -apple-system, "Microsoft YaHei", "Segoe UI", sans-serif; color: var(--text); background: var(--bg); font-size: 14px; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e2a44 0%, #2f6bff 100%); }
.login-box { width: 360px; background: #fff; border-radius: 12px; padding: 36px 32px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-box h1 { font-size: 20px; text-align: center; }
.login-box .sub { text-align: center; color: var(--sub); margin: 6px 0 24px; font-size: 13px; }
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; color: var(--sub); font-size: 13px; }
.field input, .field select { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; outline: none; }
.field input:focus, .field select:focus { border-color: var(--primary); }

.btn { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 16px;
  border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer; color: var(--text); }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.danger { color: var(--danger); border-color: #f3c2c3; }
.btn.danger:hover { background: #fff2f2; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; height: 42px; }
.msg { margin-top: 14px; color: var(--danger); text-align: center; font-size: 13px; min-height: 18px; }

/* 主体布局 */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 210px; background: #141c2e; color: #c9d4e6; display: flex; flex-direction: column; }
.logo { height: 60px; line-height: 60px; text-align: center; font-size: 16px; font-weight: 600; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar nav { flex: 1; padding: 10px 0; }
.nav-item { display: block; padding: 12px 24px; color: #a9b7cd; cursor: pointer; font-size: 14px; border-left: 3px solid transparent; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: rgba(47,107,255,.18); color: #fff; border-left-color: var(--primary); }
.sidebar-footer { padding: 16px 24px; border-top: 1px solid rgba(255,255,255,.08); display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.logout { color: #ff8a8e; text-decoration: none; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 60px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; }
.topbar h2 { font-size: 17px; font-weight: 600; }
#clock { color: var(--sub); font-size: 13px; }
.content { padding: 20px; flex: 1; }

/* 卡片统计 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: #fff; border-radius: 10px; padding: 18px 20px; border: 1px solid var(--line); }
.stat .num { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat .lbl { color: var(--sub); font-size: 13px; margin-top: 6px; }

/* 面板/表格 */
.panel { background: #fff; border-radius: 10px; border: 1px solid var(--line); overflow: hidden; }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-head h3 { font-size: 15px; font-weight: 600; }
.panel-head .tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel-head input[type=text], .panel-head select { height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; }
.panel-body { padding: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid #eef1f6; font-size: 13px; }
th { background: #fafbfd; color: var(--sub); font-weight: 600; white-space: nowrap; }
tr:hover td { background: #f8faff; }
td.actions { white-space: nowrap; }
td.actions .btn { margin-right: 4px; }
.empty { padding: 40px; text-align: center; color: var(--sub); }

/* 标签 */
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; line-height: 18px; }
.tag.ok { background: #e7f8ee; color: var(--ok); }
.tag.off { background: #f2f3f5; color: var(--sub); }
.tag.warn { background: #fff6e5; color: var(--warn); }
.tag.bad { background: #ffecec; color: var(--danger); }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,22,36,.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 12px; width: 440px; max-width: 92vw; max-height: 88vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 600; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* 日志 */
.log-item { padding: 8px 14px; border-bottom: 1px solid #eef1f6; font-size: 13px; display: flex; gap: 10px; }
.log-item .t { color: var(--sub); white-space: nowrap; }
.log-item .lv { width: 52px; flex-shrink: 0; font-weight: 600; }
.lv.info { color: var(--primary); } .lv.warn { color: var(--warn); } .lv.error { color: var(--danger); }

/* toast */
.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-20px); background: #1f2a3d; color: #fff;
  padding: 10px 20px; border-radius: 8px; opacity: 0; transition: all .25s; pointer-events: none; z-index: 200; font-size: 13px; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #d93a3f; }

@media (max-width: 720px) {
  .sidebar { width: 64px; } .logo { font-size: 12px; } .nav-item { padding: 12px 8px; text-align: center; font-size: 12px; }
  .sidebar-footer { flex-direction: column; gap: 6px; font-size: 12px; }
}