:root {
  --bg: #031327;
  --panel: rgba(6, 35, 70, 0.78);
  --panel-strong: rgba(8, 46, 92, 0.88);
  --line: rgba(16, 150, 255, 0.74);
  --line-soft: rgba(60, 181, 255, 0.2);
  --text: #eaf5ff;
  --muted: #89a9c9;
  --cyan: #18d6ff;
  --blue: #2c78ff;
  --gold: #ffbb35;
  --green: #32e2a2;
  --purple: #a96cff;
  --danger: #ff6f8b;
  --shadow: 0 0 28px rgba(24, 145, 255, 0.17);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family:
    "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 50% -8%, rgba(33, 111, 219, 0.4), transparent 32rem),
    linear-gradient(180deg, #041b35 0%, var(--bg) 52%, #020b18 100%);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(14px, 1.25vw, 26px);
  position: relative;
  overflow-x: hidden;
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(19, 118, 230, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19, 118, 230, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(420px, 1.7fr) minmax(230px, 1fr);
  align-items: center;
  min-height: clamp(78px, 8vh, 104px);
  position: relative;
}

.topbar::after {
  content: "";
  position: absolute;
  left: 25%;
  right: 25%;
  bottom: 5px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #1aa7ff, transparent);
  box-shadow: 0 0 24px rgba(26, 167, 255, 0.8);
}

.brand,
.clock {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #c9ddf5;
  font-size: clamp(13px, 0.85vw, 16px);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: clamp(38px, 2.5vw, 48px);
  height: clamp(38px, 2.5vw, 48px);
  border-radius: 14px;
  color: white;
  font-weight: 800;
  background: linear-gradient(135deg, #1387ff, #0b4dab);
  box-shadow: inset 0 0 14px rgba(255, 255, 255, 0.28);
}

.title-wrap {
  text-align: center;
}

.title-wrap h1 {
  margin: 0;
  font-size: clamp(30px, 2.8vw, 52px);
  letter-spacing: 0;
  text-shadow: 0 0 18px rgba(100, 185, 255, 0.42);
}

.title-wrap p {
  margin: 8px 0 0;
  color: #6ed6ff;
  font-size: clamp(14px, 1vw, 18px);
}

.clock {
  justify-content: flex-end;
  color: #aebfda;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(132px, 1fr));
  gap: clamp(10px, 0.8vw, 16px);
  margin: clamp(16px, 1.4vw, 24px) 0 clamp(12px, 0.9vw, 18px);
}

.metric-card,
.panel,
.detail-hero {
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(17, 82, 147, 0.36), transparent 38%),
    var(--panel);
  box-shadow: var(--shadow), inset 0 0 22px rgba(22, 143, 255, 0.08);
  position: relative;
}

.metric-card::before,
.panel::before,
.detail-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(35, 209, 255, 0.16), transparent 30%);
  opacity: 0.65;
}

