:root {
  color-scheme: light;
  --background: #f7fafc;
  --panel: #ffffff;
  --panel-soft: #fafafa;
  --foreground: #111111;
  --muted: #777777;
  --muted-2: #a3a3a3;
  --border: #e7e7e7;
  --border-strong: #d8d8d8;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #b8870d;
  --warning-soft: #fef3c7;
  --danger: #e11d48;
  --danger-soft: #ffe4e6;
  --chip: #f4f4f5;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 18px 48px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--foreground);
  font-family:
    "Instrument Sans",
    "Geist",
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  background:
    linear-gradient(rgba(17, 17, 17, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 17, 17, 0.03) 1px, transparent 1px),
    linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
  background-size: 48px 48px, 48px 48px, auto;
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  width: min(1280px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 70px;
}

.brand,
.nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand {
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.brand-name {
  color: #262626;
  font-size: 18px;
  font-weight: 820;
  letter-spacing: 0.08em;
}

.brand-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
}

.theme-dot {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(350px, 420px);
  gap: 24px;
  align-items: center;
  min-height: 240px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.hero-copy h1 {
  display: grid;
  gap: 8px;
  margin: 0;
}

.hero-copy h1 span {
  color: #050505;
  font-size: clamp(46px, 5vw, 76px);
  font-weight: 880;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.hero-copy h1 strong {
  color: #7a7a7a;
  font-size: clamp(42px, 4.6vw, 70px);
  font-weight: 880;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.hero-text {
  max-width: 760px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.hero-side {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-content: center;
}

.topbar-metrics {
  display: contents;
}

.metric,
.stat-card,
.system-pill {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.metric,
.stat-card {
  min-height: 78px;
  padding: 12px 14px;
}

.metric-label,
.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-value,
.stat-card strong {
  display: block;
  margin-top: 5px;
  color: #111;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 18px;
}

.metric-good .metric-value {
  color: var(--success);
}

.metric-bad .metric-value {
  color: var(--danger);
}

.system-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  grid-column: span 3;
  justify-self: end;
}

.system-pill strong {
  color: #111;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.toolbar-left,
.toolbar-right,
.chip-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chip-list span,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  background: var(--chip);
  color: #71717a;
  font-weight: 720;
  cursor: pointer;
}

.chip-active,
.chip:hover {
  background: #111;
  color: #fff;
}

.select-wrap,
.search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

select,
input {
  min-width: 132px;
  border: 0;
  outline: 0;
  color: #111;
  background: transparent;
}

.search input {
  width: 220px;
}

input::placeholder {
  color: var(--muted-2);
}

.dashboard {
  display: grid;
}

.group-shell {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.group-shell::before {
  display: grid;
  grid-template-columns:
    minmax(150px, 1.05fr)
    minmax(96px, 0.58fr)
    minmax(260px, 1.55fr)
    minmax(74px, 0.45fr)
    minmax(86px, 0.55fr)
    minmax(84px, 0.52fr)
    minmax(120px, 0.75fr)
    minmax(270px, 1.55fr);
  align-items: center;
  min-height: 56px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
  color: #525252;
  font-size: 12px;
  font-weight: 760;
  content: "分组" "标识" "模型" "倍率" "状态" "可用率" "最后检测" "质量趋势";
}

.rows {
  display: grid;
}

.status-row {
  display: grid;
  grid-template-columns:
    minmax(150px, 1.05fr)
    minmax(96px, 0.58fr)
    minmax(260px, 1.55fr)
    minmax(74px, 0.45fr)
    minmax(86px, 0.55fr)
    minmax(84px, 0.52fr)
    minmax(120px, 0.75fr)
    minmax(270px, 1.55fr);
  align-items: center;
  min-height: 76px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
}

.status-row:nth-child(2n) {
  background: #fcfcfc;
}

.status-row:hover {
  background: #fafafa;
}

.status-row:last-child {
  border-bottom: 0;
}

.service-name,
.current-state,
.provider-tag {
  display: inline-flex;
  align-items: center;
}

.service-name {
  min-width: 0;
  gap: 9px;
}

.row-marker {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: #0ea5e9;
  transform: rotate(45deg);
  flex: 0 0 auto;
}

.service-copy {
  min-width: 0;
}

.name-main {
  overflow: hidden;
  color: #111;
  font-size: 15px;
  font-weight: 820;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.name-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.provider-tag {
  width: fit-content;
  gap: 7px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #ded7ff;
  border-radius: 8px;
  background: #f4f0ff;
  color: #4f3db6;
  font-size: 12px;
  font-weight: 780;
}

.provider-icon {
  display: block;
  width: 14px;
  height: 14px;
}

.model-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 52px;
  overflow: hidden;
}

.model-chip {
  display: inline-flex;
  max-width: 100%;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fafafa;
  color: #3f3f46;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-chip.muted {
  color: var(--muted);
}

.ratio-cell,
.availability,
.latest,
.trend-wrap {
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

.ratio-cell {
  color: #111;
  font-size: 13px;
  font-weight: 780;
}

.current-state {
  gap: 7px;
}

.state-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.1);
  flex: 0 0 auto;
}

.status-row.is-down .state-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.1);
}

.status-badge {
  color: #15803d;
  font-size: 13px;
  font-weight: 820;
}

.status-badge.danger {
  color: #be123c;
}

.availability {
  color: var(--success);
  font-size: 13px;
  font-weight: 820;
}

.status-row.is-warn .availability {
  color: var(--warning);
}

.status-row.is-down .availability {
  color: var(--danger);
}

.latest {
  display: grid;
  gap: 3px;
  color: #3f3f46;
  font-size: 11px;
}

.latest strong {
  color: var(--success);
  font-size: 11px;
}

.latest em {
  color: var(--muted);
  font-style: normal;
}

.trend-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.bar-grid {
  display: grid;
  grid-template-columns: repeat(32, minmax(4px, 1fr));
  gap: 4px;
  align-items: center;
}

.bar {
  height: 26px;
  border-radius: 999px;
  background: #ececec;
}

.bar.good {
  background: #22c55e;
}

.bar.slow {
  background: #d4a72c;
}

.bar.bad {
  background: #ef4444;
}

.bar.empty {
  background: #eeeeee;
}

.empty-state {
  padding: 64px 20px;
  text-align: center;
}

.empty-state h2 {
  margin: 0;
  color: #111;
  font-size: 18px;
}

.empty-state p {
  margin: 8px 0 0;
  color: var(--muted);
}

.hidden {
  display: none;
}

@media (max-width: 1080px) {
  .page-shell {
    width: min(100vw - 24px, 760px);
  }

  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-panel {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .hero-copy h1 span,
  .hero-copy h1 strong {
    font-size: clamp(38px, 10vw, 62px);
  }

  .hero-side {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .system-pill {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .group-shell::before {
    display: none;
  }

  .rows {
    gap: 12px;
    padding: 12px;
  }

  .status-row,
  .status-row:nth-child(2n) {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
  }

  .trend-wrap {
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  .bar-grid {
    grid-template-columns: repeat(28, minmax(5px, 1fr));
  }
}

@media (max-width: 620px) {
  .page-shell {
    width: min(100vw - 16px, 430px);
    padding-top: 10px;
  }

  .brand-name {
    font-size: 16px;
  }

  .hero-panel {
    padding: 16px;
  }

  .hero-side {
    grid-template-columns: 1fr;
  }

  .search,
  .search input,
  .select-wrap,
  select {
    width: 100%;
  }

  .bar {
    height: 12px;
  }
}
