:root {
  color-scheme: light;
  --bg: #edf2f7;
  --bg-accent: #f8fbf9;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-subtle: #f7fafc;
  --surface-strong: #eef4f7;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --line: #d7e0e8;
  --line-strong: #afbecd;
  --primary: #0f766e;
  --primary-strong: #0b5f59;
  --primary-soft: #e4f5f3;
  --accent: #9a5b00;
  --accent-soft: #fff4db;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --ok: #16803a;
  --shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 22px 52px rgba(15, 23, 42, 0.12);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.09), transparent 28%),
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 24%),
    linear-gradient(180deg, var(--bg-accent) 0, var(--bg) 340px),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 13px;
}

button,
input,
select {
  font: inherit;
}

button,
a.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  line-height: 1.2;
  padding: 0 11px;
  text-decoration: none;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

button:hover,
a.primary:hover {
  border-color: var(--line-strong);
  box-shadow: 0 7px 16px rgba(15, 23, 42, 0.08);
}

button:active,
a.primary:active {
  transform: translateY(1px);
}

button.primary,
a.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

button.primary:hover,
a.primary:hover {
  border-color: var(--primary-strong);
  background: var(--primary-strong);
}

button.secondary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

button.secondary:hover {
  border-color: #7a4700;
  background: #7a4700;
}

button.danger {
  border-color: rgba(180, 35, 24, 0.32);
  background: var(--danger-soft);
  color: var(--danger);
}

button.danger:hover {
  border-color: var(--danger);
  background: #ffe8e5;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

h2 {
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.25;
}

h3 {
  line-height: 1.35;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: none;
  margin: 0 auto;
  padding: 10px 14px 6px;
}

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

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

.hero-summary {
  display: none;
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.7;
}

.topbar h1 {
  font-size: 24px;
  letter-spacing: 0;
}

.connection {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: max-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.16);
}

.dot.ok {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(22, 128, 58, 0.14);
}

.dot.error {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.14);
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
  gap: 14px;
  max-width: none;
  margin: 0 auto;
  padding: 6px 14px 24px;
}

.sidebar,
.latestbar {
  position: sticky;
  top: 72px;
  display: grid;
  align-content: start;
  gap: 14px;
  max-height: calc(100vh - 84px);
  overflow: auto;
  scrollbar-width: thin;
}

.latestbar {
  gap: 0;
}

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

.content.detail-mode > :not(.detail-page) {
  display: none;
}

.panel,
.stat {
  border: 1px solid rgba(214, 222, 232, 0.92);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.panel {
  padding: 18px;
}

.sidebar .panel {
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
}

.latestbar .panel {
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
}

.panel > h2,
.section-title h2 {
  color: var(--text);
  font-weight: 800;
}

.field {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-subtle);
  color: var(--text);
  padding: 0 10px;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

input:hover,
select:hover {
  border-color: var(--line-strong);
  background: #fff;
}

input:focus,
select:focus {
  border-color: var(--primary);
  background: #fff;
  outline: 3px solid rgba(15, 118, 110, 0.13);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.button-row .danger {
  grid-column: 1 / -1;
}

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

#syncStatus {
  margin: 12px 0 0;
  border: 1px solid #dbe5ef;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff 0, var(--surface-subtle) 100%);
  color: var(--text-soft);
  line-height: 1.55;
  padding: 10px 12px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.stat {
  position: relative;
  display: grid;
  gap: 10px;
  overflow: hidden;
  min-height: 82px;
  padding: 15px 15px 13px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0, rgba(247, 250, 252, 0.92) 100%);
}

.stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--primary);
}

.stat-primary {
  background: #064e49;
  color: #fff;
  box-shadow: 0 18px 42px rgba(6, 78, 73, 0.34), inset 0 0 0 2px rgba(250, 204, 21, 0.72);
}

.stat-primary::before {
  width: 8px;
  background: #facc15;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.72);
}

