:root {
  --topbar: #6d8381;
  --hero: #c6dcdd;
  --blue: #00417e;
  --link: #0062b6;
  --green: #12b215;
  --line: #c7cfd4;
  --text: #030303;
  --muted: #647074;
  --paper: #fff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: #fff;
  color: var(--text);
  font-family: Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 18px;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.wrap {
  width: min(1760px, calc(100% - 176px));
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.topbar {
  background: var(--topbar);
  color: #edf8fb;
}

.topbar-inner {
  display: grid;
  grid-template-columns: 360px 460px 1fr;
  align-items: center;
  gap: 28px;
  min-height: 92px;
}

.logo {
  display: flex;
  align-items: center;
  width: max-content;
}

.logo-main {
  color: #ffffff;
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 0;
  text-shadow: 0 2px 8px rgba(0, 52, 92, 0.34);
}

.logo-sub {
  border-left: 3px solid #e8eeee;
  padding-left: 12px;
  color: #f0f7f7;
  font-size: 18px;
  font-style: italic;
  font-weight: 800;
  line-height: 1.05;
  text-shadow: 1px 1px 0 #333;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr 136px;
  gap: 18px;
  align-items: center;
}

.search-form input {
  width: 100%;
  height: 48px;
  border: 0;
  background: rgba(239, 247, 247, 0.72);
  padding: 0 14px;
  outline: 0;
}

.search-form button,
.upload-form button,
.order-form button,
.proof-form button,
.ship-form button,
.section-head button,
.admin-order-actions button {
  height: 46px;
  border: 0;
  border-radius: 7px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0;
  color: #e6faff;
  font-size: 20px;
  text-shadow: 0 0 16px rgba(0, 52, 92, 0.8);
}

.nav-links a {
  padding-inline: 12px;
  border-right: 2px solid rgba(238, 250, 252, 0.85);
}

.nav-action {
  border: 0;
  border-right: 2px solid rgba(238, 250, 252, 0.85);
  padding: 0 12px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-shadow: inherit;
}

.nav-links a:last-child,
.nav-action:last-child {
  border-right: 0;
}

.filter-hero {
  min-height: 285px;
  background:
    linear-gradient(90deg, rgba(198, 220, 221, 0.98) 0%, rgba(198, 220, 221, 0.9) 58%, rgba(198, 220, 221, 0.18) 100%),
    radial-gradient(circle at 82% 34%, rgba(255, 242, 198, 0.8) 0 42px, transparent 45px),
    radial-gradient(circle at 87% 42%, rgba(229, 95, 102, 0.75) 0 56px, transparent 59px),
    radial-gradient(circle at 78% 62%, rgba(245, 238, 193, 0.75) 0 50px, transparent 54px),
    var(--hero);
  background-position: center;
  background-size: cover;
}

.filter-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 28px;
  padding: 20px 0 18px;
}

.filter-table {
  display: grid;
  gap: 18px;
  color: var(--blue);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.35;
}

.filter-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: baseline;
}

.filter-line strong {
  color: #000;
}

.text-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 17px;
}

.text-option {
  border: 0;
  padding: 0 3px;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-weight: 800;
}

.text-option.active {
  background: #a6cfec;
  color: #000;
}

.hero-tools {
  align-self: start;
  justify-self: end;
  display: flex;
  gap: 10px;
  padding-top: 8px;
}

.upload-bg,
.hero-tools button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  border: 1px solid rgba(0, 65, 126, 0.28);
  border-radius: 4px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--blue);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.upload-bg input {
  display: none;
}

.admin-login-panel,
.upload-panel,
.orders-panel {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 30px;
  align-items: center;
  padding: 20px 0 10px;
}

.copyright-note {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(320px, 1fr);
  gap: 28px;
  align-items: start;
  padding: 22px 0 6px;
  border-bottom: 1px solid #edf0f2;
}

.copyright-note h1 {
  margin: 0 0 8px;
  color: #123d48;
  font-size: 24px;
}

.copyright-note p {
  margin: 0;
  color: #435257;
  font-size: 15px;
  line-height: 1.7;
}

.copyright-actions {
  border-left: 4px solid var(--green);
  padding-left: 16px;
}

