:root {
  color-scheme: light;
  --bg: #f6f4ee;
  --ink: #17201c;
  --muted: #65716c;
  --line: #d9d5c9;
  --panel: #fffdf8;
  --panel-strong: #f0eee6;
  --teal: #176b68;
  --teal-soft: #d7ece8;
  --amber: #bc7a1a;
  --amber-soft: #f4e5c7;
  --rose: #a34055;
  --rose-soft: #f2dbe0;
  --shadow: 0 18px 45px rgba(30, 36, 32, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #202821;
  color: #f9f6ee;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 8px;
  background: #e9c46a;
  color: #202821;
  font-weight: 800;
}

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

.brand small {
  color: rgba(249, 246, 238, 0.68);
}

.week-list,
.source-block {
  display: grid;
  gap: 8px;
  margin-top: 34px;
}

.source-block p {
  margin: 0 0 4px;
  color: rgba(249, 246, 238, 0.58);
  font-size: 13px;
}

.week-link,
.source-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(249, 246, 238, 0.78);
}

.week-link:hover,
.source-link:hover,
.week-link.active {
  background: rgba(255, 255, 255, 0.11);
  color: #fffdf8;
}

.week-link small,
.source-link small {
  color: rgba(249, 246, 238, 0.52);
  white-space: nowrap;
}

.content {
  width: min(1280px, 100%);
  padding: 34px clamp(18px, 4vw, 56px) 64px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1.05;
  letter-spacing: 0;
}

.subtitle {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 0;
  color: var(--muted);
}

.subtitle span {
  color: #45514c;
}

.updated {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.72);
  font-size: 14px;
}

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

.metrics div {
  min-height: 92px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metrics span {
  display: block;
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}

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

.controls {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto 150px;
  gap: 12px;
  align-items: end;
  margin-top: 26px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(12px);
}

.search-box {
  display: grid;
  gap: 5px;
}

.search-box span {
  color: var(--muted);
  font-size: 13px;
}

.search-box input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.search-box input {
  padding: 0 12px;
}

select {
  padding: 0 10px;
}

.search-box input:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 107, 104, 0.13);
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(64px, auto);
  min-height: 42px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.filter-button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.filter-button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 8px rgba(30, 36, 32, 0.08);
}

.report-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.report-summary {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.report-summary p,
.report-summary h2,
.report-summary dl {
  margin: 0;
}

.report-summary p {
  color: var(--amber);
  font-weight: 800;
}

.report-summary h2 {
  margin-top: 4px;
  font-size: 20px;
  line-height: 1.25;
}

.report-summary dl {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.report-summary div {
  min-width: 0;
}

.report-summary dt {
  color: var(--muted);
  font-size: 13px;
}

.report-summary dd {
  margin: 2px 0 0;
  color: #33403a;
}

.paper-list {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.paper-card {
  padding: clamp(18px, 2.4vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.paper-card[hidden] {
  display: none;
}

.paper-head,
.rank-source {
  display: flex;
  align-items: center;
  gap: 8px;
}

.paper-head {
  justify-content: space-between;
  gap: 16px;
}

.rank,
.source-pill,
.section-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
}

.rank {
  background: #202821;
  color: #fffdf8;
}

.source-pill.arxiv {
  background: var(--teal-soft);
  color: var(--teal);
}

.source-pill.ssrn {
  background: var(--amber-soft);
  color: var(--amber);
}

.section-pill {
  background: var(--rose-soft);
  color: var(--rose);
}

.score {
  display: flex;
  align-items: baseline;
  gap: 2px;
  color: var(--teal);
}

.score strong {
  font-size: 28px;
  line-height: 1;
}

.score span {
  color: var(--muted);
}

.paper-card h2 {
  margin: 16px 0 8px;
  max-width: 980px;
  font-size: clamp(20px, 2.1vw, 28px);
  line-height: 1.22;
  letter-spacing: 0;
}

.authors {
  margin: 0;
  color: var(--muted);
}

.topics,
.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.topics span {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #45514c;
  background: #faf7ef;
  font-size: 13px;
}

.quick-links a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: #202821;
  color: #fffdf8;
  font-size: 13px;
  font-weight: 700;
}

.paper-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 24px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.paper-grid section {
  min-width: 0;
}

.paper-grid h3 {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 14px;
}

.paper-grid p {
  margin: 0;
  color: #33403a;
}

.empty-state,
.empty-page {
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.empty-state {
  margin-top: 20px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
    padding: 16px;
  }

  .week-list,
  .source-block {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    margin-top: 18px;
  }

  .content {
    padding: 24px 16px 48px;
  }

  .topbar {
    display: grid;
  }

  .metrics,
  .report-strip,
  .paper-grid {
    grid-template-columns: 1fr;
  }

  .controls {
    position: relative;
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .paper-head {
    align-items: flex-start;
  }

  .rank-source {
    flex-wrap: wrap;
  }
}