.stat-primary strong {
  color: #fff;
  font-size: 30px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.34);
}

.stat:nth-child(2)::before {
  background: #2563eb;
}

.stat:nth-child(3)::before {
  background: var(--accent);
}

.stat:nth-child(4)::before {
  background: #7c3aed;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stat.stat-primary span {
  color: #ffffff;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.28);
}

.stat strong {
  overflow-wrap: anywhere;
  font-size: 23px;
  line-height: 1;
}

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

.section-title h2 {
  margin-bottom: 0;
}

.section-title .muted {
  margin-top: 1px;
  text-align: right;
}

.distribution-panel {
  display: grid;
  gap: 14px;
}

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

.collection-card {
  display: grid;
  gap: 11px;
  border: 1px solid #d7e5e3;
  border-radius: 14px;
  background:
    linear-gradient(135deg, #ffffff 0, #f7fbfb 58%, #edf7f6 100%);
  padding: 13px;
}

.collection-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.collection-card h3 {
  margin: 0;
  color: var(--primary-strong);
  font-size: 15px;
  font-weight: 800;
}

.collection-card header span {
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 999px;
  background: rgba(228, 245, 243, 0.78);
  color: var(--primary-strong);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding: 5px 7px;
}

.collection-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.collection-metrics div {
  min-width: 0;
  border: 1px solid #dbe6eb;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.74);
  padding: 8px;
}

.collection-metrics span,
.collection-progress span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.collection-metrics strong {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 7px 10px;
  align-items: center;
}

.collection-progress strong {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.collection-progress div {
  grid-column: 1 / -1;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8ed;
}

.collection-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary) 0, #2563eb 100%);
}

.distribution-compact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 10px;
  align-items: start;
}

.distribution-list {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 7px;
  min-width: 0;
}

.distribution-list h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.distribution-list h3::before {
  content: "";
  width: 4px;
  height: 14px;
  border-radius: 999px;
  background: var(--primary);
}

.chart-card {
  min-width: 0;
  border: 1px solid #dbe3ed;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0, var(--surface-subtle) 100%);
  padding: 13px;
}

.bar-chart {
  display: grid;
  gap: 7px;
}

.bar-chart.empty {
  border: 1px dashed #c4cfdb;
  border-radius: 14px;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 13px;
  padding: 16px;
  text-align: center;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(96px, 34%) minmax(0, 1fr) 50px;
  align-items: center;
  gap: 9px;
  min-height: 21px;
  font-size: 13px;
}

.bar-label {
  overflow: hidden;
  color: var(--text-soft);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.bar-fill {
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary) 0, #2563eb 100%);
}

.bar-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: right;
}

.compact-list {
  display: grid;
  gap: 4px;
  max-height: 238px;
  overflow: auto;
  padding-right: 3px;
  scrollbar-width: thin;
}

.compact-list.empty,
.year-timeline.empty {
  border: 1px dashed #c4cfdb;
  border-radius: 14px;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 13px;
  padding: 16px;
  text-align: center;
}

.compact-rank {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 58px;
  align-items: start;
  gap: 6px;
  overflow: hidden;
  min-height: 27px;
  border: 1px solid #dce6ee;
  border-radius: 9px;
  background: #fff;
  padding: 5px 7px 6px;
}

.compact-rank::before {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: #e4edf4;
}

.compact-rank i {
  position: absolute;
  inset: auto auto 0 0;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 0, #2563eb 100%);
}

.compact-rank span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 11px;
  font-weight: 900;
}

.compact-rank strong {
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.28;
  white-space: normal;
}

.compact-rank em {
  color: var(--accent);
  font-size: 11px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  text-align: right;
}

.journal-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  max-height: 238px;
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.journal-grid.empty,
.year-grid.empty {
  border: 1px dashed #c4cfdb;
  border-radius: 12px;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 13px;
  padding: 14px;
  text-align: center;
}

