:root {
  --bg: #0f1216;
  --bg-2: #161b22;
  --bg-3: #1c232c;
  --border: #262d38;
  --text: #e6edf3;
  --muted: #8b98a8;
  --accent: #7c9cf5;
  --accent-2: #4a6fd4;
  --up: #3fb950;
  --warn: #d29922;
  --down: #f85149;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); background: var(--bg-3); padding: 1px 6px; border-radius: 4px; font-size: 12px; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px; flex: 0 0 220px;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff;
}
.brand-name { font-weight: 600; font-size: 14px; }
.nav { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item {
  padding: 8px 12px; border-radius: 7px; color: var(--text);
  font-size: 13.5px; display: block;
}
.nav-item:hover { background: var(--bg-3); text-decoration: none; }
.nav-item.active { background: var(--accent-2); color: #fff; font-weight: 500; }
.nav-item.disabled { color: #55606e; cursor: not-allowed; font-size: 13px; }
.nav-item.disabled:hover { background: transparent; }
.nav-sep { font-size: 11px; color: #55606e; padding: 14px 12px 4px; letter-spacing: .08em; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--border); }
.who { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.btn-link { background: none; border: none; color: var(--muted); font-size: 12.5px; cursor: pointer; padding: 0; }
.btn-link:hover { color: var(--down); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 26px; border-bottom: 1px solid var(--border);
  background: rgba(15,18,22,.85); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 5;
}
.page-title { font-size: 17px; margin: 0; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.content { padding: 22px 26px 60px; max-width: 1400px; width: 100%; }

/* ---------- Sections ---------- */
.section { margin-bottom: 30px; }
.section-title { font-size: 14px; font-weight: 600; color: var(--muted); margin: 0 0 12px; letter-spacing: .04em; }
.sub { font-size: 14px; margin: 18px 0 8px; }
.mt { margin-top: 20px; }

/* ---------- Grid ---------- */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }

/* ---------- Card ---------- */
.card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.card.link { cursor: pointer; }
.card.link:hover { border-color: var(--accent-2); text-decoration: none; }
.stat-label { font-size: 12px; color: var(--muted); letter-spacing: .03em; }
.stat-value { font-size: 26px; font-weight: 650; margin: 4px 0 8px; }
.stat-value.smallish { font-size: 16px; font-weight: 600; }

.bar { height: 5px; background: var(--bg-3); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.svc { display: flex; flex-direction: column; gap: 3px; }
.svc-head { display: flex; align-items: center; gap: 7px; }
.svc-name { font-weight: 600; font-size: 13px; }
.svc-status { font-size: 12.5px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 8px; }
.dot-up { background: var(--up); box-shadow: 0 0 6px rgba(63,185,80,.5); }
.dot-down { background: var(--down); }
.dot-warning { background: var(--warn); }
.dot-unknown { background: #55606e; }

/* ---------- Text helpers ---------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.smallish { font-size: 13px; }
.mono { font-family: var(--mono); }
.strong { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---------- Tags ---------- */
.tag {
  display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 20px;
  background: var(--bg-3); color: var(--muted); border: 1px solid var(--border);
  white-space: nowrap;
}
.tag-status { text-transform: lowercase; }
.tag-imp-high { background: rgba(248,81,73,.16); color: #ff8b85; border-color: rgba(248,81,73,.35); }
.tag-imp-medium { background: rgba(210,153,34,.16); color: #e3b341; border-color: rgba(210,153,34,.35); }
.tag-imp-normal { background: var(--bg-3); color: var(--muted); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .03em; }
.table tr:last-child td { border-bottom: none; }
.row-off { opacity: .55; }

/* ---------- List ---------- */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-bottom: 1px solid var(--border); color: var(--text);
}
.list-row:hover { background: var(--bg-2); text-decoration: none; }
.list-row:last-child { border-bottom: none; }
.list-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Form ---------- */
.form .grid { margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.field > span { font-size: 12px; color: var(--muted); }
input[type=text], input[type=password], input[type=date], select, textarea {
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  border-radius: 7px; padding: 8px 10px; font-size: 13.5px; font-family: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-2); }
textarea { resize: vertical; }
.check { display: flex; align-items: center; gap: 7px; margin: 8px 0; font-size: 13px; }
.check input { width: auto; }
.form-actions { display: flex; gap: 10px; margin-top: 14px; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 6px 13px; border-radius: 7px; font-size: 13px;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  cursor: pointer; font-family: inherit; line-height: 1.5;
}
.btn:hover { border-color: var(--accent-2); text-decoration: none; color: var(--text); }
.btn-primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-danger { color: #ff8b85; }
.btn-danger:hover { border-color: var(--down); }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn-block { width: 100%; margin-top: 8px; }
.inline { display: inline; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filters .field { margin-bottom: 0; min-width: 140px; }
.filter-actions { display: flex; gap: 8px; }

/* ---------- Intelligence card ---------- */
.intel-card { display: flex; flex-direction: column; }
.intel-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 8px; }
.intel-co { font-weight: 650; font-size: 13px; color: var(--accent); }
.intel-title { font-size: 14.5px; margin: 0 0 6px; line-height: 1.5; }
.intel-summary { font-size: 13px; color: #c3cdd9; margin: 8px 0; }
.forward { margin: 8px 0; }
.forward summary { font-size: 12.5px; color: var(--accent); cursor: pointer; }
.forward-text {
  font-family: inherit; font-size: 13px; white-space: pre-wrap; word-break: break-word;
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 7px;
  padding: 10px 12px; margin: 8px 0 0; color: #d9e2ec;
}
.intel-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; }
.body-text { font-size: 13.5px; color: #c3cdd9; }
.body-raw {
  font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word;
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 7px;
  padding: 12px; max-height: 420px; overflow: auto;
}
.detail-title { font-size: 19px; line-height: 1.45; margin: 6px 0 14px; }

/* ---------- Meta list ---------- */
.meta { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px 22px; margin: 0; }
.meta > div { display: flex; gap: 8px; }
.meta dt { color: var(--muted); font-size: 12.5px; flex: 0 0 84px; }
.meta dd { margin: 0; font-size: 13px; word-break: break-all; }

/* ---------- Login ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 70vh; }
.login-card { width: 340px; padding: 28px; }
.login-brand { display: flex; justify-content: center; margin-bottom: 10px; }
.login-brand .brand-mark { width: 40px; height: 40px; font-size: 20px; border-radius: 10px; }
.login-title { text-align: center; margin: 0 0 2px; font-size: 17px; }
.login-wrap .muted { text-align: center; margin: 0 0 18px; font-size: 12.5px; }

/* ---------- Misc ---------- */
.alert { padding: 9px 12px; border-radius: 7px; font-size: 13px; margin-bottom: 14px; }
.alert.error { background: rgba(248,81,73,.13); border: 1px solid rgba(248,81,73,.35); color: #ff8b85; }
.empty { text-align: center; color: var(--muted); padding: 34px; font-size: 13.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-5 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 780px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; border-right: none; border-bottom: 1px solid var(--border); }
  .nav { flex-direction: row; flex-wrap: wrap; padding: 6px 10px; }
  .nav-sep { display: none; }
  .nav-item.disabled { display: none; }
  .sidebar-foot { display: flex; align-items: center; justify-content: space-between; }
  .grid-2, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .meta { grid-template-columns: 1fr; }
}
