* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: #111827;
  background: #f5f7fb;
  overflow-x: hidden;
}

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

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

.public-page {
  min-height: 100vh;
}

.hero-background {
  position: relative;
  background: url("/static/images/background.png") center/cover no-repeat;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(231, 239, 248, 0.76), rgba(236, 243, 250, 0.92));
}

.public-layout {
  position: relative;
  min-height: 100vh;
  padding: 32px 16px;
  overflow-x: hidden;
}

.agreement-panel,
.success-card {
  position: relative;
  z-index: 1;
  width: min(1080px, 100%);
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(8px);
  border-radius: 24px;
  padding: 28px;
  overflow: hidden;
}

.form-panel {
  max-width: 980px;
}

.topbar,
.section-header,
.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.topbar h1,
.section-header h1 {
  margin: 8px 0 10px;
}

.eyebrow {
  color: #b8860b;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.stepper {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 24px 0;
}

.stepper span {
  padding: 10px 16px;
  border-radius: 999px;
  background: #edf2f7;
  color: #4b5563;
  font-size: 14px;
}

.stepper .active {
  background: linear-gradient(135deg, #c79a22, #e9c768);
  color: #fff;
}

.pdf-frame {
  height: 70vh;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d8e0ea;
}

.pdf-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.preview-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  width: 100%;
  max-width: 100%;
}

.pdf-preview-stack {
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.pdf-preview-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-width: 0;
  border-radius: 18px;
  border: 1px solid #d8e0ea;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  object-fit: contain;
}

.notice-card,
.summary-card,
.signature-panel,
.table-card,
.stat-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 20px;
}

.notice-card {
  margin-top: 20px;
}

.product-tags {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.product-tags span {
  background: #f4f7fb;
  border-radius: 999px;
  padding: 8px 12px;
}

.field-grid,
.summary-grid,
.stats-grid,
.detail-grid {
  display: grid;
  gap: 16px;
}

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

.detail-grid,
.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.triple-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.info-form,
.admin-form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 10px;
}

label span {
  font-weight: 600;
  color: #374151;
}

.field-note {
  color: #6b7280;
  font-size: 13px;
  line-height: 1.5;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd8e3;
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
}

.public-page select {
  appearance: auto;
  -webkit-appearance: menulist;
  background-image: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #c79a22;
  box-shadow: 0 0 0 3px rgba(199, 154, 34, 0.16);
}

.summary-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
}

.summary-grid div,
.detail-list div {
  display: grid;
  gap: 6px;
  padding: 14px;
  background: #f8fafc;
  border-radius: 14px;
}

.summary-grid span,
.detail-list span,
.stat-card span {
  color: #6b7280;
  font-size: 14px;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 12px;
  padding: 0 18px;
  border: 0;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.primary-button {
  background: linear-gradient(135deg, #b8860b, #e4bf5c);
  color: #fff;
  box-shadow: 0 12px 24px rgba(184, 134, 11, 0.22);
}

.ghost-button {
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.actions {
  margin-top: 20px;
}

.actions.center {
  justify-content: center;
}

.alert {
  background: #fff2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 8px;
}

.success-alert {
  background: #eefbf3;
  color: #166534;
  border-color: #bbf7d0;
}

.signature-panel {
  margin-top: 10px;
}

#signature-canvas {
  width: 100%;
  height: auto;
  border: 1px dashed #c79a22;
  border-radius: 16px;
  background: #fcfdff;
  touch-action: none;
}

.signature-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.success-card {
  max-width: 720px;
  text-align: center;
  margin-top: 10vh;
}

.application-no {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: 14px;
  background: #f4f7fb;
  display: inline-block;
}

.admin-page {
  background: #eef2f7;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.admin-sidebar {
  background: #0f172a;
  color: #e5e7eb;
  padding: 24px 20px;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
}

.admin-sidebar nav {
  display: grid;
  gap: 10px;
}

.admin-sidebar nav a {
  padding: 12px 14px;
  border-radius: 12px;
  color: #cbd5e1;
}

.admin-sidebar nav a.active,
.admin-sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.admin-main {
  padding: 28px;
  display: grid;
  gap: 20px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.admin-user {
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #d1d5db;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 32px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  color: #6b7280;
  font-size: 14px;
  font-weight: 600;
  padding-bottom: 12px;
}

tbody td {
  padding: 14px 0;
  border-top: 1px solid #edf2f7;
  vertical-align: top;
}

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

.compact-list div {
  padding: 12px 14px;
}

.signature-preview {
  padding: 16px;
  background: #f8fafc;
  border-radius: 14px;
  text-align: center;
}

.signature-preview img {
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
}

.link-group {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.file-maintenance-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
}

.small-title {
  font-size: 16px;
}

.full-span {
  grid-column: 1 / -1;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 34px;
}

.checkbox-field input {
  width: auto;
}

.admin-login-wrapper {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #eaf0f8, #f8fbff);
}

.admin-login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.1);
}

.wider-card {
  width: min(760px, 100%);
}

.narrow-card {
  max-width: 860px;
}

.full-width {
  width: 100%;
}

.centered-link {
  text-align: center;
}

.totp-setup-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  margin: 20px 0;
}

.qr-card {
  text-align: center;
}

.qr-image {
  width: 220px;
  max-width: 100%;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  border: 1px solid #e5e7eb;
}

.secret-box {
  padding: 14px 16px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px dashed #c79a22;
  font-weight: 700;
  letter-spacing: 0.08em;
  word-break: break-all;
}

.tips-text {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: #4b5563;
}

.table-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: #374151;
  cursor: pointer;
  font: inherit;
}

@media (max-width: 960px) {
  .field-grid,
  .summary-grid,
  .detail-grid,
  .stats-grid,
  .triple-grid,
  .totp-setup-grid,
  .file-maintenance-grid,
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-shell {
    display: block;
  }

  .admin-sidebar {
    display: none;
  }

  .pdf-frame {
    height: 60vh;
  }

  .agreement-panel,
  .success-card {
    padding: 22px;
    border-radius: 20px;
  }
}

@media (max-width: 768px) {
  .field-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-header,
  .actions,
  .signature-actions,
  .admin-header {
    flex-direction: column;
    align-items: stretch;
  }

  .public-layout {
    padding: 20px 12px calc(28px + env(safe-area-inset-bottom));
  }

  .primary-button,
  .ghost-button {
    width: 100%;
    min-height: 48px;
  }

  .stepper {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .stepper span {
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .pdf-preview-stack {
    gap: 12px;
  }

  .pdf-preview-image {
    border-radius: 14px;
  }

  #signature-canvas {
    min-height: 220px;
  }
}

@media (max-width: 640px) {
  .agreement-panel,
  .success-card,
  .admin-main {
    padding: 20px;
  }
}
