:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fbff;
  --text: #172033;
  --muted: #6d7788;
  --line: #e5eaf2;
  --blue: #1f74ff;
  --blue-dark: #155bd4;
  --red: #df3f3f;
  --green: #179b63;
  --amber: #b7791f;
  --shadow: 0 16px 40px rgba(24, 42, 68, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(31, 116, 255, 0.06), transparent 280px),
    var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 18px;
  min-height: 72px;
  padding: 10px clamp(18px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: max-content;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--blue);
}

.brand-mark rect {
  fill: #eaf2ff;
  stroke: #bdd3ff;
  stroke-width: 1.5;
}

.brand-mark path:first-of-type {
  fill: currentColor;
}

.brand-mark path:last-of-type {
  fill: none;
  stroke: var(--red);
  stroke-linecap: round;
  stroke-width: 2.5;
}

.brand-text {
  display: grid;
  gap: 2px;
}

.brand-text strong {
  color: var(--red);
  font-size: 30px;
  line-height: 1.1;
}

.brand-slogan {
  margin-left: 22px;
  padding-bottom: 2px;
  color: var(--blue-dark);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  align-self: end;
}

.brand-text small {
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}

.data-time,
.data-source {
  padding: 7px 10px;
  border: 1px solid #d8e3f3;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.data-source {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #eef5ff;
  color: var(--blue-dark);
  border-color: #cfe0ff;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
}

.status-dot.online::before {
  background: var(--green);
}

.status-dot.offline::before {
  background: var(--red);
}

.status-dot.partial::before {
  background: var(--amber);
}

.ghost-button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--blue-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 16px clamp(16px, 4vw, 48px) 40px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 19px;
  line-height: 1.25;
  color: var(--red);
}

h2 {
  margin-bottom: 0;
  font-size: 19px;
  line-height: 1.25;
  color: var(--red);
}

h3 {
  margin-bottom: 12px;
  font-size: 15px;
}

.layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(28, 43, 65, 0.06);
}

.panel-heading,
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 14px 10px;
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(7, minmax(54px, 1fr));
  gap: 6px;
  padding: 0 14px 14px;
}

.heat-cell {
  min-height: 52px;
  padding: 7px;
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
}

.heat-cell strong {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
}

.rank-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0 14px 14px;
}

.flow-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0 0 0 20px;
}

.flow-list li {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.flow-list li:last-child {
  border-bottom: 0;
}

.rank-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

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

.positive {
  color: var(--red);
}

.negative {
  color: var(--green);
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef5ff;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.chip.hot {
  background: #fff1f1;
  color: var(--red);
}

.ranking-section {
  margin-bottom: 12px;
}

.control-stack {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.segmented,
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.segmented button,
.filter-row button {
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.segmented button.active,
.filter-row button.active {
  border-color: #b9d2ff;
  background: #edf4ff;
  color: var(--blue-dark);
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

th,
td {
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}

th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 700;
}

th.active {
  color: var(--blue-dark);
  background: #edf4ff;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: inherit;
  font-weight: inherit;
  text-align: left;
}

.name-link {
  color: var(--text);
  font-weight: 650;
  text-decoration: none;
}

.name-link:hover {
  color: var(--blue-dark);
  text-decoration: underline;
}

.name-link.strong {
  font-weight: 750;
}

.ranking-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.ranking-count {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.scale-cards,
.signal-list {
  padding: 0 18px 18px;
}

.signal-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.scale-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

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

.scale-card span {
  color: var(--muted);
  font-size: 12px;
}

.scale-card strong {
  display: block;
  margin-top: 8px;
  color: var(--red);
  font-size: 18px;
}

.signal-row strong {
  color: var(--red);
}

.practice-combos {
  padding: 0 14px 14px;
}

.combo-grid {
  display: grid;
  gap: 8px;
}

.combo-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.combo-title {
  display: inline-flex;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.link-title {
  color: var(--blue-dark);
}

.link-title:hover {
  text-decoration: underline;
}

.combo-holding {
  min-height: 28px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0 0;
}

.metric-row div {
  padding: 6px 8px;
  border: 1px solid #e1e8f4;
  border-radius: 6px;
  background: #fff;
}

.metric-row dt {
  color: var(--muted);
  font-size: 11px;
}

.metric-row dd {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
}

.metric-row dd.positive {
  color: var(--red);
}

.metric-row dd.negative {
  color: var(--green);
}

.email-form {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.email-form label {
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.email-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.email-row input {
  min-width: 0;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid #d8e3f3;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.email-row button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--red);
  border-radius: 6px;
  background: var(--red);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}

.form-feedback {
  min-height: 18px;
  margin: 0;
  color: var(--green);
  font-size: 12px;
}

.operation-note {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #fff8eb;
  color: #6d4d16;
  font-size: 12px;
  line-height: 1.45;
}

.operation-note strong {
  color: #8a5d13;
}

.empty {
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 13px;
}

.error-banner {
  padding: 12px 18px;
  border-radius: 6px;
  background: #fff1f1;
  color: var(--red);
  font-size: 13px;
  margin-bottom: 16px;
}

@media (max-width: 1120px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .heatmap {
    grid-template-columns: repeat(4, minmax(70px, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr;
    justify-items: stretch;
    min-width: 0;
  }

  .brand,
  .top-actions {
    justify-self: stretch;
  }

  .brand {
    width: auto;
  }

  .top-actions {
    flex-wrap: wrap;
    justify-content: center;
    min-width: 0;
    max-width: 100%;
  }

  .data-time,
  .data-source,
  .status-dot {
    white-space: normal;
  }

  .section-header,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .control-stack,
  .segmented,
  .filter-row {
    justify-content: flex-start;
    justify-items: start;
  }

  h1 {
    font-size: 24px;
  }

  .brand-text strong {
    font-size: 27px;
  }

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

  .scale-cards {
    grid-template-columns: 1fr;
  }

  .email-row {
    grid-template-columns: 1fr;
  }
}
