:root {
  color-scheme: light;
  --bg: #eef2f4;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --ink: #172026;
  --muted: #66727b;
  --line: #d9e0e4;
  --line-strong: #b8c4cb;
  --blue: #2563eb;
  --green: #0f7b5f;
  --amber: #b7791f;
  --red: #b42318;
  --shadow: 0 18px 48px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "Noto Sans SC", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #f8fafb;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #172026;
  color: #fff;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.side-nav {
  padding: 14px;
}

.nav-section {
  margin: 18px 8px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  margin: 2px 0;
  padding: 10px 12px;
  border-radius: 8px;
  color: #31404a;
  text-decoration: none;
  font-size: 14px;
}

.nav-link:hover,
.nav-link.active {
  background: #e4ecf2;
  color: #101820;
}

.nav-link.active {
  box-shadow: inset 3px 0 0 var(--blue);
}

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

.content {
  min-width: 0;
  padding: 28px 34px 56px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto 22px;
  max-width: 1240px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.18;
}

h2 {
  margin: 0 0 14px;
  font-size: 20px;
}

h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

p {
  margin: 0;
  line-height: 1.72;
}

.top-actions {
  display: flex;
  align-items: end;
  gap: 12px;
}

.search-box {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-box input {
  width: 260px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: #273640;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.view {
  max-width: 1240px;
  margin: 0 auto;
}

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

.metric {
  min-height: 112px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
  line-height: 1;
}

.metric small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
}

.panel {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.panel-head p {
  color: var(--muted);
  font-size: 14px;
}

.rule-panel {
  padding: 20px;
}

.meaning-box {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  padding: 18px;
  border: 1px solid #b7decf;
  border-radius: 8px;
  background: #eefaf5;
}

.meaning-box strong {
  color: #0f684f;
  font-size: 15px;
}

.meaning-box span {
  color: #20313d;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.65;
}

.score-band-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.score-band-list article {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.score-band-list strong {
  display: block;
  margin-bottom: 8px;
  color: #1849a9;
}

.score-band-list span {
  color: #40505b;
  font-size: 14px;
  line-height: 1.65;
}

.formula-box {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  padding: 16px;
  border: 1px solid #bdd2f8;
  border-radius: 8px;
  background: #eef5ff;
}

.formula-box strong {
  color: #1849a9;
  font-size: 14px;
}

.formula-box span {
  color: #243746;
  font-weight: 800;
  line-height: 1.7;
}

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

.rule-grid article {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.rule-grid h3 {
  margin: 0 0 8px;
}

.rule-grid p {
  color: #40505b;
  font-size: 14px;
}

.rule-note {
  margin-top: 12px;
  padding: 14px;
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: #fff7e6;
  color: #5d4214;
  font-size: 14px;
  line-height: 1.7;
}

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

.project-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.rank {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #dce8fb;
  color: #1849a9;
  font-weight: 800;
}

.repo-link {
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}

.repo-link:hover {
  color: var(--blue);
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf2f6;
  color: #46545d;
  font-size: 12px;
  font-weight: 700;
}

.pill.green {
  background: #dff3ec;
  color: #0f684f;
}

.pill.amber {
  background: #fff0d1;
  color: #8a5a10;
}

.score {
  min-width: 72px;
  text-align: right;
  color: var(--green);
  font-weight: 800;
}

.summary {
  margin-top: 8px;
  color: #40505b;
  font-size: 14px;
}

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

.report-hero {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.report-hero-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.report-hero .date {
  margin: 0;
  color: var(--green);
  font-weight: 800;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #20313d;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
}

.button.primary {
  border-color: #1f5fd1;
  background: var(--blue);
  color: #fff;
}

.report-panel {
  overflow: hidden;
}

.daily-card-list {
  display: grid;
  gap: 14px;
}

.daily-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafb 100%);
}

.daily-card-head {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.daily-title {
  min-width: 0;
}

.daily-title h3 {
  font-size: 18px;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 16px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.score-grid > div {
  min-height: 82px;
  padding: 14px;
  background: #fff;
}

.score-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.score-grid strong {
  display: block;
  margin-top: 9px;
  color: var(--green);
  font-size: 26px;
  line-height: 1;
}

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

.daily-sections section,
.daily-extra-grid section {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.daily-sections h4,
.daily-extra h4 {
  margin: 0 0 8px;
  color: #20313d;
  font-size: 14px;
}

.daily-sections p,
.daily-sections li,
.daily-extra p,
.daily-extra li {
  color: #40505b;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.daily-extra {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.daily-extra summary {
  cursor: pointer;
  padding: 13px 14px;
  color: #20313d;
  font-size: 14px;
  font-weight: 800;
}

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

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

.detail-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.detail-block h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.detail-block p,
.detail-block li {
  color: #40505b;
  font-size: 14px;
}

.topic-list,
.risk-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.topic-list li,
.risk-list li {
  padding: 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.risk-list li {
  color: var(--red);
}

.empty {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 14px 14px;
  }

  .nav-section {
    display: none;
  }

  .report-nav {
    display: flex;
    gap: 8px;
  }

  .nav-link {
    flex: 0 0 auto;
    width: auto;
  }

  .content {
    padding: 22px 16px 42px;
  }

  .topbar,
  .report-hero-top {
    display: grid;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .search-box input {
    width: 100%;
  }

  .stats-grid,
  .score-band-list,
  .rule-grid,
  .score-grid,
  .two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .daily-sections,
  .daily-extra-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  h1 {
    font-size: 25px;
  }

  .stats-grid,
  .score-band-list,
  .rule-grid,
  .score-grid,
  .two-col {
    grid-template-columns: 1fr;
  }

  .project-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .score {
    grid-column: 2;
    text-align: left;
  }

  .daily-card {
    padding: 14px;
  }

  .daily-card-head {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
  }
}
