:root {
  color-scheme: light;
  --bg: #f5f6f3;
  --surface: #ffffff;
  --surface-soft: #eef4f3;
  --ink: #18211f;
  --muted: #64706c;
  --line: #dce2df;
  --accent: #126d63;
  --accent-strong: #0a5049;
  --blue: #315c91;
  --amber: #9a6417;
  --danger: #a33a32;
  --shadow: 0 18px 42px rgba(24, 33, 31, 0.08);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 0 18px;
}

.brand-block h1 {
  margin: 4px 0 8px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.05;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button,
.link-button,
.tag-chip,
.paper-card {
  cursor: pointer;
}

.icon-button,
.resource-button,
.link-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.icon-button:hover,
.resource-button:hover,
.link-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.text-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.text-button:hover {
  background: var(--accent-strong);
  color: #ffffff;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.status-strip > div {
  min-height: 84px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.metric-label,
.deploy-note span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.status-strip strong {
  font-size: 24px;
  line-height: 1.1;
}

.deploy-note strong {
  color: var(--blue);
  font-size: 16px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(4, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
  background: #e9eeeb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 11px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.65;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 109, 99, 0.14);
}

.tag-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.tag-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  min-height: 32px;
  padding: 0 12px;
}

.tag-chip.active,
.tag-chip:hover {
  border-color: rgba(154, 100, 23, 0.35);
  background: #fff5e5;
  color: var(--amber);
}

.app-status {
  min-height: 34px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.app-status.error {
  color: var(--danger);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.library-column,
.detail-column {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.library-column {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.column-head h2 {
  margin: 0;
  font-size: 18px;
}

.link-button {
  background: transparent;
  min-height: 34px;
  padding: 0 10px;
  color: var(--accent);
}

.paper-list {
  overflow: auto;
  padding: 8px;
}

.paper-card {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  padding: 12px;
  margin: 0 0 6px;
  display: grid;
  gap: 7px;
}

.paper-card:hover {
  background: var(--surface-soft);
}

.paper-card.selected {
  background: #edf7f5;
  border-color: rgba(18, 109, 99, 0.32);
}

.paper-title {
  font-weight: 800;
  line-height: 1.35;
}

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

.paper-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.paper-tags i {
  font-style: normal;
  color: var(--blue);
  font-size: 12px;
}

.list-empty {
  padding: 20px 12px;
  color: var(--muted);
}

.paper-detail {
  padding: 22px;
}

.empty-state {
  min-height: 360px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  color: var(--ink);
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.detail-head h2 {
  margin: 6px 0 0;
  max-width: 960px;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.18;
  letter-spacing: 0;
}

.tier-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(49, 92, 145, 0.25);
  border-radius: 999px;
  background: #eef4fb;
  color: var(--blue);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.resource-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  min-height: 38px;
}

.resource-button:hover {
  background: var(--accent-strong);
  color: #ffffff;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.meta-grid div,
.review-grid section,
.summary-block,
.local-note,
.figures-block,
.pdf-viewer-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.meta-grid div {
  padding: 12px;
  min-width: 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

dd {
  margin: 0;
  line-height: 1.55;
  word-break: break-word;
}

.chip-section {
  margin: 16px 0;
}

.chip-section h3,
.summary-block h3,
.figures-block h3,
.local-note label {
  margin: 0 0 10px;
  font-size: 15px;
}

.chip-section div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip-section span {
  border-radius: 999px;
  background: #eff2ef;
  color: #34413d;
  padding: 7px 10px;
  font-size: 13px;
}

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

.review-grid section,
.summary-block,
.local-note,
.figures-block,
.pdf-viewer-block {
  padding: 15px;
}

.review-grid h3 {
  margin: 0 0 9px;
  color: var(--accent-strong);
  font-size: 16px;
}

.review-grid p,
.summary-block p,
.local-note p {
  margin: 0;
  color: #33413d;
  line-height: 1.75;
}

.summary-block {
  margin-bottom: 16px;
}

.pdf-viewer-block {
  margin: 0 0 18px;
}

.pdf-viewer-block .section-title-row a {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.pdf-viewer-block .section-title-row a:hover {
  text-decoration: underline;
}

.pdf-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.pdf-switcher button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  padding: 0 12px;
  cursor: pointer;
}

.pdf-switcher button.active,
.pdf-switcher button:hover {
  border-color: var(--accent);
  background: #edf7f5;
  color: var(--accent-strong);
}

.pdf-frame {
  width: 100%;
  height: min(78vh, 860px);
  min-height: 540px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

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

.section-title-row span {
  color: var(--muted);
  font-size: 13px;
}

.figure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

.figure-card {
  display: grid;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
}

.figure-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #f4f5f2;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
}

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

.local-note {
  margin-top: 16px;
}

.local-note label {
  display: block;
  font-weight: 800;
}

.local-note textarea {
  margin-bottom: 8px;
}

@media (max-width: 1000px) {
  .app-shell {
    width: min(100% - 20px, 900px);
    padding-top: 12px;
  }

  .app-header {
    display: grid;
  }

  .header-actions {
    justify-content: flex-start;
  }

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

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

  .search-box {
    grid-column: 1 / -1;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .library-column {
    position: static;
    max-height: none;
  }

  .paper-list {
    max-height: 420px;
  }

  .meta-grid,
  .review-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 14px, 620px);
  }

  .status-strip,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .detail-head {
    display: grid;
  }

  .tier-badge {
    justify-self: start;
  }

  .paper-detail {
    padding: 16px;
  }

  .pdf-frame {
    min-height: 420px;
    height: 70vh;
  }
}