.metric-card {
  min-height: clamp(122px, 8.5vw, 152px);
  padding: clamp(16px, 1.25vw, 24px) clamp(14px, 1vw, 20px);
  border-radius: 8px;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.clickable {
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.metric-card:hover,
.clickable:hover,
.metric-card:focus-visible,
.clickable:focus-visible {
  outline: none;
  transform: translateY(-3px);
  border-color: #38e8ff;
  background:
    linear-gradient(145deg, rgba(26, 147, 246, 0.42), transparent 42%),
    var(--panel-strong);
}

.metric-top {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.metric-icon {
  flex: 0 0 auto;
  width: clamp(40px, 2.8vw, 52px);
  height: clamp(40px, 2.8vw, 52px);
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: clamp(22px, 1.5vw, 28px);
  background: rgba(24, 214, 255, 0.12);
  color: var(--cyan);
}

.metric-name {
  margin: 0;
  color: #dcecff;
  font-size: clamp(13px, 0.85vw, 16px);
}

.metric-value {
  margin: 10px 0 0;
  font-size: clamp(23px, 1.75vw, 34px);
  font-weight: 700;
}

.metric-unit {
  margin-left: 4px;
  color: #bccce4;
  font-size: 16px;
  font-weight: 400;
}

.metric-change {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: clamp(12px, 0.78vw, 14px);
}

.metric-change strong {
  color: var(--green);
  font-weight: 700;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
  gap: clamp(10px, 0.8vw, 16px);
}

.panel {
  display: flex;
  flex-direction: column;
  height: clamp(310px, 31vh, 380px);
  min-height: 0;
  padding: clamp(14px, 1vw, 20px);
  border-radius: 8px;
  overflow: hidden;
}

.panel-wide {
  grid-column: span 4;
}

.dashboard-grid .panel {
  grid-column: span 4;
}

.panel-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 32px;
  margin-bottom: 8px;
}

.panel h2 {
  margin: 0;
  font-size: clamp(17px, 1.05vw, 20px);
  font-weight: 700;
}

.panel h2 span {
  color: var(--muted);
  font-size: clamp(12px, 0.8vw, 15px);
  font-weight: 400;
}

.panel small {
  color: #79cfff;
  white-space: nowrap;
}

canvas,
.quality-list,
.table-wrap,
.donut-wrap,
.detail-chart-body,
.detail-chart-extra {
  position: relative;
  z-index: 1;
}

canvas {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
}

.detail-chart-body {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr);
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.detail-chart-body canvas {
  align-self: stretch;
  height: 100%;
  max-height: 100%;
  min-height: 0;
}

.detail-chart-panel.has-extra {
  height: clamp(490px, 48vh, 560px);
}

.detail-chart-panel.has-extra .detail-chart-body {
  grid-template-columns: minmax(300px, 0.9fr) minmax(320px, 1.1fr);
  align-items: stretch;
  gap: clamp(16px, 1.3vw, 26px);
}

.detail-chart-extra {
  display: none;
}

.detail-chart-panel.has-extra .detail-chart-extra {
  display: grid;
  align-content: center;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

.detail-chart-extra h3 {
  margin: 0;
  color: #eaf6ff;
  font-size: clamp(17px, 1vw, 20px);
}

.detail-chart-extra .extra-subtitle {
  margin: -6px 0 2px;
  color: var(--muted);
  font-size: 13px;
}

.share-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.share-item {
  display: grid;
  grid-template-columns: minmax(92px, 132px) 1fr auto;
  align-items: center;
  gap: 12px;
  color: #dcecff;
}

.share-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.share-item em {
  color: #eaf6ff;
  font-style: normal;
  font-weight: 700;
}

.share-bar {
  height: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(31, 130, 220, 0.22);
}

.share-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  box-shadow: 0 0 14px rgba(24, 214, 255, 0.48);
}

.extra-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.extra-summary-card {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(65, 182, 255, 0.35);
  border-radius: 6px;
  background: rgba(20, 92, 170, 0.22);
}

.extra-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.extra-summary-card strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: #eaf6ff;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(16px, 1.05vw, 20px);
}

.extra-note {
  padding: 10px 14px;
  border-left: 3px solid var(--green);
  border-radius: 4px;
  color: #cfe6ff;
  line-height: 1.6;
  background: rgba(37, 193, 150, 0.1);
}

.donut-wrap {
  display: grid;
  grid-template-columns: minmax(160px, 0.85fr) minmax(180px, 1.15fr);
  align-items: center;
  flex: 1 1 auto;
  min-height: 0;
  gap: 12px;
}

#orgDonutChart {
  align-self: stretch;
  height: 100%;
  min-height: 210px;
}

.legend {
  display: grid;
  gap: clamp(8px, 0.7vw, 12px);
  margin: 0;
  padding: 0;
  list-style: none;
  color: #d6eaff;
  font-size: clamp(12px, 0.75vw, 14px);
}