.journal-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: start;
  gap: 5px;
  min-height: 30px;
  border: 1px solid #dce6ee;
  border-radius: 8px;
  background: #fff;
  padding: 5px 6px;
}

.journal-cell strong {
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
}

.journal-cell em {
  color: var(--accent);
  font-size: 13px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 1.05;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  align-content: start;
  max-height: 238px;
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.year-pill {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 6px;
  border: 1px solid #dce6ee;
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}

.year-pill strong {
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.year-pill span {
  color: var(--accent);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.year-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13px, 1fr));
  align-items: end;
  gap: 4px;
  min-height: 86px;
  border: 1px solid #dce6ee;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0, #f7fafc 100%);
  padding: 8px 7px 7px;
}

.year-cell {
  display: grid;
  align-items: end;
  justify-items: center;
  gap: 4px;
  min-width: 0;
}

.year-cell span {
  display: block;
  width: 100%;
  max-width: 12px;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(180deg, #2563eb 0, var(--primary) 100%);
}

.year-cell strong {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.latest-list,
.article-list {
  display: grid;
  gap: 12px;
}

.latest-panel {
  padding: 14px;
}

.latest-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0, var(--surface-subtle) 100%);
  cursor: pointer;
  padding: 11px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.latest-item:hover {
  border-color: #aebccc;
  background: #fff;
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.latest-item:focus-visible,
.article:focus-visible {
  border-color: var(--primary);
  outline: 3px solid rgba(15, 118, 110, 0.16);
  outline-offset: 2px;
}

.latest-time {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
  align-items: center;
  border-right: 0;
  border-bottom: 1px solid #e0e7ef;
  padding: 0 0 7px;
}

.latest-time time {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.latest-time span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.latest-main {
  min-width: 0;
}

.latest-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 6px;
}

.latest-title-row h3 {
  overflow: visible;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  white-space: normal;
}

.latest-title-row span {
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
  white-space: nowrap;
}

.latest-meta,
.article-meta,
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.latest-meta {
  margin-top: 7px;
}

.latest-meta span {
  border-radius: 999px;
  background: #e8eef5;
  color: #526274;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 7px;
}

.latest-item p {
  margin: 5px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.55;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 14px;
}

.pager[hidden] {
  display: none;
}

.page-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.page-size select {
  width: 82px;
}

.article {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0, rgba(248, 250, 252, 0.92) 100%);
  cursor: pointer;
  padding: 16px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.article:hover {
  border-color: #aebccc;
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.article h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
}

.article-meta,
.tags {
  margin-bottom: 8px;
}

.pill {
  border: 1px solid #d8e1ec;
  border-radius: 999px;
  background: var(--surface-subtle);
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 8px;
}

.article p {
  margin-bottom: 9px;
  color: var(--text-soft);
  line-height: 1.58;
}

.article-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid #edf1f6;
  padding-top: 9px;
}

.score {
  overflow: hidden;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-page {
  overflow: hidden;
  padding: 0;
}

.detail-toolbar {
  position: relative;
  top: auto;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 14px 18px;
}

#detailBackBtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 800;
}

#detailBackBtn::before {
  content: "←";
  font-weight: 800;
}

#detailBackBtn:hover {
  border-color: var(--primary-strong);
  background: var(--primary);
  color: #fff;
}

.article-detail {
  display: grid;
  gap: 16px;
  background:
    linear-gradient(180deg, #f8fafc 0, #eef3f8 100%);
  padding: 18px;
}

.detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, #ffffff 0, #f6fbfb 58%, #edf7f6 100%);
  padding: 20px;
}

.detail-head-main {
  display: grid;
  align-content: start;
  gap: 9px;
  min-width: 0;
}

.detail-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-kicker span {
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  background: rgba(228, 245, 243, 0.78);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 5px 8px;
}

.detail-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 23px;
  font-weight: 800;
  line-height: 1.34;
}

.detail-authors {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: start;
}

