* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
}
body {
  font-family: "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
}
.login-card {
  background: #fff;
  padding: 40px;
  border-radius: 12px;
  width: 360px;
  box-shadow: 0 20px 40px rgba(0,0,0,.2);
}
.login-card h1 { font-size: 20px; text-align: center; margin-bottom: 24px; }
.form-item { margin-bottom: 16px; }
.form-item label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.form-item input, .form-item select, .form-item textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 14px;
}
.error-msg { color: var(--red); margin-top: 12px; text-align: center; min-height: 18px; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 200px; background: #111827; color: #cbd5e1;
  display: flex; flex-direction: column; flex-shrink: 0;
}
.logo { padding: 20px; font-size: 18px; font-weight: bold; color: #fff; border-bottom: 1px solid #1f2937; }
.nav-item {
  display: block; padding: 13px 20px; color: #cbd5e1; cursor: pointer;
  text-decoration: none; border-left: 3px solid transparent;
}
.nav-item:hover { background: #1f2937; color: #fff; }
.nav-item.active { background: #1f2937; color: #fff; border-left-color: var(--primary); }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; background: var(--panel); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
}
#page-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
#current-user { color: var(--muted); }
.content { padding: 20px 24px; overflow: auto; flex: 1; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 7px 14px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.btn:hover { background: #f3f4f6; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { color: var(--red); border-color: #fca5a5; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; margin-top: 8px; padding: 10px; }

/* ---------- 卡片/统计 ---------- */
.stat-row { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.stat-card {
  background: var(--panel); border-radius: 10px; padding: 18px 22px; flex: 1;
  min-width: 140px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.stat-card .num { font-size: 28px; font-weight: 700; }
.stat-card .label { color: var(--muted); margin-top: 4px; }
.stat-card.online .num { color: var(--green); }
.stat-card.offline .num { color: var(--red); }

/* ---------- 共勉墙 ---------- */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.wall-card {
  background: var(--panel); border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); cursor: pointer; transition: transform .1s;
}
.wall-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.wall-thumb-wrap { position: relative; }
.wall-thumb { width: 100%; height: 180px; object-fit: cover; background: #e5e7eb; display: block; }
.wall-thumb.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.wall-rest-tag {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: rgba(217, 119, 6, .92); color: #fff;
  padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 600;
  pointer-events: none;
}
.wall-rest-tag.predict { background: rgba(146, 119, 36, .9); }
.wall-body { padding: 10px 12px; }
.wall-name { font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.wall-meta { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.6; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; }
.dot.online { background: var(--green); }
.dot.offline { background: var(--red); }
.badge { padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge.online { background: #dcfce7; color: var(--green); }
.badge.offline { background: #fee2e2; color: var(--red); }
.badge.idle { background: #fef3c7; color: var(--amber); }
.badge.rest { background: #fde68a; color: #92400e; }
.stat-card.idle .num { color: var(--amber); }

/* ---------- 磁盘空间 ---------- */
.disk-panel {
  background: var(--panel); border-radius: 10px; padding: 14px 18px;
  margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
  border-left: 4px solid var(--green);
}
.disk-panel.level-warn { border-left-color: var(--amber); }
.disk-panel.level-danger { border-left-color: var(--red); }
.disk-panel.compact { margin-bottom: 12px; }
.disk-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.disk-title { font-weight: 600; font-size: 14px; }
.disk-pct { font-weight: 700; font-size: 18px; }
.disk-panel.level-ok .disk-pct { color: var(--green); }
.disk-panel.level-warn .disk-pct { color: var(--amber); }
.disk-panel.level-danger .disk-pct { color: var(--red); }
.disk-bar {
  height: 10px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin-bottom: 8px;
}
.disk-bar-fill {
  height: 100%; width: 0; background: var(--green); border-radius: 999px; transition: width .3s ease;
}
.disk-panel.level-warn .disk-bar-fill { background: var(--amber); }
.disk-panel.level-danger .disk-bar-fill { background: var(--red); }
.disk-meta { color: var(--muted); font-size: 12px; line-height: 1.6; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 8px; overflow: hidden; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f9fafb; color: var(--muted); font-weight: 600; font-size: 13px; }
tr:hover td { background: #f9fafb; }
.panel { background: var(--panel); border-radius: 10px; padding: 18px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.panel h3 { margin-bottom: 14px; font-size: 15px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; }

/* ---------- 截图网格 ---------- */
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.shot-item { background: var(--panel); border-radius: 8px; overflow: hidden; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.08); position: relative; }
.shot-item.shot-multi { grid-column: span 2; }
.shot-thumbs { display: flex; gap: 3px; background: #111; }
.shot-thumb { position: relative; flex: 1; min-width: 0; }
.shot-thumb img { width: 100%; height: 140px; object-fit: cover; display: block; background: #e5e7eb; }
.shot-thumb .mon-tag {
  position: absolute; left: 6px; bottom: 6px; z-index: 1;
  font-size: 11px; color: #fff; background: rgba(0,0,0,.55);
  padding: 1px 6px; border-radius: 4px; pointer-events: none;
}
.shot-item img { width: 100%; height: 140px; object-fit: cover; display: block; background: #e5e7eb; }
.shot-item .cap { padding: 6px 8px; font-size: 12px; color: var(--muted); }
.shot-item .star { position: absolute; top: 6px; right: 8px; color: gold; font-size: 18px; text-shadow: 0 0 2px #000; z-index: 2; }

/* ---------- 图片查看器 ---------- */
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.viewer-stage { position: relative; display: inline-flex; max-width: 96%; max-height: 82vh; background: #000; }
.viewer-imgs { display: flex; gap: 8px; align-items: stretch; justify-content: center; max-width: 96vw; max-height: 82vh; }
.viewer-pane { margin: 0; display: flex; flex-direction: column; align-items: center; min-width: 0; flex: 1 1 0; }
.viewer-pane.is-clickable { cursor: zoom-in; }
.viewer-pane.is-clickable:hover img { outline: 2px solid rgba(255,255,255,.45); outline-offset: 2px; }
.viewer-pane figcaption {
  color: #e5e7eb; font-size: 12px; padding: 4px 0 6px; opacity: .85; flex-shrink: 0;
}
.viewer-pane img { display: block; max-height: 78vh; width: auto; max-width: 100%; object-fit: contain; background: #111; }
.viewer-zoom {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(0,0,0,.96);
  display: flex; align-items: center; justify-content: center;
}
.viewer-zoom.hidden { display: none !important; }
.viewer-zoom-back { position: absolute; top: 64px; left: 20px; z-index: 21; }
.viewer-zoom img {
  max-width: 96vw; max-height: 88vh; object-fit: contain;
  cursor: zoom-out; background: #111;
}
.viewer-zoom-tip {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,.65); font-size: 12px; pointer-events: none;
}
.viewer-stage.is-fullscreen { max-width: 100%; max-height: 100%; width: 100%; height: 100%; align-items: center; justify-content: center; }
.viewer-stage.is-fullscreen .viewer-imgs { max-width: 100%; max-height: 100%; width: 100%; height: 100%; padding: 48px 72px 64px; box-sizing: border-box; }
.viewer-stage.is-fullscreen .viewer-pane img { max-height: calc(100vh - 140px); }
.viewer-toolbar { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; color: #fff; background: rgba(0,0,0,.4); z-index: 3; gap: 16px; }
#viewer-info {
  flex: 1; min-width: 0;
  font-size: 22px; font-weight: 700; letter-spacing: .03em;
  color: #fff;
  padding: 8px 14px; border-radius: 8px;
  background: rgba(0, 0, 0, .62);
  border: 1px solid rgba(255, 255, 255, .35);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .9);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#viewer-info.wm-off { visibility: hidden; }
.viewer-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.viewer-wm-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #e5e7eb; cursor: pointer; user-select: none; }
.viewer-wm-toggle input { width: 14px; height: 14px; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.15); color: #fff; border: none; font-size: 40px; width: 56px; height: 80px; cursor: pointer; z-index: 3; }
.viewer-prev { left: 10px; }
.viewer-next { right: 10px; }
.viewer-playbar { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; color: #fff; background: rgba(0,0,0,.4); padding: 8px 16px; border-radius: 8px; z-index: 3; }
.viewer-playbar select { padding: 3px; }

/* ---------- 其它 ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 20px; border-radius: 8px; z-index: 2000; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-row .bar-label { width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row.bar-click { cursor: pointer; border-radius: 6px; padding: 4px 6px; margin-left: -6px; margin-right: -6px; }
.bar-row.bar-click:hover { background: rgba(37, 99, 235, .08); }
.bar-track { flex: 1; background: #e5e7eb; border-radius: 4px; height: 18px; overflow: hidden; }
.bar-fill { background: var(--primary); height: 100%; }
.bar-val { width: 90px; text-align: right; color: var(--muted); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #e0e7ff; color: #3730a3; padding: 4px 8px; border-radius: 999px; font-size: 12px;
}
.chip-x { border: none; background: transparent; cursor: pointer; font-size: 14px; line-height: 1; color: inherit; padding: 0 2px; }
.muted { color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; }
.form-grid { display: grid; grid-template-columns: 180px 1fr; gap: 12px 16px; align-items: center; max-width: 640px; }
