:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #121926;
  --muted: #64748b;
  --line: #dbe3ec;
  --primary: #0f766e;
  --primary-hover: #115e59;
  --accent: #b7791f;
  --danger: #b42318;
  --danger-hover: #8f1d14;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: var(--primary);
}

.login-body {
  background:
    radial-gradient(circle at 50% -120px, rgba(15, 118, 110, 0.16), transparent 320px),
    linear-gradient(180deg, #eef4f7 0, #f7f9fb 50%, #eef2f6 100%);
}

.public-page {
  background:
    radial-gradient(circle at 50% -120px, rgba(15, 118, 110, 0.2), transparent 340px),
    linear-gradient(180deg, #eef4f7 0, #f7f9fb 46%, #eef2f6 100%);
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 16px;
}

.login-card {
  width: min(100%, 460px);
  border: 1px solid rgba(219, 227, 236, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
  padding: 32px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.login-copy {
  padding: 24px 0 18px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.redeem-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 16px;
}

.redeem-panel {
  width: min(100%, 560px);
  border: 1px solid rgba(219, 227, 236, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 34px;
}

.redeem-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #0f766e;
  color: #fff;
  font-weight: 800;
}

.brand-name,
.brand-subtitle {
  display: block;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  white-space: nowrap;
  border: 1px solid #b9e5df;
  border-radius: 6px;
  background: #ecfdf8;
  color: #0f766e;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 700;
}

.redeem-copy {
  padding: 30px 0 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

h1 {
  margin: 0 0 12px;
  font-size: 34px;
  line-height: 1.18;
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.notice-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.notice-row span {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  padding: 10px 8px;
  color: #334155;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.redeem-form,
.stack {
  display: grid;
  gap: 14px;
}

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

label {
  color: #263241;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #cfd9e3;
  border-radius: 6px;
  background: #fff;
  padding: 11px 13px;
  color: var(--text);
  font: inherit;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
  outline: none;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--primary-hover);
}

.primary-wide {
  width: 100%;
  margin-top: 24px;
}

.redeem-footnote {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

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

.success-card .details {
  margin-top: 28px;
  text-align: left;
}

.success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: #e6f4ef;
  color: var(--primary);
  font-size: 30px;
  font-weight: 800;
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 40px auto;
}

.narrow {
  width: min(520px, calc(100vw - 32px));
}

.panel,
.table-wrap,
.toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.panel {
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.08);
}

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

.topbar h1 {
  margin: 0;
  font-size: 28px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(440px, 1.15fr);
  align-items: center;
  padding: 18px;
}

.filter-bar {
  margin-bottom: 16px;
}

.filter-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 170px auto auto;
  gap: 8px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.filter-form select {
  min-height: 44px;
  border: 1px solid #cfd9e3;
  border-radius: 6px;
  background: #fff;
  padding: 0 12px;
  font: inherit;
}

.batch-form {
  display: grid;
  gap: 12px;
}

.batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

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

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
}

.check-label input,
.check-cell input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.check-cell {
  width: 44px;
  text-align: center;
  vertical-align: middle;
}

.admin-form {
  display: grid;
  align-items: center;
  gap: 10px;
}

.admin-form-create {
  grid-template-columns: minmax(220px, 1fr) auto;
}

.admin-form-generate {
  grid-template-columns: minmax(180px, 1fr) 120px auto;
}

.admin-form input,
.admin-form button {
  min-height: 44px;
}

.admin-form button {
  white-space: nowrap;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.secondary {
  background: #eef2f4;
  color: var(--text);
}

.secondary:hover {
  background: #dde5e9;
}

.danger {
  background: var(--danger);
}

.danger:hover {
  background: var(--danger-hover);
}

.alert {
  margin-bottom: 16px;
  border: 1px solid #f3b8b1;
  border-radius: 6px;
  background: #fff4f2;
  color: #7a1b14;
  padding: 10px 12px;
}

.muted {
  color: var(--muted);
}

.table-wrap {
  max-height: min(52vh, 540px);
  overflow: auto;
  padding: 0;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-block;
  min-width: 72px;
  border-radius: 6px;
  background: #eef2f4;
  padding: 3px 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.badge-new {
  background: #e8f2ff;
  color: #175cd3;
}

.badge-processing {
  background: #fff4df;
  color: #9a5b13;
}

.badge-fulfilled {
  background: #e6f4ef;
  color: #0f6f3d;
}

.badge-failed {
  background: #fff0ee;
  color: #b42318;
}

.badge-expired {
  background: #eef2f4;
  color: #596673;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.notice {
  margin-bottom: 16px;
  border: 1px solid #d9e6f8;
  border-radius: 6px;
  background: #f4f8ff;
  color: #284a8a;
  padding: 10px 12px;
}

.details {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 8px 16px;
  overflow-wrap: anywhere;
}

.details dt {
  color: var(--muted);
  font-weight: 700;
}

.details dd {
  margin: 0;
}

@media (max-width: 640px) {
  .redeem-page {
    align-items: flex-start;
    padding: 18px 12px;
  }

  .redeem-panel {
    padding: 22px;
  }

  .redeem-header {
    align-items: stretch;
    flex-direction: column;
    padding-bottom: 20px;
  }

  h1 {
    font-size: 28px;
  }

  .notice-row {
    grid-template-columns: 1fr;
  }

  .shell {
    margin: 20px auto;
  }

  .login-page {
    padding: 18px 12px;
  }

  .login-card {
    padding: 22px;
  }

  .login-copy {
    padding: 20px 0 16px;
  }

  .panel,
  .toolbar {
    padding: 18px;
  }

  .topbar,
  .toolbar,
  .inline-form {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-form-grid,
  .admin-form-create,
  .admin-form-generate {
    grid-template-columns: 1fr;
  }

  .batch-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .batch-actions {
    justify-content: stretch;
  }

  .batch-actions button {
    width: 100%;
  }

  .filter-form,
  .admin-form-grid {
    grid-template-columns: 1fr;
  }

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