.copyright-actions strong {
  display: block;
  margin-bottom: 5px;
  color: #174c1b;
  font-size: 17px;
}

.admin-login-panel[hidden],
.upload-panel[hidden],
.orders-panel[hidden],
.admin-strip[hidden],
.admin-only[hidden] {
  display: none;
}

.admin-login-panel {
  border-bottom: 1px solid #edf0f2;
}

.admin-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  border: 1px solid #b8d7c0;
  border-radius: 6px;
  padding: 12px 14px;
  background: #eef9ef;
  color: #145319;
  font-size: 15px;
}

.admin-strip button,
.admin-login-form button {
  height: 38px;
  border: 0;
  border-radius: 5px;
  padding: 0 16px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
}

.admin-login-form {
  display: grid;
  grid-template-columns: minmax(220px, 360px) 120px;
  gap: 10px;
}

.admin-login-form input {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 10px;
}

.upload-panel h1,
.orders-panel h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.upload-panel p,
.orders-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.upload-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  align-items: stretch;
}

.upload-form input,
.upload-form select,
.upload-form textarea,
.order-form input,
.order-form textarea,
.proof-form textarea,
.ship-form input,
.ship-form textarea {
  height: 42px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 10px;
  background: #fff;
}

.upload-form textarea,
.order-form textarea,
.proof-form textarea,
.ship-form textarea {
  resize: vertical;
  min-height: 42px;
  padding-top: 8px;
}

#uploadDesc,
#deliveryText {
  grid-column: span 2;
}

#deliveryText {
  min-height: 84px;
}

.file-field,
.rights-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 10px;
  background: #fff;
  color: #435257;
  font-size: 14px;
}

.file-field input {
  flex: 1;
  height: auto;
  min-width: 0;
  border: 0;
  padding: 0;
}

.rights-check input {
  width: 16px;
  height: 16px;
  min-width: 16px;
}

.pager-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  padding: 22px 0 44px;
  font-size: 22px;
}

.pager-bar button,
.pager-bar input {
  height: 45px;
  min-width: 76px;
  border: 1px solid #c7cbd0;
  border-radius: 7px;
  background: #f8f8f8;
  color: #000;
}

.pager-bar button.active {
  color: #000;
  font-weight: 800;
  text-decoration: underline;
}

.pager-bar button.next {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.pager-bar button:disabled {
  color: #bcc0c7;
}

.pager-bar label {
  margin-left: 12px;
}

.pager-bar input {
  width: 52px;
  min-width: 52px;
  margin: 0 4px;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  gap: 36px 40px;
  padding-bottom: 54px;
}

.book-card {
  min-width: 0;
}

.cover {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  aspect-ratio: 0.72;
  border: 1px solid #c4c4c4;
  overflow: hidden;
  background: #e7e7e7;
  cursor: pointer;
}

.cover canvas,
.cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.score {
  position: absolute;
  right: 6px;
  bottom: 4px;
  color: #ff6a00;
  font-size: 24px;
  font-weight: 900;
  text-shadow: 1px 1px 0 #fff, -1px -1px 0 #fff;
}

.watermark {
  position: absolute;
  left: 8px;
  bottom: 9px;
  color: #29aebc;
  font-size: 16px;
  font-style: italic;
  font-weight: 800;
  text-shadow: 1px 1px 0 #fff;
}

.book-title {
  display: block;
  margin-top: 8px;
  color: var(--link);
  font-size: 18px;
  line-height: 1.3;
}

.book-author {
  margin-top: 5px;
  color: #000;
  font-size: 17px;
  line-height: 1.35;
}

.book-meta {
  color: #666;
  font-size: 13px;
}

.book-price {
  margin-top: 6px;
  color: #174c1b;
  font-size: 17px;
  font-weight: 800;
}

.empty {
  grid-column: 1 / -1;
  padding: 52px 0;
  color: var(--muted);
  text-align: center;
}

.detail-dialog {
  width: min(1040px, calc(100% - 28px));
  border: 0;
  padding: 26px;
}

.detail-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.close-dialog {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 30px;
}

.detail-content {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
}

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

.detail-cover {
  aspect-ratio: 0.72;
  border: 1px solid #ccc;
  overflow: hidden;
}

.detail-cover canvas,
.detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.promo-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.promo-strip img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.detail-actions a,
.detail-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 14px;
  background: #f7f9fa;
  color: var(--blue);
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
}

