﻿:root {
  --bg0: #f5f7fa;
  --bg1: #ebeff5;
  --card: rgba(255, 255, 255, 0.84);
  --text: #15202b;
  --muted: #51606e;
  --line: rgba(21, 32, 43, 0.12);
  --ok: #0f9d58;
  --warn: #b26a00;
  --err: #d93025;
  --up: #1976d2;
  --down: #ef6c00;
  --shadow: 0 10px 30px rgba(17, 23, 42, 0.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  background: linear-gradient(135deg, var(--bg0), var(--bg1));
  min-height: 100vh;
}

.bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 15% 20%, rgba(17, 119, 204, 0.12), transparent 35%),
    radial-gradient(circle at 85% 10%, rgba(15, 157, 88, 0.1), transparent 40%);
}

.container { width: min(1200px, 95vw); margin: 1.5rem auto 3rem; position: relative; }
.hero h1 { margin: 0; font-size: clamp(1.4rem, 3vw, 2.1rem); }
.hero p { color: var(--muted); margin-top: 0.4rem; }

.summary-grid {
  margin: 1rem 0 1.2rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 0.8rem;
}

.metric, .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}

.metric { padding: 0.9rem; }
.metric .k { color: var(--muted); font-size: 0.9rem; }
.metric .v { margin-top: 0.25rem; font-weight: 700; }

.card-grid { display: grid; gap: 0.75rem; }
.card { padding: 0.75rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.45rem; margin-bottom: 0.55rem; }
.card h3 {
  margin: 0;
  font-size: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.22rem;
  min-width: 0;
}
.rate-pill {
  display: inline-block;
  margin-left: 0;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #0f4d8a;
  background: rgba(25, 118, 210, 0.12);
  border: 1px solid rgba(25, 118, 210, 0.22);
  vertical-align: middle;
}

.status-badge {
  display: inline-block;
  padding: 0;
  line-height: 1;
  font-size: 1.22rem;
  font-weight: 500;
  position: relative;
  cursor: pointer;
  user-select: none;
  background: transparent;
  border: none;
}
.status-badge.ok { color: #17a34a; }
.status-badge.warn { color: #d28a00; }
.status-badge.err { color: #e13a2f; }
.status-badge::after {
  content: attr(data-status-text);
  position: absolute;
  right: -2px;
  top: calc(100% + 6px);
  font-size: 0.72rem;
  color: #fff;
  background: rgba(17, 23, 42, 0.92);
  border-radius: 6px;
  padding: 0.2rem 0.4rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
@media (hover: hover) and (pointer: fine) {
  .status-badge:hover::after {
    opacity: 1;
    transform: translateY(0);
  }
}
.status-badge.show-tip::after {
  opacity: 1;
  transform: translateY(0);
}

.err-line { margin: 0 0 0.5rem; color: var(--err); font-size: 0.82rem; }

.card-body {
  display: grid;
  grid-template-columns: 1.05fr 1.4fr;
  gap: 0.55rem;
  align-items: start;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 0.45rem;
}
.quick-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.38rem 0.5rem;
  background: rgba(255,255,255,0.7);
}
.quick-grid span { color: var(--muted); display: block; font-size: 0.76rem; line-height: 1.2; }
.quick-grid b { display: block; margin-top: 0.1rem; font-size: 0.86rem; line-height: 1.2; }

.viz-col {
  display: grid;
  gap: 0.45rem;
}
.viz-shell { min-width: 0; }
.viz-shell-head { display: none; }
.viz-shell-body { min-width: 0; }

.chart-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.35rem 0.45rem 0.28rem;
  background: rgba(255,255,255,0.7);
}
.chart-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 0.78rem; margin-bottom: 0.18rem; }
.chart-actions { display: inline-flex; gap: 0.35rem; }
.chart-echart { width: 100%; height: 170px; }
.legend { display: flex; gap: 0.8rem; color: var(--muted); font-size: 0.75rem; margin-top: 0.15rem; }
.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; margin-right: 0.28rem; }
.dot.up { background: var(--up); }
.dot.down { background: var(--down); }

.history-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255,255,255,0.7);
}
.history-head { padding: 0.35rem 0.5rem; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 0.78rem; }
.history-table-scroll {
  max-height: 132px;
  overflow: auto;
}
.history-wrap table { width: 100%; border-collapse: collapse; font-size: 0.76rem; }
.history-wrap th, .history-wrap td { padding: 0.3rem 0.5rem; text-align: left; border-bottom: 1px solid rgba(21,32,43,0.07); }
.history-wrap tbody tr:last-child td { border-bottom: none; }

.btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.86);
  color: var(--text);
  border-radius: 8px;
  padding: 0.14rem 0.46rem;
  font-size: 0.72rem;
  cursor: pointer;
}
.btn:hover { background: rgba(255,255,255,1); }

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 32, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}
.modal-mask[hidden] { display: none !important; }
.modal-panel {
  width: min(860px, 96vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.96);
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 0.98rem; }
.modal-body { overflow: auto; padding: 0.5rem 0.8rem 0.8rem; }
.btn-close { min-width: 56px; }

@media (max-width: 920px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .card-body { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .card { padding: 0.62rem; }
  .card-head { gap: 0.35rem; }
  .card h3 { font-size: 0.92rem; line-height: 1.25; }
  .rate-pill { font-size: 0.68rem; }
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
  }
  .quick-grid > div { padding: 0.32rem 0.42rem; }
  .quick-grid span { font-size: 0.72rem; }
  .quick-grid b { font-size: 0.81rem; }
  .viz-shell-head { display: flex; justify-content: flex-end; margin-bottom: 0.28rem; }
  .viz-shell .btn { font-size: 0.7rem; padding: 0.12rem 0.42rem; }
  .viz-shell .viz-shell-body {
    max-height: 1200px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease;
  }
  .viz-shell.collapsed .viz-shell-body {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
  }
}
