:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-muted: #eef3f7;
  --ink: #172033;
  --muted: #667085;
  --line: #d8e0ea;
  --blue: #2563eb;
  --teal: #0f766e;
  --green: #15803d;
  --amber: #b7791f;
  --red: #c2410c;
  --rose: #be123c;
  --violet: #6d28d9;
  --shadow: 0 18px 50px rgba(28, 40, 68, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 16px;
  background: #101827;
  color: #e7edf6;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 10px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #38bdf8, #34d399);
  color: #07111f;
  font-weight: 800;
}

.brand-title {
  font-weight: 750;
  letter-spacing: 0;
}

.brand-subtitle {
  margin-top: 2px;
  color: #9aa8ba;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 0;
  border-radius: 8px;
  color: #b8c4d6;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-item svg,
.icon-button svg,
.small-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.nav-item.active,
.nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.09);
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #d7dfeb;
}

.mini-label {
  color: #8da0b9;
  font-size: 12px;
}

.mini-value {
  margin-top: 5px;
  font-weight: 700;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

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

.status-pill,
.icon-button,
.small-button,
.chip {
  border-radius: 8px;
}

.status-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  white-space: nowrap;
}

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

.dot.ok {
  background: var(--green);
}

.dot.bad {
  background: var(--red);
}

.icon-button,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.icon-button span,
.small-button span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.icon-button {
  min-height: 38px;
  padding: 0 14px;
}

.small-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.icon-button.secondary,
.small-button.secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.icon-button:disabled,
.small-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.content {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.grid {
  display: grid;
  gap: 16px;
  min-width: 0;
}

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

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

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

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel.pad {
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header > *,
.metric > div {
  min-width: 0;
}

.panel-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

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

.metric {
  min-height: 126px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  margin-top: 8px;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.metric-sub {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.metric-accent {
  height: 4px;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--teal), #eab308);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
  min-width: 0;
}

.bar-list {
  display: grid;
  gap: 10px;
  padding: 16px 18px 18px;
}

.mini-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.mini-list h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 12px;
  background: #edf1f6;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  min-width: 2px;
  border-radius: 999px;
  background: var(--teal);
}

.bar-fill.negative {
  background: var(--rose);
}

.bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7f9fc;
  color: #415068;
  text-align: left;
  font-weight: 700;
  white-space: nowrap;
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tr:hover td {
  background: #fbfdff;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: #3d4a5f;
  font-size: 12px;
}

.chip.good {
  border-color: #bbf7d0;
  background: #ecfdf3;
  color: #166534;
}

.chip.warn {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.chip.bad {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #be123c;
}

.status-glossary .chip {
  min-height: 30px;
  font-weight: 650;
}

.glossary-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.glossary-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px 14px;
}

.glossary-term {
  color: var(--text);
  font-size: 14px;
  font-weight: 760;
}

.glossary-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  margin-top: 6px;
}

.signal-strong-up,
.signal-up {
  color: var(--green);
  font-weight: 750;
}

.signal-strong-down,
.signal-down {
  color: var(--rose);
  font-weight: 750;
}

.signal-flat {
  color: var(--muted);
  font-weight: 700;
}

.input-cell {
  width: 92px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  text-align: right;
  background: #fff;
}

.note-input {
  min-width: 210px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  resize: vertical;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search {
  width: min(360px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
}

.select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

.heatmap-wrap {
  overflow: auto;
  max-width: 100%;
  min-width: 0;
  max-height: 640px;
}

.heatmap {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.heatmap th:first-child,
.heatmap td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 164px;
  max-width: 164px;
  background: #fff;
  box-shadow: 1px 0 0 var(--line);
}

.heatmap th {
  top: 0;
  z-index: 3;
  min-width: 112px;
  max-width: 112px;
  white-space: normal;
  line-height: 1.25;
}

.heat-cell {
  min-width: 112px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: #132238;
}

.summary-box {
  min-height: 180px;
  padding: 18px;
  white-space: pre-wrap;
  line-height: 1.7;
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.06), rgba(20, 184, 166, 0.04)),
    #fff;
}

.radar-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.radar-card {
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.radar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.radar-score {
  margin-top: 18px;
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.radar-meter {
  height: 8px;
  margin-top: 12px;
  border-radius: 999px;
  background: #edf1f6;
  overflow: hidden;
}

.radar-meter span {
  display: block;
  height: 100%;
  width: 50%;
  transform-origin: left center;
}

.detail-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}

.sector-list {
  max-height: 720px;
  overflow: auto;
  padding: 8px;
}

.sector-list button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.sector-list button.active,
.sector-list button:hover {
  background: #eef5ff;
}

.quality {
  display: inline-flex;
  align-items: center;
  min-width: 44px;
  justify-content: center;
  padding: 3px 6px;
  border-radius: 6px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 700;
}

.timeline {
  display: grid;
  gap: 10px;
  padding: 16px 18px 18px;
}

.timeline-item {
  padding-left: 14px;
  border-left: 3px solid var(--line);
}

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

.timeline-text {
  margin-top: 4px;
  white-space: pre-wrap;
  line-height: 1.6;
}

.run-timeline {
  display: grid;
  gap: 0;
  padding: 8px 18px 18px;
}

.run-step {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
}

.run-step::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
}

.run-step:first-child::before {
  top: 18px;
}

.run-step:last-child::before {
  bottom: calc(100% - 18px);
}

.run-step-dot {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  margin-top: 3px;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.run-step.good .run-step-dot {
  border-color: var(--green);
  background: #dcfce7;
}

.run-step.warn .run-step-dot {
  border-color: var(--amber);
  background: #fef3c7;
}

.run-step.bad .run-step-dot {
  border-color: var(--rose);
  background: #ffe4e6;
}

.run-step-body {
  min-width: 0;
}

.run-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.run-step-time,
.run-step-detail,
.tech-details {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.info-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.info-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid #d9e4f2;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 12px;
}

.info-field-label {
  color: #64748b;
  font-weight: 700;
  white-space: nowrap;
}

.info-field-value {
  color: #25324a;
  overflow-wrap: anywhere;
}

.technical-code {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 1px 6px;
  border-radius: 6px;
  background: #eef3f7;
  color: #526174;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
}

.tech-grid {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 10px;
  margin-top: 6px;
  align-items: start;
}

.tech-grid span {
  color: #64748b;
}

.tech-grid code {
  overflow-wrap: anywhere;
}

.provider-readability-card {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #fed7aa;
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: #fff7ed;
  color: #70320f;
}

.provider-readability-card p {
  margin: 0;
  color: #7c4a15;
  line-height: 1.6;
}

.tech-details summary {
  cursor: pointer;
}

.tech-details code {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 6px;
  border-radius: 6px;
  background: #eef3f7;
  color: #415068;
}

.callout {
  padding: 14px 16px;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #eff6ff;
}

.callout.warn {
  border-color: #fed7aa;
  border-left-color: var(--amber);
  background: #fff7ed;
}

.code-block {
  margin: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  color: #dce7f7;
  font-size: 12px;
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1120px) {
  .grid.cols-4,
  .grid.cols-3,
  .radar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .topbar,
  .top-actions,
  .toolbar,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-header .small-button {
    width: 100%;
    white-space: normal;
  }

  .grid.cols-4,
  .grid.cols-3,
  .grid.cols-2,
  .radar-grid,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 16px;
  }

  .metric-value {
    font-size: 26px;
  }

  .bar-row {
    grid-template-columns: 104px minmax(0, 1fr) 56px;
  }
}