.detail-actions .primary-download {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.detail-notice {
  border-left: 4px solid #12b215;
  padding-left: 12px;
  color: #245129;
  line-height: 1.7;
}

.detail-price {
  color: #174c1b;
  font-size: 24px;
  font-weight: 900;
}

.order-box {
  margin-top: 18px;
  border-top: 1px solid #e6e6e6;
  padding-top: 16px;
}

.order-box h3 {
  margin: 0 0 10px;
}

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

.order-form textarea,
.proof-form textarea,
.ship-form textarea {
  grid-column: 1 / -1;
  min-height: 74px;
}

.order-result {
  margin-top: 12px;
}

.order-created {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 14px;
  align-items: start;
  border: 1px solid #d7e5d9;
  border-radius: 6px;
  padding: 12px;
  background: #f6fbf7;
}

.wechat-qr {
  width: 150px;
  height: 150px;
  object-fit: contain;
  border: 1px solid var(--line);
  background: #fff;
}

.qr-empty {
  border: 1px dashed var(--line);
  padding: 12px;
  color: var(--muted);
  font-size: 14px;
}

.proof-form,
.order-status {
  grid-column: 1 / -1;
}

.delivery-note {
  white-space: pre-wrap;
  border: 1px solid #d7e5d9;
  border-radius: 4px;
  padding: 10px;
  background: #fff;
  color: #174c1b;
  font: inherit;
}

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

.error-text {
  color: #b21d1d;
}

.section-head {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.orders-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
}

.order-card {
  border: 1px solid #d7dde0;
  border-radius: 6px;
  padding: 14px;
  background: #fff;
}

.order-card-main {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 16px;
}

.order-card h3 {
  margin: 0 0 8px;
  color: #123d48;
}

.order-card p {
  margin: 4px 0;
}

.proof-link img,
.proof-empty {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #f7f9fa;
}

.proof-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
}

.ship-form {
  margin-top: 12px;
}

.admin-order-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-order-actions button[data-order-action="rejectPayment"] {
  background: #9d3333;
}

.footer {
  border-top: 1px solid #e6e6e6;
  color: #777;
  font-size: 14px;
}

.footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 0;
}

@media (max-width: 1200px) {
  .wrap {
    width: min(100% - 32px, 1760px);
  }

  .topbar-inner,
  .filter-layout,
  .copyright-note,
  .admin-login-panel,
  .upload-panel,
  .orders-panel {
    grid-template-columns: 1fr;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .hero-tools {
    justify-self: start;
  }

  .upload-form,
  .admin-login-form,
  .order-form,
  .proof-form,
  .ship-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .book-grid {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
  }
}

@media (max-width: 700px) {
  body {
    font-size: 16px;
  }

  .topbar-inner {
    gap: 14px;
    padding: 14px 0;
  }

  .logo-main {
    font-size: 34px;
  }

  .search-form,
  .upload-form,
  .admin-login-form,
  .order-form,
  .proof-form,
  .ship-form {
    grid-template-columns: 1fr;
  }

  #uploadDesc,
  #deliveryText,
  .order-form textarea,
  .proof-form textarea,
  .ship-form textarea,
  .proof-form,
  .order-status {
    grid-column: 1;
  }

  .nav-links {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 8px;
    font-size: 16px;
  }

  .filter-table {
    font-size: 17px;
  }

  .filter-line {
    display: block;
  }

  .text-options {
    display: inline-flex;
    margin: 2px 0 10px;
  }

  .pager-bar {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 24px;
    font-size: 16px;
  }

  .pager-bar button,
  .pager-bar input {
    min-width: 58px;
    height: 38px;
  }

  .book-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 26px 18px;
  }

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

  .order-created,
  .order-card-main {
    grid-template-columns: 1fr;
  }

  .wechat-qr,
  .proof-link img,
  .proof-empty {
    width: 180px;
    height: 180px;
  }
}
