:root {
  --bg: #f6f8fa;
  --panel: #ffffff;
  --text: #24292f;
  --muted: #6a737d;
  --muted-2: #8c959f;
  --line: #d8dee4;
  --line-soft: #eaeef2;
  --blue: #0969da;
  --blue-soft: #ddf4ff;
  --nav: #f1f4f7;
  --shadow: 0 1px 2px rgba(27, 31, 36, 0.05);
  --gold: #9a6700;
  --gold-bg: #fff8c5;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, "Noto Sans SC", sans-serif;
  line-height: 1.7;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: 100vh;
  max-width: 100%;
  overflow: hidden;
  overflow-x: hidden;
}

.sidebar {
  position: relative;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 24px 18px 28px;
}

.brand {
  margin-bottom: 16px;
}

.brand h1 {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--blue);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.28;
  margin-bottom: 9px;
}

.book-mark {
  font-size: 18px;
  line-height: 1.25;
}

.brand p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.search-input {
  width: 100%;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  outline: none;
  padding: 9px 12px;
}

.search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.16);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 16px 0 17px;
}

.stat-box {
  min-height: 62px;
  border-radius: 6px;
  background: var(--bg);
  padding: 10px 11px;
}

.stat-box b {
  display: block;
  color: var(--blue);
  font-size: 17px;
  line-height: 1.2;
}

.stat-box span {
  color: #57606a;
  font-size: 12px;
}

.clear-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 1px solid #b6d0f7;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 18px;
  min-height: 34px;
  padding: 6px 12px;
}

.nav-section {
  margin-top: 18px;
}

.nav-section h2 {
  color: #57606a;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 9px;
}

.date-list,
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.calendar-wrap {
  display: grid;
  gap: 10px;
}

.calendar-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #57606a;
  font-size: 12px;
  font-weight: 850;
}

.calendar-nav-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #fff;
  color: var(--blue);
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.calendar-nav-btn:disabled {
  color: #c2c8d0;
  cursor: not-allowed;
}

.calendar-month {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  padding: 9px;
}

.calendar-title {
  color: #57606a;
  font-size: 12px;
  font-weight: 850;
  margin-bottom: 7px;
}

.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 4px;
}

.calendar-head {
  margin-bottom: 5px;
}

.calendar-head b {
  color: #8c959f;
  font-size: 10px;
  text-align: center;
}

.calendar-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 29px;
  border-radius: 6px;
  color: #57606a;
  font-size: 12px;
  font-weight: 750;
  position: relative;
}

a.calendar-day {
  background: #f1f8ff;
  color: var(--blue);
}

a.calendar-day:hover {
  background: var(--blue);
  color: #fff;
  text-decoration: none;
}

.calendar-day em {
  color: #8c959f;
  font-size: 8px;
  font-style: normal;
  line-height: 1;
}

.calendar-day.disabled {
  background: #f6f8fa;
  color: #c2c8d0;
  cursor: not-allowed;
}

.calendar-day.outside {
  opacity: 0.35;
}

.calendar-day.active {
  box-shadow: inset 0 0 0 2px var(--blue);
}

.calendar-empty {
  color: var(--muted);
  font-size: 12px;
}

.date-link,
.filter-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid #d0d7de;
  border-radius: 999px;
  background: #fff;
  color: #57606a;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  min-height: 25px;
  padding: 3px 9px;
}

.date-link.active,
.filter-chip.active {
  border-color: #80b9ff;
  background: var(--blue-soft);
  color: var(--blue);
}

.filter-chip b {
  color: var(--muted);
  font-size: 11px;
  margin-left: 3px;
}

.nav-tree {
  font-size: 13px;
}

.nav-pri {
  border-radius: 6px;
  margin-bottom: 5px;
  overflow: hidden;
}

.nav-pri-head {
  display: flex;
  align-items: center;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: var(--nav);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  min-height: 38px;
  padding: 7px 10px;
  text-align: left;
}