.legend li {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 8px;
}

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.quality-list {
  display: grid;
  align-content: center;
  flex: 1 1 auto;
  gap: clamp(10px, 1.05vw, 17px);
  padding-top: 4px;
}

.quality-item {
  display: grid;
  grid-template-columns: 118px 1fr 48px;
  gap: 16px;
  align-items: center;
}

.quality-name {
  color: #d7ebff;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(31, 130, 220, 0.25);
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  box-shadow: 0 0 14px rgba(24, 214, 255, 0.68);
}

.quality-value {
  text-align: right;
  color: white;
  font-size: 18px;
}

.table-wrap {
  flex: 1 1 auto;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  color: #d8eaff;
  font-size: clamp(12px, 0.78vw, 15px);
}

th,
td {
  padding: clamp(8px, 0.65vw, 11px) clamp(8px, 0.7vw, 12px);
  border-bottom: 1px solid rgba(120, 178, 230, 0.16);
  text-align: left;
  white-space: nowrap;
}

th {
  color: #d5edff;
  font-weight: 600;
  background: rgba(70, 153, 231, 0.12);
}

tfoot td {
  color: #eaf6ff;
  font-weight: 700;
  background: rgba(40, 127, 220, 0.16);
}

.footer-note {
  margin: 20px 0 0;
  color: rgba(194, 212, 236, 0.55);
  text-align: center;
}

.detail-view {
  padding-top: 20px;
}

.back-button {
  height: 40px;
  padding: 0 18px;
  margin: 0 0 14px;
  border: 1px solid rgba(48, 206, 255, 0.72);
  border-radius: 6px;
  color: #dff7ff;
  background: rgba(16, 97, 172, 0.5);
  cursor: pointer;
}

.back-button:hover {
  background: rgba(26, 150, 236, 0.55);
}

.detail-hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  min-height: 168px;
  padding: 28px 34px;
  border-radius: 8px;
  overflow: hidden;
}

.detail-hero h2 {
  position: relative;
  z-index: 1;
  margin: 6px 0 8px;
  font-size: clamp(30px, 3vw, 46px);
}

.detail-hero p {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #a9c7e6;
  line-height: 1.7;
}

.eyebrow {
  color: var(--cyan) !important;
  font-weight: 700;
}

.detail-score {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 132px;
  height: 132px;
  border: 1px solid rgba(68, 209, 255, 0.5);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(25, 214, 255, 0.18), rgba(20, 84, 164, 0.18));
}

.detail-score span {
  font-size: 42px;
  font-weight: 800;
  color: var(--green);
}

.detail-score small {
  margin-top: -18px;
  color: #9eb9d7;
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: clamp(10px, 0.8vw, 16px);
  margin: clamp(12px, 0.9vw, 16px) 0;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  align-items: stretch;
  gap: clamp(10px, 0.8vw, 16px);
}

.detail-chart-panel,
.insight-panel {
  height: clamp(360px, 38vh, 460px);
}

.detail-layout.org-layout .insight-panel {
  height: clamp(490px, 48vh, 560px);
}

.insight-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.insight-list li {
  padding: 14px 16px;
  border-left: 3px solid var(--cyan);
  border-radius: 4px;
  color: #d9ecff;
  line-height: 1.6;
  background: rgba(27, 105, 190, 0.2);
}

.insight-extra {
  position: relative;
  z-index: 1;
  display: none;
  margin-top: auto;
  padding-top: 16px;
}

.insight-extra:not(:empty) {
  display: grid;
  gap: 10px;
}

.insight-extra-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #eaf6ff;
  font-weight: 700;
}

.insight-extra-title small {
  color: var(--muted);
  font-weight: 400;
}

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

.action-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(65, 182, 255, 0.32);
  border-radius: 6px;
  background: rgba(20, 92, 170, 0.22);
}

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

