:root {
  --ink: #20242b;
  --muted: #6b7280;
  --line: #d9dee8;
  --paper: #f7f8f5;
  --panel: #ffffff;
  --navy: #1c355e;
  --green: #2f6b5f;
  --red: #b42318;
  --amber: #a16207;
  --shadow: 0 18px 50px rgba(31, 45, 61, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

body {
  margin: 0;
  min-height: 100vh;
}

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

a:hover {
  text-decoration: underline;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  padding: 0 42px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid var(--navy);
  color: var(--navy);
  font-weight: 800;
  letter-spacing: 0;
}

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

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
}

.inline-form {
  display: inline;
  margin: 0;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--navy);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.hero-band {
  display: block;
  padding: 54px 7vw 42px;
  background:
    linear-gradient(135deg, rgba(28, 53, 94, 0.95), rgba(47, 107, 95, 0.9)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.08) 0 1px, transparent 1px 36px);
  color: #fff;
}

.hero-copy h1,
.section-heading h1,
.section-heading h2,
.admin-heading h1,
.result-panel h1 {
  margin: 0;
  letter-spacing: 0;
}

.hero-copy h1 {
  font-size: clamp(34px, 6vw, 62px);
  line-height: 1;
}

.hero-copy p {
  max-width: 720px;
  color: rgba(255, 255, 255, 0.86);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-band .eyebrow {
  color: #d7ece6;
}

.content-shell,
.admin-shell,
.result-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 36px auto 56px;
}

.content-shell.narrow,
.result-shell {
  width: min(720px, calc(100% - 32px));
}

.form-panel,
.filter-panel,
.result-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 30px;
}

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(14, 23, 38, 0.58);
}

.modal-backdrop[hidden] {
  display: none;
}

.requirements-dialog {
  width: min(860px, 100%);
  max-height: min(82vh, 760px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  padding: 28px;
}

.requirements-header {
  border-bottom: 2px solid var(--navy);
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.requirements-header h2 {
  margin: 0;
  font-size: 28px;
}

.requirements-list {
  margin: 0 0 22px;
  padding-left: 24px;
}

.requirements-list li {
  margin-bottom: 14px;
  line-height: 1.75;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--navy);
  padding-bottom: 16px;
}

.section-heading p,
.readonly-panel p,
.file-field small,
.site-footer,
.data-table small {
  color: var(--muted);
}

.field,
.field-group,
.consent-box,
.readonly-panel {
  display: block;
  margin: 0 0 22px;
}

.field > span,
.field-group-title > span,
.consent-box legend,
.readonly-panel > span,
.filter-panel label span {
  display: block;
  color: var(--ink);
  font-weight: 700;
  margin-bottom: 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 11px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(28, 53, 94, 0.13);
}

textarea {
  resize: vertical;
}

.field em {
  float: right;
  color: var(--muted);
  font-style: normal;
  font-weight: 500;
}

.field em.over {
  color: var(--red);
}

.field-group-title,
.admin-heading,
.table-toolbar,
.pagination,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.authors-list {
  display: grid;
  gap: 12px;
}

.author-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  align-items: end;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fbfcfb;
}

.consent-box {
  border: 1px solid rgba(180, 35, 24, 0.4);
  padding: 18px;
  background: #fff7f6;
}

.consent-box p,
.warning-text {
  color: var(--red);
  font-weight: 700;
}

.consent-box label {
  display: block;
  margin: 10px 0 0;
}

.consent-box input {
  width: auto;
  margin-right: 8px;
}

.cnki-box p {
  color: var(--ink);
  font-weight: 500;
}

.cnki-option {
  padding: 12px 0;
  border-top: 1px solid rgba(180, 35, 24, 0.18);
}

.cnki-option p {
  margin: 6px 0 0 25px;
  color: var(--muted);
}

.cnki-box .warning-text {
  color: var(--red);
  font-weight: 800;
}

.upload-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.upload-status {
  color: var(--muted);
  font-weight: 700;
}

.upload-status.success {
  color: var(--green);
}

.upload-status.error {
  color: var(--red);
}

.readonly-panel {
  padding: 16px;
  border-left: 4px solid var(--green);
  background: #f1f7f5;
}

.readonly-panel strong {
  display: block;
}

.primary-button,
.secondary-button,
.secondary-link,
.danger-ghost,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  padding: 0 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  background: var(--navy);
  color: #fff;
}

.primary-button:hover {
  color: #fff;
  text-decoration: none;
}

.primary-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.secondary-button,
.secondary-link {
  background: #fff;
  border-color: var(--line);
  color: var(--navy);
}

.secondary-link:hover,
.secondary-button:hover {
  text-decoration: none;
  border-color: var(--navy);
}

.danger-ghost {
  background: #fff;
  border-color: rgba(180, 35, 24, 0.3);
  color: var(--red);
}

.danger-button {
  background: var(--red);
  color: #fff;
}

.danger-button:hover {
  color: #fff;
  text-decoration: none;
}

.danger-ghost:disabled {
  color: var(--muted);
  border-color: var(--line);
  cursor: not-allowed;
}

.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 14px;
}

.form-message {
  min-height: 24px;
  margin: 8px 0 16px;
  font-weight: 700;
}

.form-message.error {
  color: var(--red);
}

.form-message.success {
  color: var(--green);
}

.progress {
  display: grid;
  grid-template-columns: 1fr 54px;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.progress-bar {
  height: 12px;
  background: #e5e9ef;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 0.2s ease;
}

.result-panel {
  text-align: center;
}

.paper-code {
  display: inline-block;
  margin: 12px 0 18px;
  padding: 12px 22px;
  border: 2px solid var(--navy);
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0;
  background: #f7f8f5;
}

.admin-shell {
  width: min(1320px, calc(100% - 32px));
}

.admin-heading {
  margin-bottom: 22px;
}

.filter-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
  padding: 20px;
}

.filter-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.table-toolbar {
  margin: 18px 0 10px;
}

.table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--line);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: #eef2f0;
  color: #334155;
  font-size: 13px;
}

.title-cell {
  min-width: 260px;
}

.actions-cell {
  display: flex;
  gap: 8px;
  min-width: 126px;
}

.delete-dialog {
  width: min(620px, 100%);
}

.delete-target {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fbfcfb;
}

.captcha-code {
  display: inline-flex;
  min-width: 84px;
  justify-content: center;
  margin-left: 8px;
  padding: 3px 8px;
  border: 1px solid rgba(28, 53, 94, 0.25);
  background: #eef2f0;
  color: var(--navy);
  letter-spacing: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  font-weight: 700;
}

.status.ok,
.status.completed {
  color: var(--green);
  border-color: rgba(47, 107, 95, 0.35);
  background: #f1f7f5;
}

.status.waiting,
.status.processing {
  color: var(--amber);
  border-color: rgba(161, 98, 7, 0.35);
  background: #fff8eb;
}

.status.failed {
  color: var(--red);
  border-color: rgba(180, 35, 24, 0.35);
  background: #fff7f6;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 38px !important;
}

.pagination {
  justify-content: center;
  margin-top: 22px;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 42px;
  background: #fff;
}

@media (max-width: 900px) {
  .site-header,
  .top-nav,
  .section-heading,
  .admin-heading,
  .field-group-title,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .site-header {
    padding: 16px;
  }

  .top-nav {
    width: 100%;
    gap: 10px;
  }

  .hero-band {
    grid-template-columns: 1fr;
    padding: 38px 20px;
  }

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

  .filter-panel {
    grid-template-columns: 1fr;
  }

  .form-panel,
  .filter-panel,
  .result-panel {
    padding: 20px;
  }
}