.nav-pri-head:hover {
  background: #e7f3ff;
  color: var(--blue);
}

.nav-pri-head.active {
  background: var(--blue);
  color: #fff;
}

.nav-pri-head.active .count {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.nav-arrow {
  color: #8c959f;
  font-size: 10px;
  margin-right: 7px;
  transition: transform 0.18s ease;
}

.nav-pri.expanded > .nav-pri-head .nav-arrow {
  transform: rotate(90deg);
}

.nav-pri-head .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-pri-head .count {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #eaeef2;
  color: #6e7781;
  font-size: 12px;
  font-weight: 800;
  min-width: 38px;
  padding: 2px 8px;
  text-align: center;
}

.nav-sub-list {
  display: none;
  padding: 4px 0 6px 24px;
}

.nav-pri.expanded > .nav-sub-list {
  display: block;
}

.nav-sub-link {
  display: flex;
  align-items: center;
  width: 100%;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #57606a;
  cursor: pointer;
  font-size: 12.5px;
  margin-bottom: 1px;
  padding: 5px 8px;
  text-align: left;
}

.nav-sub-link:hover,
.nav-sub-link.active {
  background: #f1f4f7;
  color: var(--blue);
}

.nav-sub-link .name {
  flex: 1;
}

.nav-sub-link .count {
  color: #8c959f;
  font-size: 11px;
  margin-left: 6px;
}

.content {
  height: 100vh;
  min-width: 0;
  max-width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 40px 46px 56px;
}

.page-header {
  border-bottom: 1px solid var(--line);
  margin-bottom: 38px;
  padding-bottom: 34px;
}

.hero-copy {
  max-width: 1320px;
}

.page-header h1 {
  color: var(--text);
  font-size: 30px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.22;
  margin-bottom: 19px;
}

.page-header p {
  color: #57606a;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.85;
  max-width: 1320px;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 24px;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid #d0d7de;
  border-radius: 16px;
  background: #fff;
  color: #57606a;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  min-height: 34px;
  padding: 6px 14px;
}

.hero-chip.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.hero-chip.hot {
  border-color: #d4a017;
  background: var(--gold-bg);
  color: var(--gold);
}

.hero-chip.soft {
  background: var(--nav);
}

.count-line {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin: -20px 0 28px;
}

.count-line #visibleCount {
  color: var(--blue);
  font-size: 16px;
}

#activeFilters {
  color: #8c959f;
  margin-left: 8px;
}

.paper-section {
  margin-bottom: 46px;
  min-width: 0;
  max-width: 100%;
}

.sub-sec {
  margin-top: 34px;
  min-width: 0;
  max-width: 100%;
}

.group-title + .sub-sec {
  margin-top: 0;
}

.group-title {
  border-bottom: 2px solid var(--blue);
  color: var(--blue);
  font-size: 27px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.25;
  margin: 0 0 28px;
  padding-bottom: 12px;
}

.group-title small {
  color: #6e7781;
  font-size: 14px;
  font-weight: 650;
  margin-left: 7px;
}

.sub-title {
  display: flex;
  align-items: center;
  border-left: 4px solid var(--blue);
  color: #24292f;
  font-size: 20px;
  font-weight: 850;
  margin: 0 0 22px;
  min-height: 42px;
  padding: 8px 0 8px 14px;
}

.sub-title small {
  color: #6e7781;
  font-size: 13px;
  font-weight: 600;
  margin-left: 10px;
}

.paper-list {
  display: grid;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
}

.paper-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 21px 24px 22px;
}

.paper-card:hover {
  box-shadow: 0 2px 8px rgba(27, 31, 36, 0.06);
}

.paper-title {
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.45;
  margin-bottom: 9px;
}

.paper-title a {
  color: inherit;
}

.paper-title a:hover {
  color: var(--blue);
}

.paper-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  margin-bottom: 7px;
}

