:root {
  --bg: #f6f8fc;
  --panel: #ffffff;
  --panel-border: #d9e1ee;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #264b7a;
  --accent-soft: #eef4fb;
  --success: #e8f5ea;
  --danger: #fde8e8;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  --radius-lg: 18px;
  --radius-md: 12px;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

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

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

a:hover { text-decoration: underline; }

.mono { font-family: "Cascadia Mono", Consolas, monospace; }

.page-shell {
  width: min(1240px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 10px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

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

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 3.4vw, 3.3rem);
  line-height: 1.08;
  margin-bottom: 12px;
}

.lead {
  max-width: 72ch;
  color: var(--muted);
  line-height: 1.75;
}

.summary-card,
.panel,
.loading-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.summary-card {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.summary-item {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: #fbfcfe;
  border: 1px solid #e7edf6;
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.summary-item strong {
  display: block;
  line-height: 1.5;
  word-break: break-all;
}

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

.panel {
  padding: 18px;
}

.wide { grid-column: 1 / -1; }

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

.panel-head h2 {
  font-size: 1.12rem;
  font-weight: 600;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid #d8e3f3;
  color: var(--accent);
  font-size: 0.86rem;
  white-space: nowrap;
}

.pill.muted {
  background: #f5f7fa;
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.form-grid label,
.upload-row {
  display: grid;
  gap: 7px;
}

.form-grid label span {
  color: var(--muted);
  font-size: 0.88rem;
}

input, select, button { font: inherit; }

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #cfd9e7;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input:focus,
select:focus {
  border-color: #8ba6c9;
  box-shadow: 0 0 0 3px rgba(38, 75, 122, 0.09);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.btn.outline {
  background: #fff;
  border-color: #cfd9e7;
  color: var(--accent);
}

.btn:disabled {
  opacity: 0.72;
  cursor: wait;
}

.upload-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.notice-stack {
  display: grid;
  gap: 10px;
  margin: 14px 0 18px;
}

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

.notice.success {
  background: var(--success);
  border-color: #cde6d2;
}

.notice.error {
  background: var(--danger);
  border-color: #f4c7c7;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #dbe3ee;
  border-radius: 14px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

thead th {
  background: #f3f6fb;
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-size: 0.9rem;
}

th,
td {
  border-bottom: 1px solid #e5ebf3;
  padding: 10px 12px;
  vertical-align: top;
  line-height: 1.5;
}

tbody tr:hover {
  background: #fafcff;
}

.col-index,
.col-year,
.col-source {
  white-space: nowrap;
}

.col-index { width: 68px; }
.col-year { width: 76px; }
.col-source { width: 88px; }

.title-cell { max-width: 420px; }

.title {
  font-weight: 600;
  margin-bottom: 4px;
}

.authors-cell { color: #374151; }

.subtle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.empty-state {
  padding: 28px 8px 8px;
  color: var(--muted);
}

.empty-state h3 {
  margin-bottom: 8px;
  color: var(--text);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(246, 248, 252, 0.82);
  backdrop-filter: blur(3px);
  z-index: 1000;
}

.loading-overlay.visible {
  display: flex;
}

.loading-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  max-width: 420px;
}

.loading-card h3 {
  margin-bottom: 4px;
}

.loading-card p {
  color: var(--muted);
  line-height: 1.6;
}

.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid #d7e1ef;
  border-top-color: var(--accent);
  animation: spin 0.85s linear infinite;
  flex: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1040px) {
  .hero,
  .grid {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .upload-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 18px, 100vw);
    padding: 14px 0 24px;
  }

  .panel,
  .summary-card {
    padding: 14px;
  }

  h1 {
    font-size: 2rem;
  }
}
