:root {
  --color-primary: #ff7f50;
  --color-link: #4a6de5;
  --color-check: #3563ec;
  --color-bg: #f9fafc;
  --color-card: #ffffff;
  --color-header: #ffffff;
  --color-text: #111111;
  --color-text-secondary: #4c4f55;
  --color-text-section: #5c5e62;
  --color-border: #e8eaef;
  --color-danger: #e34d59;
  --space-page: 20px;
  --space-card: 18px;
  --space-card-gap: 22px;
  --radius-card: 12px;
  --radius-btn: 8px;
  --shadow-card: 0 1px 4px rgba(17, 24, 39, 0.04);
  --header-h: 70px;
  --font: "PingFang SC", "SF Pro Text", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}

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

html,
body {
  min-height: 100%;
}

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font-family: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
}

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-header);
}

.header h1 {
  font-size: 17px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: 0.2px;
  color: #111;
}

.main {
  flex: 1;
  padding: 22px var(--space-page) 32px;
}

.section-title {
  font-size: 15px;
  font-weight: 400;
  line-height: 21px;
  color: var(--color-text-section);
  margin-bottom: 24px;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-card-gap);
}

.card {
  position: relative;
  background: var(--color-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px var(--space-card) 16px;
}

.card.is-signed {
  opacity: 0.92;
}

.card.is-signing .card__title {
  color: #222;
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card__title {
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
  color: #111;
}

.card__badge {
  flex-shrink: 0;
  font-size: 12px;
  line-height: 18px;
  padding: 2px 8px;
  border-radius: 4px;
}

.card__badge--signed {
  color: #2ba471;
  background: #e8f8f0;
}

.card__badge--signing {
  color: #d97706;
  background: #fff7e8;
}

.card__meta {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card__meta p {
  font-size: 13px;
  line-height: 18px;
  color: var(--color-text-secondary);
}

.card__hint {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.45;
  color: #b45309;
  background: #fffbeb;
  border-radius: 6px;
  padding: 8px 10px;
}

.card__action {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.card__sign {
  font-size: 13px;
  line-height: 18px;
  color: var(--color-link);
  padding: 2px 0;
}

.card__sign:disabled {
  color: #9aa0a6;
  cursor: default;
}

.card.is-signed .card__sign {
  color: #9aa0a6;
}

.mask {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.mask--center {
  align-items: center;
  padding: 24px;
}

.confirm-box {
  width: 100%;
  max-width: 320px;
  background: #fff;
  border-radius: 14px;
  padding: 24px 20px 20px;
  text-align: center;
}

.confirm-box__spin {
  margin-bottom: 14px;
  border-color: rgba(74, 109, 229, 0.2);
  border-top-color: var(--color-link);
}

.confirm-box__title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.confirm-box__desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

.confirm-box__step {
  font-size: 12px;
  color: var(--color-link);
}

.sheet {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
}

.sheet__title {
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
}

.sheet__desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-secondary);
  text-align: center;
  margin-bottom: 18px;
}

.sheet__desc em {
  font-style: normal;
  color: #111;
  font-weight: 500;
}

.field {
  display: block;
  margin-bottom: 8px;
}

.field__label {
  display: block;
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
}

.field__input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 16px;
  letter-spacing: 2px;
  outline: none;
}

.field__input:focus {
  border-color: var(--color-link);
}

.field__error {
  font-size: 12px;
  color: var(--color-danger);
  margin-bottom: 8px;
}

.sheet__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 18px;
}

.link-btn {
  font-size: 13px;
  color: var(--color-link);
}

.link-btn:disabled {
  color: #999;
  cursor: not-allowed;
}

.sheet__hint {
  font-size: 12px;
  color: #999;
}

.btn-primary {
  width: 100%;
  height: 44px;
  border-radius: var(--radius-btn);
  background: var(--color-primary);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
}

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

.btn-primary:not(:disabled):active {
  filter: brightness(0.96);
}

.sheet__submit {
  margin-bottom: 8px;
}

.sheet__cancel {
  width: 100%;
  height: 40px;
  color: #666;
  font-size: 14px;
}

.loading {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading__box {
  min-width: 160px;
  background: rgba(17, 17, 17, 0.86);
  color: #fff;
  border-radius: 10px;
  padding: 18px 20px;
  text-align: center;
}

.loading__box p {
  margin-top: 10px;
  font-size: 13px;
}

.loading__spin {
  width: 28px;
  height: 28px;
  margin: 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.confirm-box .loading__spin {
  width: 28px;
  height: 28px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(8px);
  z-index: 60;
  background: rgba(17, 17, 17, 0.82);
  color: #fff;
  font-size: 13px;
  line-height: 18px;
  padding: 10px 16px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}

.toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