.action-card strong {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  color: #eaf6ff;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.action-card em {
  display: block;
  margin-top: 6px;
  color: var(--green);
  font-style: normal;
  font-weight: 700;
  font-size: 13px;
}

.detail-table-panel {
  height: auto;
  min-height: 260px;
  margin-top: clamp(10px, 0.8vw, 16px);
}

.third-drillable {
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.third-drillable:hover,
.third-drillable:focus-visible {
  outline: none;
  transform: translateY(-2px);
  border-color: #38e8ff;
  background:
    linear-gradient(145deg, rgba(26, 147, 246, 0.42), transparent 42%),
    var(--panel-strong);
}

.third-drillable .panel-head small::after {
  content: " · 可展开";
  color: var(--green);
}

.third-view {
  padding-top: 20px;
}

.third-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.ghost-button {
  background: rgba(16, 97, 172, 0.22);
}

.third-hero {
  min-height: 150px;
}

.third-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: clamp(10px, 0.8vw, 16px);
  margin: clamp(12px, 0.9vw, 16px) 0;
}

.third-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(340px, 0.85fr);
  gap: clamp(10px, 0.8vw, 16px);
}

.third-chart-panel,
.third-action-panel {
  height: clamp(380px, 42vh, 500px);
}

.third-insight-list {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
}

.third-insight-item {
  padding: 14px 16px;
  border: 1px solid rgba(65, 182, 255, 0.28);
  border-left: 3px solid var(--cyan);
  border-radius: 6px;
  background: rgba(27, 105, 190, 0.2);
}

.third-insight-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.third-insight-item strong {
  display: block;
  margin-top: 5px;
  color: #eaf6ff;
  font-size: 17px;
}

.third-insight-item p {
  margin: 6px 0 0;
  color: #cfe6ff;
  line-height: 1.55;
}

.third-table-panel {
  height: auto;
  min-height: 260px;
  margin-top: clamp(10px, 0.8vw, 16px);
}

@media (max-width: 1500px) {
  .metric-grid {
    grid-template-columns: repeat(4, 1fr);
  }

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

  .dashboard-grid .panel,
  .panel-wide {
    grid-column: span 1;
  }

  .donut-wrap {
    grid-template-columns: minmax(160px, 0.8fr) minmax(180px, 1fr);
  }
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
    text-align: center;
  }

  .brand,
  .clock {
    justify-content: center;
    flex-wrap: wrap;
  }

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

  .detail-layout {
    grid-template-columns: 1fr;
  }

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

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

  .insight-panel {
    height: auto;
    min-height: 260px;
  }

  .detail-layout.org-layout .insight-panel {
    height: auto;
    min-height: 420px;
  }

  .detail-chart-panel.has-extra {
    height: auto;
    min-height: 520px;
  }

  .detail-chart-panel.has-extra .detail-chart-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app-shell {
    padding: 14px;
  }

  .metric-grid,
  .dashboard-grid,
  .detail-metrics,
  .detail-layout,
  .third-metrics {
    grid-template-columns: 1fr;
  }

  .dashboard-grid .panel,
  .panel-wide {
    grid-column: span 1;
  }

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

  .detail-hero {
    flex-direction: column;
  }

  .panel {
    height: 320px;
    padding: 16px;
  }

  .detail-chart-panel.has-extra {
    height: auto;
    min-height: 620px;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
  }

  #orgDonutChart {
    min-height: 170px;
  }

  .quality-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .quality-value {
    text-align: left;
  }

  .share-item {
    grid-template-columns: 1fr auto;
    gap: 6px;
  }

  .share-bar {
    grid-column: 1 / -1;
  }

  .extra-summary {
    grid-template-columns: 1fr;
  }

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

  .third-chart-panel,
  .third-action-panel {
    height: auto;
    min-height: 340px;
  }
}

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

  .metric-top {
    align-items: center;
  }

  .title-wrap h1 {
    font-size: 28px;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}