.detail-actions button {
  white-space: nowrap;
}

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

.detail-span {
  grid-column: 1 / -1;
}

.detail-reading-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  align-items: start;
  gap: 12px;
}

.detail-block {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 16px;
}

.detail-block h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 2px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.detail-block h3::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 999px;
  background: var(--primary);
}

.detail-abstract {
  border-color: #d7e5e3;
  background: #fbfefd;
}

.detail-abstract p {
  border-left: 3px solid var(--primary);
  padding-left: 11px;
}

.detail-grid {
  display: grid;
  gap: 6px;
}

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

.detail-grid.detail-grid-cols .detail-kv-wide {
  grid-column: 1 / -1;
}

.detail-kv {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px;
  border: 1px solid #edf1f6;
  border-radius: 10px;
  background: var(--surface-subtle);
  padding: 7px 9px;
}

.detail-kv span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.6;
  white-space: nowrap;
}

.detail-kv strong {
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
  white-space: pre-wrap;
}

.detail-block p,
.fulltext-part p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.66;
  white-space: pre-wrap;
}

.detail-fulltext {
  min-width: 0;
}

.fulltext-part {
  border: 1px solid #d7e0ea;
  border-radius: 14px;
  background: #fff;
  padding: 15px;
}

.fulltext-part + .fulltext-part {
  margin-top: 2px;
}

.fulltext-part header,
.chunk header {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.fulltext-part header span,
.chunk header span {
  border-radius: 999px;
  background: #eef4f8;
  color: #536375;
  padding: 4px 7px;
}

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

.detail-raw-panel {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 92px);
  overflow: auto;
}

.chunk {
  border: 1px solid #dbe3ed;
  border-radius: 14px;
  background: #fff;
  padding: 12px;
}

.detail-chunk > div {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.raw-payload {
  margin-top: 10px;
}

.raw-payload summary {
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.raw-payload pre {
  overflow: auto;
  max-height: 360px;
  border: 1px solid #1e293b;
  border-radius: 6px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.55;
  padding: 12px;
  white-space: pre-wrap;
}

dialog {
  width: min(860px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  border: 0;
  border-radius: 18px;
  padding: 0;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.24);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.46);
}

.dialog-body {
  position: relative;
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 18px;
}

.icon-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.empty-state {
  border: 1px dashed #b9c4d1;
  border-radius: 14px;
  background: var(--surface-subtle);
  color: var(--muted);
  line-height: 1.6;
  padding: 18px;
  text-align: center;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .latestbar {
    position: static;
    grid-column: 1 / -1;
    max-height: none;
    overflow: visible;
  }

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

  .detail-head,
  .detail-reading-layout {
    grid-template-columns: 1fr;
  }

  .detail-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .detail-raw-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 18px;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 8px 16px 24px;
  }

  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .latestbar {
    position: static;
    max-height: none;
    overflow: visible;
  }

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

  .distribution-compact {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 620px) {
  body {
    font-size: 13px;
  }

  h1 {
    font-size: 24px;
  }

  .topbar {
    padding: 16px 14px 8px;
  }

  .layout {
    padding: 8px 12px 18px;
  }

  .panel {
    padding: 15px;
  }

  .hero-summary {
    font-size: 13px;
  }

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

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

  .distribution-compact {
    grid-template-columns: 1fr;
  }

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

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

  .section-title,
  .pager,
  .latest-item,
  .article-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .button-row {
    grid-template-columns: 1fr;
  }

  .button-row .danger {
    grid-column: auto;
  }

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

  .latest-time {
    border-right: 0;
    border-bottom: 1px solid #e6ebf2;
    padding-right: 0;
    padding-bottom: 8px;
  }

  .latest-title-row,
  .bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .bar-count {
    text-align: left;
  }

  .detail-grid {
    display: grid;
  }

  .detail-kv {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .article-detail,
  .detail-head,
  .detail-block {
    padding: 15px;
  }
}
