* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Microsoft YaHei", -apple-system, sans-serif;
  background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 100%);
  min-height: 100vh;
  color: #333;
}

/* Navbar */
.navbar {
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
  text-decoration: none;
}
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  padding: 8px 14px;
  color: #555;
  text-decoration: none;
  font-size: 14px;
  border-radius: 6px;
  transition: all .2s;
}
.nav-links a:hover { background: #f0f0f5; color: #1a1a2e; }
.nav-logout { color: #e74c3c !important; }

/* Container */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 20px;
  min-height: calc(100vh - 56px - 60px);
}

/* Hero */
.hero { text-align: center; padding: 40px 0; }
.hero h1 { font-size: 32px; color: #fff; margin-bottom: 8px; }
.hero-sub { font-size: 16px; color: rgba(255,255,255,.6); margin-bottom: 36px; }
.hero-qr { margin-bottom: 24px; }
.qr-img { width: 200px; height: 200px; border-radius: 12px; background: #fff; padding: 8px; }
.qr-placeholder {
  width: 200px; height: 200px; border-radius: 12px; background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  color: #999; font-size: 14px;
}
.qr-hint { font-size: 13px; color: rgba(255,255,255,.5); margin-top: 8px; }
.qr-url-hint { font-size: 13px; color: rgba(255,255,255,.6); margin-top: 4px; word-break: break-all; }
.qr-url-hint strong { color: #409eff; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Steps */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 40px 0;
}
.step {
  background: rgba(255,255,255,.05);
  border-radius: 12px;
  padding: 28px 20px;
  text-align: center;
  color: #fff;
}
.step-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #409eff, #337ecc);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; margin-bottom: 12px;
}
.step h3 { font-size: 16px; margin-bottom: 8px; }
.step p { font-size: 13px; color: rgba(255,255,255,.5); }

/* Cards */
.page-card, .auth-card {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  max-width: 640px;
  margin: 0 auto;
}
.page-card h1, .auth-card h1 {
  font-size: 22px;
  margin-bottom: 6px;
}
.page-desc { font-size: 14px; color: #888; margin-bottom: 24px; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 28px;
  border-radius: 8px;
  font-size: 15px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity .2s;
  text-align: center;
}
.btn:hover { opacity: .85; }
.btn-primary { background: linear-gradient(135deg, #409eff, #337ecc); color: #fff; }
.btn-outline { background: transparent; color: #409eff; border: 1px solid #409eff; }
.btn-block { display: block; width: 100%; }
.btn-danger { color: #e74c3c !important; border-color: #e74c3c !important; }
.btn-small {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 13px;
  text-decoration: none;
  border: 1px solid #d0d0d0;
  background: #fff;
  color: #555;
  cursor: pointer;
  transition: all .2s;
}
.btn-small:hover { border-color: #409eff; color: #409eff; }

/* Form */
.form .form-group { margin-bottom: 16px; }
.form label { display: block; font-size: 14px; color: #555; margin-bottom: 4px; font-weight: 500; }
.required { color: #e74c3c; }
.form-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border .2s;
}
.form-input:focus { border-color: #409eff; box-shadow: 0 0 0 2px rgba(64,158,255,.15); }
textarea.form-input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.6; }
select.form-input { background: #fff; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.form-hint { font-size: 12px; color: #999; margin-bottom: 6px; }
.form-static { height: 42px; display: flex; align-items: center; font-size: 15px; color: #333; font-weight: 500; padding: 0 4px; background: #f5f5f5; border-radius: 6px; padding: 0 12px; border: 1px solid #e8e8e8; }
.form-note { font-size: 12px; color: #999; font-weight: 400; }

/* Alert */
.alert {
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-error { background: #fef0f0; color: #e74c3c; border: 1px solid #fde2e2; }

/* Info summary */
.info-summary {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
}
.info-summary strong { color: #333; }
.info-summary span { color: #666; }

/* Document list */
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s;
}
.doc-item:hover { border-color: #409eff; background: #f0f7ff; }
.doc-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: #409eff; }
.doc-info { display: flex; flex-direction: column; }
.doc-name { font-size: 15px; font-weight: 500; }
.doc-desc { font-size: 12px; color: #999; }

/* Doc tabs */
.doc-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; }
.doc-tab {
  padding: 8px 16px; border: 1px solid #d0d0d0; border-radius: 6px;
  background: #fff; font-size: 13px; cursor: pointer; transition: all .2s;
}
.doc-tab:hover { border-color: #409eff; color: #409eff; }
.doc-tab.active { background: #409eff; color: #fff; border-color: #409eff; }
.doc-preview { margin-bottom: 24px; }
.doc-preview-title { font-size: 16px; color: #333; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid #409eff; }
.hidden { display: none; }

/* Contract preview */
.contract-preview {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.8;
}

/* Table */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; }
.table th { font-weight: 600; color: #555; background: #f8f9fa; }
.table tbody tr:hover { background: #f8f9fa; }

/* Status */
.status { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; }
.status-pending { background: #fff7e6; color: #d48806; }
.status-success { background: #f0f9eb; color: #67c23a; }
.status-failed { background: #fef0f0; color: #e74c3c; }

/* Empty state */
.empty, .empty-state { text-align: center; padding: 40px 0; color: #999; }
.empty-state p { margin-bottom: 16px; }

/* Success page */
.success-page { text-align: center; }
.success-icon {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: #07c160;
  color: #fff;
  font-size: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.success-info { margin: 16px 0; font-size: 14px; color: #666; }
.success-info p { margin-bottom: 4px; }

/* QR card */
.qr-card { text-align: center; }
.qr-display { margin: 20px 0; }
.qr-display img { width: 220px; height: 220px; border-radius: 8px; border: 2px solid #e8e8e8; }
.qr-status { font-size: 14px; color: #888; margin-bottom: 16px; min-height: 24px; }

/* Auth links */
.auth-links { display: flex; justify-content: space-between; margin-top: 16px; font-size: 13px; }
.auth-links a { color: #409eff; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

/* Detail grid */
.detail-grid { display: flex; flex-direction: column; gap: 0; }
.detail-row {
  display: flex;
  border-bottom: 1px solid #eee;
  padding: 10px 0;
}
.detail-label { width: 100px; font-size: 14px; color: #888; flex-shrink: 0; }
.detail-value { font-size: 14px; color: #333; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 20px; }
.page-info { font-size: 13px; color: #888; }

/* Admin nav */
.admin-nav { display: flex; gap: 10px; flex-wrap: wrap; }

/* Footer */
.footer {
  text-align: center;
  padding: 20px;
  color: rgba(255,255,255,.3);
  font-size: 13px;
}

/* Responsive */
@media (max-width: 640px) {
  .container { padding: 20px 12px; }
  .page-card, .auth-card { padding: 20px; }
  .nav-links a { padding: 6px 10px; font-size: 13px; }
  .hero h1 { font-size: 24px; }
  .form-row { flex-direction: column; gap: 0; }
  .table { font-size: 13px; }
  .table th, .table td { padding: 8px 6px; }
  .detail-row { flex-direction: column; gap: 2px; }
}



/* Admin wide layout */
body.admin-page .nav-inner { max-width: 1480px; }
body.admin-page .container { max-width: 1480px; padding-left: 32px; padding-right: 32px; }
body.admin-page .page-card { max-width: none; width: 100%; padding: 28px 32px; overflow-x: auto; }
body.admin-page .stats-grid { grid-template-columns: repeat(4, minmax(160px, 1fr)); }
body.admin-page .table { min-width: 980px; }
body.admin-page .table th,
body.admin-page .table td { white-space: nowrap; }
body.admin-page .table td:nth-child(6) { white-space: normal; min-width: 180px; }

@media (max-width: 900px) {
  body.admin-page .container { padding-left: 12px; padding-right: 12px; }
  body.admin-page .page-card { padding: 20px 16px; }
  body.admin-page .stats-grid { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
}


/* Admin trash compact layout */
body.admin-page .admin-trash-card { overflow-x: visible; }
body.admin-page .trash-table { min-width: 0; table-layout: fixed; }
body.admin-page .trash-table th,
body.admin-page .trash-table td { padding: 9px 8px; white-space: normal; vertical-align: top; }
body.admin-page .trash-table th:nth-child(1),
body.admin-page .trash-table td:nth-child(1) { width: 52px; }
body.admin-page .trash-table th:nth-child(2),
body.admin-page .trash-table td:nth-child(2) { width: 120px; }
body.admin-page .trash-table th:nth-child(3),
body.admin-page .trash-table td:nth-child(3) { width: 120px; }
body.admin-page .trash-table th:nth-child(4),
body.admin-page .trash-table td:nth-child(4) { width: 120px; }
body.admin-page .trash-table th:nth-child(5),
body.admin-page .trash-table td:nth-child(5) { width: auto; word-break: break-word; }
body.admin-page .trash-table th:nth-child(6),
body.admin-page .trash-table td:nth-child(6) { width: 170px; }
body.admin-page .trash-table th:nth-child(7),
body.admin-page .trash-table td:nth-child(7) { width: 86px; }


/* Codex mobile compatibility patch - 20260522 */
@media (max-width: 760px) {
  html, body { width: 100%; overflow-x: hidden; }
  .navbar { position: sticky; top: 0; }
  .nav-inner { height: auto; min-height: 56px; padding: 10px 12px; align-items: flex-start; gap: 8px; flex-direction: column; }
  .nav-logo { font-size: 17px; line-height: 1.3; }
  .nav-links { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .nav-links a { text-align: center; padding: 8px 6px; white-space: nowrap; }
  .container { width: 100%; padding: 16px 10px; }
  .hero { padding: 28px 0 22px; }
  .hero h1 { font-size: 24px; line-height: 1.25; }
  .hero-sub { margin-bottom: 22px; }
  .qr-img, .qr-placeholder { width: min(68vw, 210px); height: min(68vw, 210px); }
  .page-card, .auth-card { width: 100%; max-width: none; padding: 18px 14px; border-radius: 10px; }
  .form-row { flex-direction: column; gap: 0; }
  .form-actions, .hero-actions, .auth-links { flex-direction: column; align-items: stretch; }
  .btn, .btn-small { width: 100%; text-align: center; justify-content: center; }
  .doc-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-tab { width: 100%; padding: 9px 6px; }
  .doc-item { padding: 10px 12px; }
  .contract-preview { padding: 14px; font-size: 13px; overflow-x: auto; }
  .detail-row { flex-direction: column; gap: 3px; }
  .detail-label { width: auto; }
  .table { min-width: 680px; }
  .page-card:has(.table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  body.admin-page .container { padding-left: 8px; padding-right: 8px; }
  body.admin-page .page-card { padding: 16px 10px; overflow-x: auto; }
  body.admin-page .table, body.admin-page .trash-table { min-width: 760px; table-layout: auto; }
  body.admin-page .trash-table th, body.admin-page .trash-table td { white-space: normal; }
  body.admin-page .stats-grid { grid-template-columns: 1fr; }
}
