/* 报告查验系统 · 后台管理 */
:root {
  --navy: #25408f;
  --navy-dark: #1b2f6b;
  --navy-soft: #eef2fb;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e6e9f0;
  --bg: #f4f6fa;
  --green: #1f9d55;
  --red: #d92d20;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

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

button {
  font-family: inherit;
}

input,
select {
  font-family: inherit;
}

/* 布局 */
.admin {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 232px;
  background: linear-gradient(180deg, #1b2947 0%, #16203a 100%);
  color: #cfd6e6;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 26px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4d6fd1, #25408f);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(37, 64, 143, .35);
}

.brand-text strong {
  display: block;
  color: #fff;
  font-size: 15px;
  letter-spacing: .5px;
}

.brand-text small {
  color: #8494b6;
  font-size: 12px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 8px;
  color: #b8c3da;
  cursor: pointer;
  transition: background .2s, color .2s;
  font-size: 14px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, .06);
  color: #fff;
}

.nav-item.active {
  background: rgba(93, 126, 214, .28);
  color: #fff;
  font-weight: 600;
}

.nav-mark {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5c7bd0;
  opacity: .55;
}

.nav-item.active .nav-mark {
  background: #8fa9ec;
  opacity: 1;
  box-shadow: 0 0 0 3px rgba(143, 169, 236, .18);
}

.sidebar-foot {
  margin-top: auto;
  padding: 0 8px;
}

.service-state {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #94a3c2;
}

.service-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #35c26b;
  box-shadow: 0 0 0 3px rgba(53, 194, 107, .18);
}

.foot-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}

.foot-links a {
  color: #8494b6;
  font-size: 12px;
}

.foot-links a:hover {
  color: #fff;
}

.main {
  margin-left: 232px;
  padding: 26px 32px 48px;
  min-height: 100vh;
}

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

.page-heading h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .3px;
}

.page-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
  background: #fff;
}

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

.btn.primary:hover {
  background: #35529f;
  border-color: #35529f;
}

.btn.ghost {
  background: #fff;
  color: #3b465a;
  border-color: #d9dee8;
}

.btn.ghost:hover {
  border-color: #b6c2dc;
  color: var(--navy);
}

.btn.danger {
  background: #fff;
  color: var(--red);
  border-color: #f1c2be;
}

.btn.danger:hover {
  background: #fff5f4;
}

.btn.sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* 状态卡片 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px 14px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

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

.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--navy);
  margin-top: 8px;
  line-height: 1.1;
  letter-spacing: .5px;
}

.stat-value.warn {
  color: #c2410c;
}

.stat-foot {
  color: #98a2b3;
  font-size: 12px;
  margin-top: 2px;
}

/* 面板 */
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  margin-bottom: 18px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.panel-sub {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.link {
  font-size: 13px;
}

.link:hover {
  text-decoration: underline;
}

/* 表格 */
.table-wrap {
  overflow-x: auto;
}

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

.table th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: #667085;
  background: #f8f9fc;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table td {
  padding: 14px;
  border-bottom: 1px solid #f0f2f6;
  color: #374151;
  vertical-align: middle;
  white-space: nowrap;
}

.table tbody tr:hover {
  background: #fafbfe;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.col-actions {
  width: 150px;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  color: var(--navy);
}

.ellipsis {
  display: inline-block;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
}

.pill.normal {
  background: #eaf7ee;
  color: #1f9d55;
}

.pill.revoked {
  background: #fdeceb;
  color: var(--red);
}

.pill i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.table-actions {
  display: flex;
  gap: 10px;
  white-space: nowrap;
}

.table-actions a {
  font-size: 13px;
  cursor: pointer;
  color: var(--navy);
}

.table-actions a:hover {
  text-decoration: underline;
}

.table-actions a.danger {
  color: var(--red);
}

.empty-state {
  padding: 48px 0 56px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  font-size: 30px;
  color: #c2cad9;
  margin-bottom: 8px;
}

