:root {
  color-scheme: light;
  --bg: #f3f5f6;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --ink: #17212b;
  --muted: #66717d;
  --line: #dbe2e5;
  --teal: #0f766e;
  --teal-soft: #dff3ef;
  --orange: #c2410c;
  --orange-soft: #ffeadf;
  --slate: #334155;
  --red: #b42318;
  --green: #18794e;
  --radius: 8px;
  --shadow: 0 10px 28px rgba(23, 33, 43, 0.07);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(243, 245, 246, 0)),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  flex: 0 0 auto;
}

.brand h1,
.brand p,
.panel h2,
.panel p {
  margin: 0;
}

.brand h1 {
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: 0;
}

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

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-control {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.range-control button {
  min-width: 72px;
  padding: 7px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.range-control button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(23, 33, 43, 0.1);
}

.button-secondary {
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.button-secondary:hover,
.range-control button:hover {
  color: var(--teal);
}

.page-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 40px) 40px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  color: var(--muted);
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(24, 121, 78, 0.11);
}

.status-row.error .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.1);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 14px;
}

.kpi-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi-card {
  display: flex;
  flex-direction: column;
  min-height: 118px;
  padding: 16px;
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.kpi-value {
  margin-top: 10px;
  font-size: clamp(24px, 2vw, 32px);
  line-height: 1;
  letter-spacing: 0;
}

.kpi-note {
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
}

.panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-heading h2 {
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: 0;
}

.panel-heading p,
.panel-meta {
  color: var(--muted);
  font-size: 12px;
}

.panel-heading p {
  margin-top: 3px;
}

.chart-panel {
  margin-bottom: 14px;
}

.chart {
  width: 100%;
  height: 360px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.status-panel {
  grid-column: 1 / -1;
}

.list {
  display: grid;
  gap: 10px;
}

.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 34px;
}

.list-label {
  position: relative;
  min-width: 0;
  padding: 5px 8px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-label::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--share, 0) * 1%);
  background: var(--teal-soft);
  z-index: 0;
}

.list-label span {
  position: relative;
  z-index: 1;
}

.list-value {
  min-width: 70px;
  color: var(--slate);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.status-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.status-code {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
}

.status-code.ok {
  background: #e5f5ec;
  color: var(--green);
}

.status-code.redirect {
  background: #e8effb;
  color: #1d4ed8;
}

.status-code.client {
  background: var(--orange-soft);
  color: var(--orange);
}

.status-code.server {
  background: #fee4e2;
  color: var(--red);
}

.status-count {
  display: block;
  margin-top: 10px;
  font-size: 22px;
  font-weight: 780;
  line-height: 1;
}

.status-share {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  color: var(--muted);
  font-size: 12px;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-shell {
  width: min(400px, 100%);
}

.login-panel {
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(23, 33, 43, 0.11);
}

.login-brand {
  margin-bottom: 8px;
}

.login-panel label {
  color: var(--slate);
  font-size: 13px;
  font-weight: 700;
}

.login-panel input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--ink);
  outline: none;
}

.login-panel input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.login-panel button {
  height: 44px;
  border: 0;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-weight: 750;
}

.login-panel button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .toolbar {
    width: 100%;
    justify-content: space-between;
  }

  .kpi-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .chart {
    height: 300px;
  }

  .footer {
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .page-shell {
    padding-inline: 12px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-card {
    min-height: 108px;
    padding: 13px;
  }

  .range-control {
    flex: 1;
  }

  .range-control button {
    min-width: 0;
    flex: 1;
  }

  .list-row {
    grid-template-columns: minmax(0, 1fr) 58px;
  }
}
