:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-strong: #f0f3f6;
  --ink: #18212b;
  --muted: #637083;
  --line: #d9dee6;
  --teal: #087f8c;
  --teal-soft: #e6f4f5;
  --amber: #b7791f;
  --amber-soft: #fff3d6;
  --red: #b42318;
  --red-soft: #fee4df;
  --blue: #2456a6;
  --shadow: 0 12px 30px rgba(20, 32, 43, 0.08);
  --radius: 8px;
  font-family: "Microsoft YaHei", "PingFang SC", "Inter", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.sprite {
  display: none;
}

svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

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

.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 760;
}

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.icon-button,
.segmented button,
.drawer-close {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 13px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
}

.icon-button:not(.ghost) {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.filters {
  position: sticky;
  top: 83px;
  height: calc(100vh - 101px);
  overflow: auto;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px;
  background: var(--surface-strong);
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.filter-block {
  margin-top: 18px;
}

.block-title,
.panel-head,
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.block-title {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.segmented button {
  min-height: 34px;
  font-size: 13px;
  font-weight: 700;
}

.segmented .active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.check-list,
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-list button,
.chip-list button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  min-height: 30px;
  padding: 0 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.check-list button.active,
.chip-list button.active {
  background: var(--teal-soft);
  border-color: #9ed0d5;
  color: var(--teal);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

.workspace {
  min-width: 0;
}

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

.kpi {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 25px;
  line-height: 1;
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
  gap: 12px;
  margin-top: 12px;
}

.update-panel {
  margin-top: 12px;
}

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

.update-grid h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.event-list {
  display: grid;
  gap: 8px;
}

.event-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
}

.event-item strong {
  display: block;
  font-size: 13px;
}

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

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

.panel-head,
.table-toolbar {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel h2,
.table-toolbar h2 {
  margin: 0;
  font-size: 16px;
}

.panel-head span,
.table-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

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

.sector-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #f9fbfc);
  cursor: pointer;
}

.sector-item.active {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 1px var(--teal);
}

.sector-item:focus-visible,
.focus-card:focus-visible,
.icon-button:focus-visible,
.segmented button:focus-visible,
.check-list button:focus-visible,
.chip-list button:focus-visible,
.drawer-close:focus-visible {
  outline: 3px solid rgba(8, 127, 140, 0.28);
  outline-offset: 2px;
}

.sector-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.sector-item .bar {
  height: 7px;
  margin: 10px 0 8px;
  background: var(--surface-strong);
  border-radius: 999px;
  overflow: hidden;
}

.sector-item .bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--amber));
}

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

.focus-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.focus-card {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.rank {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--amber-soft);
  color: var(--amber);
  font-weight: 800;
}

.focus-card h3 {
  margin: 0;
  font-size: 14px;
}

.focus-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.score-badge {
  min-width: 42px;
  padding: 6px 8px;
  border-radius: var(--radius);
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 800;
  text-align: center;
}

.table-panel {
  margin-top: 12px;
  overflow: hidden;
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.sort-control select {
  height: 36px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 420px);
  min-height: 360px;
}

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

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f7fbfb;
}

.company-cell strong {
  display: block;
  font-size: 14px;
}

.company-cell span,
.muted,
.recall-cell span {
  color: var(--muted);
  font-size: 12px;
}

.recall-cell {
  display: grid;
  gap: 5px;
  min-width: 120px;
}

.recall-cell strong {
  color: var(--ink);
  font-size: 13px;
}

.tier-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  margin-top: 6px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}

.tier-1 {
  background: var(--amber-soft);
  color: var(--amber);
}

.tier-2 {
  background: var(--teal-soft);
  color: var(--teal);
}

.tier-3 {
  background: #e8eef9;
  color: var(--blue);
}

.tier-r {
  background: var(--red-soft);
  color: var(--red);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  margin-top: 6px;
  margin-left: 6px;
  padding: 0 8px;
  border-radius: 999px;
  background: #edf2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 750;
}

.score-stack {
  display: grid;
  gap: 5px;
  min-width: 72px;
}

.score-line {
  height: 6px;
  background: var(--surface-strong);
  border-radius: 999px;
  overflow: hidden;
}

.score-line i {
  display: block;
  height: 100%;
  background: var(--teal);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(8, 18, 28, 0.38);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 40;
  width: min(640px, 100vw);
  height: 100vh;
  overflow: auto;
  padding: 22px;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 45px rgba(20, 32, 43, 0.16);
  transform: translateX(100%);
  transition: transform 0.22s ease;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-close {
  position: sticky;
  top: 0;
  float: right;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: #fff;
}

.drawer h2 {
  margin: 8px 46px 4px 0;
  font-size: 26px;
}

.drawer-subtitle {
  color: var(--muted);
  margin: 0 0 18px;
}

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

.detail-metric,
.detail-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
}

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

.detail-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 19px;
}

.detail-section {
  margin-top: 12px;
}

.detail-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.detail-section p {
  margin: 0;
  color: #2d3846;
  line-height: 1.65;
  font-size: 14px;
}

.score-bars {
  display: grid;
  gap: 9px;
}

.score-row {
  display: grid;
  grid-template-columns: 92px 1fr 38px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.score-row .track {
  height: 8px;
  background: var(--surface-strong);
  border-radius: 999px;
  overflow: hidden;
}

.score-row .track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--amber));
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.source-links a {
  color: var(--teal);
  border: 1px solid #9ed0d5;
  border-radius: var(--radius);
  padding: 7px 9px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

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

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

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

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

@media (max-width: 680px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .app-shell {
    padding: 12px;
  }

  .kpi-grid,
  .update-grid,
  .sector-heatmap,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .top-actions {
    width: 100%;
  }

  .icon-button {
    flex: 1;
    justify-content: center;
  }

  .table-wrap {
    max-height: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .drawer {
    transition: none;
  }
}