/* 工具栏 */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
}

.search-box {
  display: flex;
  gap: 8px;
  flex: 1;
}

.search-box input {
  flex: 1;
  max-width: 420px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid #dbe0e9;
  border-radius: 8px;
  outline: none;
  color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
  background: #fff;
}

.search-box input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(37, 64, 143, .1);
}

.select {
  height: 36px;
  padding: 0 30px 0 12px;
  border: 1px solid #dbe0e9;
  border-radius: 8px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23667085' stroke-width='1.3'/%3E%3C/svg%3E") no-repeat right 12px center;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  color: #374151;
}

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

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

.pager-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pager-page {
  font-size: 13px;
  color: #475467;
}

/* 说明 */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
}

.guide-item {
  padding: 18px 20px 22px;
  border-right: 1px solid var(--line);
}

.guide-item:last-child {
  border-right: none;
}

.guide-no {
  font-size: 12px;
  color: #b6c2dc;
  font-weight: 600;
  letter-spacing: 1px;
}

.guide-item h3 {
  margin: 6px 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.guide-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  width: 560px;
  max-width: 100%;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(16, 24, 40, .22);
  overflow: hidden;
  animation: modal-in .2s ease-out;
}

.modal.small {
  width: 440px;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(.99);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.icon-close {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #98a2b3;
  cursor: pointer;
  padding: 2px 4px;
}

.icon-close:hover {
  color: #475467;
}

.modal-body {
  padding: 4px 20px 18px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid #f0f2f6;
}

.dropzone {
  border: 1.5px dashed #c7d1e3;
  border-radius: 12px;
  background: #f9fafd;
  padding: 28px 20px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--navy);
  background: #f2f5fc;
}

.drop-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 10px;
  border-radius: 10px;
  background: #fdeceb;
  color: #e5484d;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: .5px;
}

.drop-title {
  margin: 0 0 6px;
  font-weight: 600;
}

.drop-tip {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.picked-file {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
}

.picked-name {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.upload-code {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}

.upload-code span {
  font-size: 12.5px;
  color: var(--muted);
}

.upload-code input {
  height: 36px;
  padding: 0 11px;
  border: 1px solid #dbe0e9;
  border-radius: 8px;
  outline: none;
  font-size: 13.5px;
  transition: border-color .2s, box-shadow .2s;
}

.upload-code input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(37, 64, 143, .1);
}

.upload-code input:disabled {
  background: #f5f7fa;
  color: #98a2b3;
}

.upload-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.code-mode {
  display: inline-flex;
  border: 1px solid #dbe0e9;
  border-radius: 8px;
  overflow: hidden;
  background: #f6f8fb;
}

.code-mode button {
  border: 0;
  background: transparent;
  color: #5b6478;
  font-size: 12.5px;
  padding: 5px 12px;
  cursor: pointer;
}

.code-mode button.active {
  background: var(--navy);
  color: #fff;
}

.upload-indicators {
  margin-top: 14px;
}

.upload-indicators h5 {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.indicator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}

.upload-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
  background: #f8f9fc;
  border-radius: 8px;
  padding: 10px 12px;
}

.upload-error {
  margin-top: 10px;
  color: var(--red);
  font-size: 13px;
}

.confirm-text {
  margin: 4px 0 8px;
  color: #475467;
  line-height: 1.8;
}

/* 抽屉 */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .35);
  z-index: 90;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 760px;
  max-width: 100vw;
  background: #fff;
  z-index: 95;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(16, 24, 40, .18);
  animation: drawer-in .22s ease-out;
}

