:root {
  --green: #00a57d;
  --green-dark: #009670;
  --green-soft: #e9fbf6;
  --red: #ff4b5f;
  --text: #5f6670;
  --title: #4b5563;
  --line: #eeeeee;
  --bg: #f7f7f7;
  --white: #ffffff;
  --danger: #c73535;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.page {
  min-height: 100vh;
}

.panel-header {
  height: 89px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--green);
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 190px;
}

.brand-mark {
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  font-size: 42px;
  line-height: 1;
}

.brand-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 30px;
  height: 100%;
}

.member-button,
.header-tool {
  border: 0;
  color: #fff;
  background: transparent;
  font-size: 18px;
}

.member-button {
  min-width: 104px;
  height: 58px;
  border-radius: 30px;
  background: #f30f20;
  font-weight: 700;
}

.header-tool {
  min-width: 62px;
  min-height: 58px;
  padding-top: 27px;
  position: relative;
}

.header-tool::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  width: 22px;
  height: 22px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
}

.frame-panel {
  min-height: calc(100vh - 89px);
  display: grid;
  grid-template-columns: 250px minmax(760px, 1fr) 300px;
  gap: 0;
  overflow: hidden;
}

.left-panel {
  min-height: calc(100vh - 89px);
  background: var(--green);
}

.sidebar-title {
  height: 73px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--green);
  background: #fff;
  font-size: 24px;
}

.menu-icon {
  width: 29px;
  height: 23px;
  position: relative;
  display: inline-block;
  border-top: 5px solid var(--green);
  border-bottom: 5px solid var(--green);
}

.menu-icon::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 4px;
  border-top: 5px solid var(--green);
}

.group-list {
  display: grid;
}

.group-item {
  height: 62px;
  padding: 0 18px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  color: #fff;
  background: var(--green);
  text-align: left;
  font-size: 18px;
  font-weight: 700;
}

.group-item:hover,
.group-item.is-active {
  color: var(--green);
  background: #fff;
}

.group-icon {
  font-size: 22px;
  line-height: 1;
}

.group-item strong {
  min-width: 24px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.8;
}

.main-panel {
  min-width: 0;
  padding: 0 14px 0 20px;
  background: var(--bg);
}

.top-category-tabs {
  min-height: 137px;
  padding: 12px 0 18px;
  display: flex;
  align-content: flex-start;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  overflow: hidden;
}

.top-tab {
  min-width: 70px;
  height: 53px;
  padding: 0 16px;
  border: 1px solid #ececec;
  color: var(--green);
  background: #fff;
  font-size: 18px;
  font-weight: 600;
}

