:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --side: #f8fafb;
  --surface: #ffffff;
  --surface-soft: #f7f9fa;
  --line: #e3e8ed;
  --line-strong: #d4dde5;
  --text: #22313a;
  --muted: #667680;
  --quiet: #8b99a3;
  --blue: #316f9f;
  --blue-soft: #eaf3f9;
  --green: #2f7b67;
  --green-soft: #e9f4f0;
  --amber: #8b6d35;
  --amber-soft: #f7f1e5;
  --shadow: 0 1px 2px rgba(32, 44, 54, 0.04);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  background: var(--side);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 750;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.brand-subtitle,
.muted-label,
.metric-label,
.metric-note,
.eyebrow {
  color: var(--muted);
}

.brand-subtitle {
  font-size: 12px;
  margin-top: 3px;
}

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

.nav-item {
  width: 100%;
  height: 38px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: #eef4f8;
  color: var(--blue);
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--line);
}

.muted-label {
  font-size: 12px;
}

.sidebar-time {
  font-size: 13px;
  margin-top: 5px;
  line-height: 1.4;
}

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

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

.eyebrow {
  font-size: 12px;
  letter-spacing: 0;
  margin-bottom: 6px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.15;
  font-weight: 720;
}

h2 {
  font-size: 15px;
  line-height: 1.3;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ghost-button,
.primary-button {
  height: 34px;
  border-radius: 7px;
  padding: 0 12px;
  cursor: pointer;
  border: 1px solid var(--line-strong);
}

.ghost-button {
  background: var(--surface);
  color: var(--muted);
}

.primary-button {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 14px;
}

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

.metric-grid.compact {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
}

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

.metric-tile {
  min-height: 102px;
  padding: 15px;
  display: grid;
  align-content: space-between;
}

.metric-label {
  font-size: 12px;
}

.metric-value {
  font-size: 24px;
  line-height: 1.1;
  font-weight: 760;
  color: #1d303b;
}

.metric-value.compact-value {
  font-size: 18px;
  line-height: 1.25;
}

.metric-note {
  font-size: 12px;
  line-height: 1.45;
}

.content-grid {
  display: grid;
  gap: 14px;
}

.two-col {
  grid-template-columns: 1.15fr 0.85fr;
}

.panel {
  padding: 16px;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  white-space: nowrap;
}

.chip.subtle {
  background: var(--surface-soft);
  color: var(--muted);
  border: 1px solid var(--line);
}

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

.note,
.timeline-body,
.report-section,
.theme-card,
.cycle-step {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.note {
  padding: 11px 12px;
  line-height: 1.55;
  color: #30414b;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.level {
  padding: 11px;
  border-radius: 8px;
  background: var(--surface-soft);
  min-height: 62px;
  border: 1px solid var(--line);
}

.level span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 7px;
}

.level strong {
  font-size: 17px;
}

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

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

.theme-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.theme-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.timeline-item {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 10px;
  align-items: start;
}

.timeline-time {
  color: var(--muted);
  font-size: 13px;
  padding-top: 2px;
}

.timeline-body {
  padding: 11px 12px;
  line-height: 1.55;
}

.cycle-steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.cycle-step {
  min-height: 108px;
  padding: 12px;
}

.cycle-step.active {
  border-color: #aacbe1;
  background: var(--blue-soft);
}

.cycle-step-title {
  font-weight: 700;
  margin-bottom: 7px;
}

.cycle-step-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: var(--surface);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  font-size: 13px;
  line-height: 1.35;
}

tr:last-child td {
  border-bottom: 0;
}

th {
  color: var(--muted);
  font-weight: 650;
  background: var(--surface-soft);
}

td {
  color: #2d3b44;
}

.pick-table {
  min-width: 960px;
}

.logic-cell {
  min-width: 220px;
  max-width: 320px;
  white-space: normal;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 120px;
}

.tag-list span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  white-space: nowrap;
}

.score-bar {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 8px;
  align-items: center;
}

.bar {
  height: 6px;
  border-radius: 999px;
  background: #e6edf2;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--blue);
  border-radius: inherit;
}

.report {
  display: grid;
  gap: 10px;
  line-height: 1.65;
}

.report-section {
  padding: 13px;
}

.report-section h3 {
  margin: 0 0 7px;
  font-size: 15px;
}

.report-section p {
  color: #33444f;
  white-space: pre-line;
}

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

.research-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.research-item h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.research-item p {
  color: #33444f;
  line-height: 1.5;
}

.research-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.research-meta span {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.open-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 7px;
  background: var(--blue);
  color: white;
  text-decoration: none;
  font-size: 13px;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
}

.masked .sensitive {
  color: var(--quiet);
}

.masked .sensitive::before {
  content: attr(data-mask);
}

.masked .sensitive span {
  display: none;
}

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

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .nav {
    display: flex;
    min-width: max-content;
  }

  .sidebar-foot {
    display: none;
  }

  .metric-grid,
  .metric-grid.compact,
  .two-col,
  .model-grid,
  .theme-strip,
  .cycle-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .main {
    padding: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .ghost-button,
  .primary-button {
    flex: 1;
  }

  .research-item {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .metric-grid.compact,
  .two-col,
  .model-grid,
  .theme-strip,
  .cycle-steps,
  .level-grid {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }
}