@keyframes drawer-in {
  from {
    transform: translateX(24px);
    opacity: .6;
  }

  to {
    transform: none;
    opacity: 1;
  }
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h3 {
  margin: 0;
  font-size: 17px;
}

.drawer-code {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-family: Consolas, monospace;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 24px 24px;
}

.drawer-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.save-hint {
  margin-right: auto;
  color: var(--muted);
  font-size: 12.5px;
}

.form-block {
  padding-top: 16px;
}

.form-block h4 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: #475467;
  letter-spacing: .3px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-size: 12.5px;
  color: var(--muted);
}

.field span b {
  color: var(--red);
  font-weight: 400;
}

.field input,
.field select {
  height: 36px;
  padding: 0 11px;
  border: 1px solid #dbe0e9;
  border-radius: 8px;
  outline: none;
  font-size: 13.5px;
  color: var(--ink);
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}

.field input:focus,
.field select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(37, 64, 143, .1);
}

.field select {
  padding-right: 28px;
  appearance: none;
  -webkit-appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23667085' stroke-width='1.3'/%3E%3C/svg%3E") no-repeat right 11px center;
}

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

.file-meta {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.8;
}

.file-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.qr-box {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 12px;
  background: #f8f9fc;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.qr-img {
  display: block;
  width: 120px;
  height: 120px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.qr-tip {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12.5px;
}


/* 提示 */
.toast-wrap {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.toast {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--navy);
  border-radius: 8px;
  padding: 10px 16px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .12);
  font-size: 13px;
  max-width: 420px;
  animation: toast-in .2s ease-out;
}

.toast.success {
  border-left-color: var(--green);
}

.toast.error {
  border-left-color: var(--red);
  color: var(--red);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* 登录 / 注册 */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #1b2947 0%, #25408f 100%);
}

.auth-card {
  width: 400px;
  max-width: 100%;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  padding: 26px 28px 20px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.auth-brand .brand-text strong {
  color: #1f2937;
}

.auth-brand .brand-text small {
  color: #98a2b3;
}

.auth-title {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
}

.auth-field {
  margin-bottom: 14px;
}

.auth-field input {
  height: 42px;
}

.auth-error {
  margin: -2px 0 12px;
  color: var(--red);
  font-size: 12.5px;
  line-height: 1.6;
}

.auth-submit {
  width: 100%;
  height: 42px;
  font-size: 14px;
  margin-top: 4px;
}

.auth-switch {
  margin: 16px 0 0;
  text-align: center;
  color: #6b7280;
  font-size: 13px;
}

.auth-switch a {
  color: var(--navy);
  cursor: pointer;
  font-weight: 600;
}

.auth-hint {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid #f0f2f6;
  color: #98a2b3;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

/* 侧边栏当前用户 */
.user-card {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.user-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.user-role {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #cfd6e6;
}

.logout-link {
  display: inline-block;
  margin-top: 8px;
  color: #8494b6;
  font-size: 12px;
  cursor: pointer;
}

.logout-link:hover {
  color: #fff;
}

.pill.role-admin {
  background: #eef2fb;
  color: #25408f;
}

.pill.role-operator {
  background: #f2f4f7;
  color: #475467;
}

.pill.status-active {
  background: #eaf7ee;
  color: #1f9d55;
}

.pill.status-disabled {
  background: #fdeceb;
  color: #d92d20;
}

.field-note {
  color: #98a2b3;
  font-size: 11px;
  font-weight: 400;
}

/* 响应式 */
@media (max-width: 960px) {
  .sidebar {
    position: static;
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 18px;
    padding: 12px 16px;
  }

  .brand {
    padding: 0;
    flex: 0 0 auto;
  }

  .brand-text strong {
    white-space: nowrap;
  }

  .brand-text small {
    display: none;
  }

  .sidebar {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .nav {
    flex-direction: row;
    flex: 0 0 auto;
  }

  .nav-item {
    padding: 9px 12px;
    white-space: nowrap;
  }

  .sidebar-foot {
    display: none;
  }

  .main {
    margin-left: 0;
    padding: 20px 16px 40px;
  }

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

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

  .guide-item {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .table {
    min-width: 680px;
  }
}