.top-tab:hover,
.top-tab.is-active {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.search-strip {
  height: 73px;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.search-box {
  width: 398px;
  max-width: 48vw;
  position: relative;
}

.search-box input {
  width: 100%;
  height: 42px;
  padding: 0 46px 0 18px;
  border: 1px solid #dddddd;
  border-radius: 22px;
  outline: none;
  background: #fafafa;
}

.search-box input:focus {
  border-color: var(--green);
  background: #fff;
}

.search-icon {
  position: absolute;
  right: 17px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  border: 2px solid #c7c7c7;
  border-radius: 50%;
}

.search-icon::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: -6px;
  width: 9px;
  border-top: 2px solid #c7c7c7;
  transform: rotate(45deg);
}

.status-text {
  color: var(--green);
  font-size: 18px;
}

.status-text strong {
  color: var(--red);
  font-weight: 400;
}

.table-panel {
  margin-top: 10px;
  min-height: calc(100vh - 360px);
  overflow: auto;
  border: 1px solid var(--line);
  background: #fff;
}

.table-head,
.file-row {
  min-width: 1180px;
  display: grid;
  grid-template-columns: 72px 86px 92px 170px minmax(360px, 1fr) 78px 78px 104px 78px 92px;
  align-items: center;
}

.table-head {
  min-height: 83px;
  color: var(--title);
  border-bottom: 1px solid var(--line);
  font-size: 18px;
}

.table-head div,
.file-row > div {
  min-width: 0;
  padding: 0 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.table-head div:nth-child(5),
.file-row > div:nth-child(5) {
  text-align: left;
}

.file-row {
  min-height: 62px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  font-size: 18px;
}

.file-row:hover {
  background: #fbfffd;
}

.pdf-type {
  color: var(--red);
}

.file-code,
.file-name {
  color: var(--green);
}

.file-name {
  cursor: pointer;
}

mark {
  padding: 0 2px;
  color: inherit;
  background: #fff1a8;
}

.index-check {
  color: #5f6670;
  font-size: 24px;
}

.collect-button {
  width: 78px;
  height: 40px;
  border: 1px solid #eeeeee;
  color: var(--green);
  background: #fff;
  font-size: 16px;
}

.collect-button:hover {
  border-color: var(--green);
  background: var(--green-soft);
}

.pagination-bar {
  min-height: 55px;
  padding: 8px 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--text);
  font-size: 15px;
}

.small-button,
.primary-button,
.danger-button,
.icon-button {
  min-height: 34px;
  border-radius: 0;
}

.small-button {
  min-width: 72px;
  border: 1px solid #e5e5e5;
  color: var(--green);
  background: #fff;
}

.small-button:hover {
  border-color: var(--green);
}

.small-button:disabled {
  cursor: not-allowed;
  color: #b7b7b7;
  border-color: #ededed;
  background: #f8f8f8;
}

.pagination-bar select {
  height: 34px;
  border: 1px solid #e5e5e5;
  color: var(--text);
  background: #fff;
}

.right-panel {
  min-height: calc(100vh - 89px);
  padding: 145px 0 0 30px;
  background: var(--bg);
  overflow: hidden;
}

.rank-panel {
  border: 1px solid var(--line);
  background: #fff;
}

.rank-panel-secondary {
  margin-top: 18px;
}

.rank-title {
  height: 60px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--title);
  font-size: 24px;
}

.rank-list {
  min-height: 620px;
}

.rank-list.compact {
  min-height: 260px;
}

.rank-item {
  width: 100%;
  min-height: 63px;
  padding: 0 14px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--green);
  background: #fff;
  text-align: left;
  font-size: 18px;
}

.rank-item span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.rank-pdf {
  color: var(--red);
  font-size: 20px;
}

.empty-state {
  padding: 58px 18px;
  color: #999;
  text-align: center;
  font-size: 16px;
}

.empty-state.small {
  padding: 24px 12px;
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.42);
}

.dialog-shell {
  overflow: hidden;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.viewer-shell {
  width: min(1180px, calc(100vw - 34px));
  height: min(820px, calc(100vh - 34px));
  display: grid;
  grid-template-rows: auto 1fr;
}

.admin-shell {
  width: min(940px, calc(100vw - 34px));
  max-height: calc(100vh - 34px);
  overflow: auto;
}

.dialog-header {
  min-height: 58px;
  padding: 10px 14px 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fbff;
}

.dialog-title {
  color: var(--title);
  font-size: 18px;
  font-weight: 700;
}

.dialog-meta {
  margin-top: 3px;
  color: #888;
  font-size: 12px;
}

.viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.download-link {
  min-width: 58px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.icon-button {
  min-width: 36px;
  border: 1px solid #e5e5e5;
  color: #666;
  background: #fff;
  font-size: 22px;
  line-height: 1;
}

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

#pdfFrame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #d9e1ea;
}

.upload-form {
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.admin-auth {
  padding: 16px 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.admin-auth-actions {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 8px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--title);
  font-size: 14px;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #dcdcdc;
  color: var(--text);
  background: #fff;
}

.span-2 {
  grid-column: span 2;
}

.form-actions {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upload-preview {
  border: 1px solid #e7edf3;
  background: #fbfdff;
}

.upload-preview-head {
  min-height: 38px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #edf2f7;
  color: var(--title);
  font-weight: 700;
}

.upload-preview-row {
  min-height: 58px;
  padding: 8px 12px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 0.85fr) minmax(130px, 0.65fr);
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #edf2f7;
}

.upload-preview-row:last-child {
  border-bottom: 0;
}

.upload-preview-name {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.upload-preview-name strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--title);
  font-size: 14px;
}

.upload-preview-name span {
  color: #8a94a3;
  font-size: 12px;
}

.upload-preview-row input {
  width: 100%;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid #dcdcdc;
}

.upload-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  align-items: center;
  gap: 10px;
  color: #7d8792;
  font-size: 13px;
}

