:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --line: #e8ecf3;
  --text: #1f2733;
  --muted: #8a94a6;
  --primary: #2f9e6e;
  --primary-d: #26805a;
  --danger: #e0533d;
  --warn: #e6a23c;
  --shadow: 0 1px 3px rgba(20, 30, 50, 0.06), 0 6px 20px rgba(20, 30, 50, 0.05);
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); background: var(--bg); }
.hidden { display: none !important; }
button { cursor: pointer; font: inherit; }
.err { color: var(--danger); min-height: 18px; margin: 6px 0 0; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #e9f7ef, #f5f7fb); }
.login-card { background: var(--card); padding: 36px 32px; border-radius: 16px; box-shadow: var(--shadow); width: 320px; }
.login-card h1 { margin: 0; font-size: 22px; }
.login-card .sub { color: var(--muted); margin: 4px 0 22px; }
.login-card label { display: block; margin-bottom: 14px; color: var(--muted); }
.login-card input { width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); }
.login-card button { width: 100%; padding: 11px; background: var(--primary); color: #fff; border: 0; border-radius: 9px; font-weight: 600; }
.login-card button:hover { background: var(--primary-d); }

/* 主框架 */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 210px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px; }
.brand { font-weight: 700; font-size: 16px; padding: 6px 10px 16px; }
.sidebar nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.nav-item { text-align: left; background: transparent; border: 0; padding: 10px 12px; border-radius: 9px; color: var(--text); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nav-item:hover { background: #f0f4f9; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 600; }
.nav-item.active .nav-badge { background: #fff; color: var(--danger); }
.side-foot { border-top: 1px solid var(--line); padding-top: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.link { background: none; border: 0; color: var(--danger); }
.link-jump { background: none; border: 0; padding: 0; color: var(--primary-d); text-decoration: underline; cursor: pointer; font: inherit; }

.topbar { display: none; }
.nav-mask { display: none; }
.nav-toggle { background: none; border: 0; font-size: 22px; padding: 4px 8px; }

.content { flex: 1; padding: 24px 28px; overflow: auto; min-width: 0; }
#view-title { font-size: 18px; font-weight: 700; margin-bottom: 18px; }

/* 卡片 & 网格 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .lbl { color: var(--muted); margin-top: 4px; }
.stat.warn .num { color: var(--warn); }
.stat.danger .num { color: var(--danger); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 18px; overflow-x: auto; }
.panel h3 { margin: 0 0 12px; font-size: 15px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.toolbar input, .toolbar select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
tr:hover td { background: #fafcfe; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; background: #eef1f6; color: var(--muted); }
.badge.ok { background: #e7f6ee; color: var(--primary-d); }
.badge.fail { background: #fdeceb; color: var(--danger); }
.badge.off { background: #fff3e0; color: var(--warn); }

.btn { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.tab-btn { display: inline-flex; align-items: center; gap: 6px; }
.tab-btn.primary .nav-badge { background: #fff; color: var(--danger); }

.pager { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.charts-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 960px) { .charts-2 { grid-template-columns: 1fr; } }
.trend { display: flex; gap: 8px; align-items: stretch; height: 200px; padding: 4px 2px 0; }
.trend .bar-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; height: 100%; }
.trend .bar-val { font-size: 11px; color: var(--muted); margin-bottom: 4px; line-height: 1; flex-shrink: 0; }
.trend .bar-track, .trend.dual .bar-pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; min-height: 0; }
.trend .bar { width: 100%; max-width: 28px; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; }
.trend .bar-col span { font-size: 11px; color: var(--muted); margin-top: 8px; white-space: nowrap; flex-shrink: 0; }
.trend.dual .bar-pair { gap: 3px; }
.trend.dual .bar { max-width: 14px; flex: 1; }

.health-list { margin: 0; padding-left: 18px; color: var(--text); line-height: 1.9; font-size: 13px; }
.health-list li { color: var(--muted); }
.stat .num .badge { font-size: 13px; }
.legend-dot { display: inline-block; font-size: 12px; font-weight: 500; margin-left: 10px; padding: 1px 8px; border-radius: 999px; }
.legend-dot.ok { background: #e7f6ee; color: var(--primary-d); }
.legend-dot.fail { background: #fdeceb; color: var(--danger); }
.empty { color: var(--muted); text-align: center; padding: 30px; }

/* 强制改密遮罩 */
.overlay { position: fixed; inset: 0; background: rgba(20, 30, 50, 0.55); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--card); padding: 28px 26px; border-radius: 16px; box-shadow: var(--shadow); width: 340px; }
.modal h2 { margin: 0 0 6px; font-size: 18px; }
.modal .sub { color: var(--muted); margin: 0 0 18px; }
.modal label { display: block; margin-bottom: 14px; color: var(--muted); }
.modal input { width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); }
.modal button { width: 100%; padding: 11px; background: var(--primary); color: #fff; border: 0; border-radius: 9px; font-weight: 600; }
.modal button:hover { background: var(--primary-d); }

/* 批量操作条 */
.bulk-bar { display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: #f0f6f2; border: 1px solid #cfe7da; border-radius: 9px; margin-bottom: 12px; }
.bulk-bar .count { color: var(--muted); }
.row-check { width: 16px; height: 16px; }
td.center, th.center { text-align: center; }
.tag { display: inline-block; padding: 1px 6px; border-radius: 5px; background: #f0f2f6; color: var(--muted); font-size: 11px; }

/* 可点击统计卡（待审核等） */
.stat.clickable { cursor: pointer; transition: transform .1s ease, box-shadow .1s ease; }
.stat.clickable:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(224,83,61,.18); border-color: var(--danger); }

/* 审核图片缩略图 */
.thumbs { display: flex; gap: 4px; flex-wrap: wrap; }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); cursor: pointer; background: #f3f5f8; }
.thumb:hover { border-color: var(--primary); }

/* 图片灯箱 */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.8); display: flex; align-items: center; justify-content: center; z-index: 80; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 8px; }
.lightbox .close { position: absolute; top: 18px; right: 24px; color: #fff; font-size: 34px; cursor: pointer; }

/* 模拟查看时间轴 */
.tl-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.tl-meta { color: var(--muted); font-size: 12px; }
.tl-item .thumbs { margin-top: 6px; }

/* 编辑弹窗文本域 */
.modal textarea { width: 100%; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); font: inherit; resize: vertical; }
.modal .row-actions { display: flex; gap: 10px; }
.modal .row-actions .btn { flex: 1; width: auto; }
.modal .row-actions button { width: auto; }

/* 轻提示 */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px);
  background: #1f2733; color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 13px; z-index: 90; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

@media (max-width: 800px) {
  .topbar {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
  }
  .brand-m { font-weight: 700; flex: 1; }
  .me-m { color: var(--muted); font-size: 12px; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 40;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow);
  }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .nav-mask {
    display: block; position: fixed; inset: 0; background: rgba(20, 30, 50, .4); z-index: 35;
  }
  .content { padding: 16px 12px calc(24px + env(safe-area-inset-bottom)); }
  #view-title { font-size: 16px; margin-bottom: 12px; }
  .modal { width: calc(100vw - 32px); max-width: 340px; }
}