.topic-badge,
.priority-pill,
.source-badge,
.paper-id,
.copy-prompt-btn {
  display: inline-flex;
  align-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  max-width: 100%;
  min-height: 24px;
  overflow-wrap: anywhere;
  white-space: normal;
  padding: 2px 10px;
  text-decoration: none !important;
}

.topic-badge.active {
  background: var(--blue);
  color: #fff;
}

.subarea-badge {
  background: #eaeef2;
  color: #57606a;
}

.priority-pill,
.source-badge {
  cursor: default;
  background: #eaeef2;
  color: #57606a;
}

.priority-high {
  background: #ffebe9;
  color: #cf222e;
}

.priority-medium {
  background: #fff8c5;
  color: #9a6700;
}

.priority-low {
  background: #dafbe1;
  color: #1a7f37;
}

.priority-unknown {
  background: #f0f0f0;
  color: #999;
}

.source-badge,
.paper-id,
.copy-prompt-btn {
  background: var(--nav);
  color: var(--muted);
}

.paper-id:hover,
.copy-prompt-btn:hover,
.copy-prompt-btn.copied {
  color: var(--blue);
  background: var(--blue-soft);
}

.copy-prompt-btn.copy-error {
  background: #ffebe9;
  color: #cf222e;
}

.paper-tag-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.hash-tag {
  border: 0;
  background: transparent;
  color: #6e7781;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 0 2px;
  text-align: left;
  white-space: normal;
}

.hash-tag:hover,
.hash-tag.active {
  color: var(--blue);
}

.paper-authors {
  color: var(--muted);
  font-size: 12px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paper-tldr {
  border-left: 3px solid #f9c513;
  border-radius: 0 4px 4px 0;
  background: #fffbea;
  color: #735c0f;
  font-size: 13px;
  line-height: 1.65;
  margin: 9px 0 11px;
  padding: 9px 13px;
}

.paper-tldr b {
  color: #5a4500;
}

.paper-abstract {
  border-left: 3px solid #e5e7eb;
  border-radius: 0 4px 4px 0;
  background: #f9fafb;
  color: #374151;
  font-size: 13px;
  line-height: 1.65;
  margin: 9px 0 11px;
  padding: 9px 13px;
}

.analysis-grid {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.analysis-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 18px;
  font-size: 14px;
  line-height: 1.75;
}

.analysis-label {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.analysis-label span {
  width: 17px;
  text-align: center;
}

.analysis-content {
  color: #24292f;
  min-width: 0;
  overflow-wrap: anywhere;
}

.analysis-content p,
.analysis-content ul {
  margin: 0;
}

.analysis-content ul {
  padding-left: 18px;
}

.abstract-block {
  margin-top: 14px;
}

.abstract-block summary {
  color: var(--blue);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.abstract-block p {
  border-left: 3px solid #d0d7de;
  color: #57606a;
  font-size: 13px;
  line-height: 1.75;
  margin-top: 9px;
  overflow-wrap: anywhere;
  padding: 10px 13px;
}

.analysis-error {
  border: 1px solid #ffd8d3;
  border-radius: 6px;
  background: #ffebe9;
  color: #cf222e;
  font-size: 12px;
  margin: 10px 0;
  padding: 8px 10px;
}

.empty-state {
  border: 1px dashed #d0d7de;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 36px;
  text-align: center;
}

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

.hidden {
  display: none !important;
}

.pagination-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  padding: 18px 0 8px;
}

.page-indicator {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid #b6d0f7;
  border-radius: 999px;
  background: #fff;
  color: var(--blue);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  min-height: 40px;
  padding: 7px 14px;
  box-shadow: 0 6px 18px rgba(27, 31, 36, 0.12);
}

.back-to-top.visible {
  display: inline-flex;
}

.back-to-top:hover {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

@media (max-width: 980px) {
  html,
  body {
    height: auto;
  }

  .shell {
    display: block;
    height: auto;
    overflow: visible;
  }

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

  .content {
    height: auto;
    overflow: visible;
    padding: 28px 18px 40px;
  }

  .page-header h1 {
    font-size: 26px;
  }

  .analysis-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