.upload-progress-track {
  height: 8px;
  overflow: hidden;
  background: #edf2f7;
}

#uploadProgressBar {
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 160ms ease;
}

.primary-button {
  min-width: 104px;
  padding: 0 16px;
  border: 0;
  color: #fff;
  background: var(--green);
}

.danger-button {
  min-width: 76px;
  border: 0;
  color: #fff;
  background: var(--danger);
}

.admin-list-head {
  min-height: 44px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}

.category-manager {
  border-bottom: 1px solid var(--line);
}

.scan-manager,
.batch-manager {
  border-bottom: 1px solid var(--line);
}

.category-form,
.scan-form {
  padding: 12px 18px;
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 104px;
  gap: 10px;
}

.category-form select,
.category-form input,
.scan-form select,
.scan-form input {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #dcdcdc;
}

.scan-form {
  grid-template-columns: 150px 110px minmax(140px, 1fr) minmax(140px, 1fr) 104px;
}

.batch-actions {
  padding: 12px 18px;
  display: grid;
  grid-template-columns: 104px 88px 150px 120px minmax(140px, 1fr) 104px 104px;
  gap: 10px;
}

.batch-actions select,
.batch-actions input {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #dcdcdc;
}

.category-manage-list {
  max-height: 168px;
  padding: 0 18px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow: auto;
}

.category-chip {
  min-height: 30px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e6edf2;
  color: var(--title);
  background: #fbfdff;
  font-size: 13px;
}

.category-chip em {
  color: #9aa4af;
  font-style: normal;
}

.category-chip button {
  border: 0;
  color: var(--danger);
  background: transparent;
}

.admin-file-list {
  padding: 8px 18px 18px;
}

.admin-file-row {
  min-height: 48px;
  padding: 8px 0;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid #edf2f7;
}

.admin-file-check {
  display: grid;
  place-items: center;
}

.edit-shell {
  width: min(760px, calc(100vw - 34px));
  max-height: calc(100vh - 34px);
  overflow: auto;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-file-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.admin-file-meta {
  margin-top: 3px;
  color: #888;
  font-size: 12px;
}

@media (max-width: 1280px) {
  .frame-panel {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .right-panel {
    display: none;
  }
}

@media (max-width: 760px) {
  .panel-header {
    height: auto;
    min-height: 76px;
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 14px;
  }

  .header-actions {
    width: 100%;
    height: auto;
    justify-content: space-between;
    gap: 8px;
  }

  .header-tool {
    min-width: auto;
    font-size: 14px;
  }

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

  .left-panel {
    min-height: auto;
  }

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

  .main-panel {
    padding: 0 10px;
  }

  .top-category-tabs {
    min-height: 0;
    max-height: 170px;
    overflow: auto;
  }

  .top-tab {
    height: 42px;
    font-size: 15px;
  }

  .search-strip {
    height: auto;
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    width: 100%;
    max-width: none;
  }

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

  .admin-auth,
  .upload-preview-row,
  .category-form,
  .scan-form,
  .batch-actions,
  .admin-file-row {
    grid-template-columns: 1fr;
  }

  .admin-auth-actions,
  .row-actions {
    align-items: stretch;
  }

  .row-actions {
    flex-direction: column;
  }

  .upload-preview-head {
    align-items: flex-start;
    flex-direction: column;
    padding: 8px 12px;
  }

  .upload-progress {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }
}
