:root {
  color-scheme: light;
  --bg: #eef4fb;
  --bg-soft: #f8fbff;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --surface-muted: rgba(245, 249, 255, 0.94);
  --text: #172033;
  --text-soft: #5f6b85;
  --text-faint: #8a93a8;
  --line: rgba(23, 32, 51, 0.1);
  --line-strong: rgba(23, 32, 51, 0.16);
  --primary: #2d5bff;
  --primary-deep: #2147c7;
  --primary-soft: rgba(45, 91, 255, 0.1);
  --success: #1f7a52;
  --error: #c34736;
  --error-soft: rgba(195, 71, 54, 0.1);
  --shadow-lg: 0 28px 80px rgba(23, 42, 89, 0.14);
  --shadow-md: 0 18px 40px rgba(23, 42, 89, 0.1);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --font-sans: "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at 0% 0%, rgba(45, 91, 255, 0.15), transparent 30rem),
    radial-gradient(circle at 100% 12%, rgba(56, 189, 248, 0.12), transparent 34rem),
    linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 55%, #eaf1f8 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: 0;
}

body::before {
  top: -8rem;
  right: -6rem;
  width: 26rem;
  height: 26rem;
  border-radius: 999px;
  background: rgba(45, 91, 255, 0.08);
  filter: blur(24px);
}

body::after {
  left: -8rem;
  bottom: -10rem;
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.06);
  filter: blur(30px);
}

::selection {
  background: rgba(45, 91, 255, 0.18);
}

a {
  color: inherit;
}

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

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #98a0b3;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(248, 251, 255, 0.96);
  color: var(--text);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

input,
select {
  min-height: 50px;
  padding: 0 16px;
}

textarea {
  min-height: 220px;
  padding: 16px 18px;
  line-height: 1.7;
}

input[type="file"] {
  padding: 10px 12px;
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-deep);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
.download-link:focus-visible {
  outline: none;
  border-color: rgba(45, 91, 255, 0.42);
  box-shadow: 0 0 0 4px rgba(45, 91, 255, 0.12);
}

button,
.download-link {
  min-height: 50px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

button {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(45, 91, 255, 0.22);
}

button:hover,
.download-link:hover {
  transform: translateY(-1px);
}

button:disabled,
.download-link:disabled {
  cursor: wait;
  opacity: 0.7;
  box-shadow: none;
}

.ghost-button,
.download-link.alt,
.danger-button.alt {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  box-shadow: none;
}

.ghost-button:hover,
.download-link.alt:hover,
.danger-button.alt:hover {
  border-color: rgba(45, 91, 255, 0.24);
  background: #ffffff;
}

.danger-button {
  background: linear-gradient(135deg, #d95b4f 0%, #b93b2e 100%);
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(195, 71, 54, 0.2);
}

.danger-ghost {
  border-color: rgba(195, 71, 54, 0.24);
  color: var(--error);
}

.redeem-shell,
.page-shell {
  position: relative;
  z-index: 1;
}

.redeem-body {
  padding: 16px;
}

.redeem-shell {
  width: min(1240px, 100%);
  margin: 0 auto;
}

.page-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 48px;
}

.admin-shell {
  padding-top: 18px;
}

.hero-panel,
.hero > .hero-copy,
.hero-side,
.panel,
.tool-card,
.danger-zone,
.cards-board,
.guide-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
}

.hero-panel,
.panel,
.tool-card,
.danger-zone,
.cards-board,
.guide-card {
  border-radius: var(--radius-xl);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.8fr);
  gap: 18px;
  margin-bottom: 20px;
}

.hero > .hero-copy,
.hero-side,
.hero-panel {
  padding: 30px;
}

.hero > .hero-copy {
  border-radius: var(--radius-xl);
}

.hero-panel {
  margin-bottom: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(244, 249, 255, 0.88)),
    var(--surface);
}

.hero-side {
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(180deg, rgba(45, 91, 255, 0.12), rgba(255, 255, 255, 0.96)),
    var(--surface);
}

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

.brand-mark {
  width: 76px;
  height: 76px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--primary) 0%, #69a8ff 100%);
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow: 0 18px 40px rgba(45, 91, 255, 0.28);
}

.eyebrow,
.kicker {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary-deep);
}

.hero h1,
.hero-panel h1 {
  margin: 0;
  font-size: clamp(2.3rem, 5vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.admin-hero h1 {
  max-width: 10ch;
  font-size: clamp(2.4rem, 4vw, 4.2rem);
}

.hero-text,
.panel-note {
  margin: 16px 0 0;
  color: var(--text-soft);
  line-height: 1.75;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(45, 91, 255, 0.14);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 500;
}

.hero-side-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary-deep);
}

.hero-side strong {
  display: block;
  margin-top: 16px;
  font-size: clamp(1.7rem, 3vw, 2.8rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.hero-side p {
  margin: 18px 0 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.compact-shell {
  min-height: calc(100vh - 32px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.hero-strip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
}

.hero-strip {
  border-radius: 30px;
  padding: 18px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto;
  gap: 18px;
  align-items: center;
}

.hero-strip-copy h1 {
  margin: 0;
  font-size: clamp(2rem, 3.8vw, 3rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.hero-strip-copy .hero-text {
  margin-top: 10px;
  max-width: 58ch;
}

.hero-strip-note {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hero-strip-note > div {
  min-width: 170px;
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 247, 255, 0.86));
}

.hero-strip-note span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}

.hero-strip-note strong {
  display: block;
  margin-top: 6px;
  font-size: 1.05rem;
}

.redeem-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.panel,
.cards-board {
  padding: 28px;
}

.panel-head,
.board-head,
.tool-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.panel-head h2,
.board-head h3,
.tool-head h3 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.tool-head small,
.danger-zone small {
  color: var(--text-soft);
  line-height: 1.65;
}

.intro-copy {
  margin: 14px 0 0;
  color: var(--text-soft);
  line-height: 1.75;
}

.redeem-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 12px;
  min-height: 0;
}

.redeem-composer-panel,
.redeem-side-panel {
  min-height: 0;
}

.redeem-composer-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 0;
}

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

.redeem-composer-panel .redeem-form {
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
}

.redeem-composer-panel textarea {
  min-height: 196px;
}

.split {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
}

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

label span,
.summary-panel span,
.stock-banner span,
.preview-box p,
.stat-card span,
.card-meta span,
.result-meta span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-soft);
}

.redeem-label {
  letter-spacing: 0.04em;
}

.stock-banner {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.stock-banner > div,
.summary-panel > div,
.stat-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 255, 0.88));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.stock-banner strong,
.summary-panel strong,
.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.75rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.guide-card {
  margin-top: 16px;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(30, 41, 59, 0.04), rgba(255, 255, 255, 0.94)),
    var(--surface);
}

.guide-title {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 700;
}

.guide-list {
  display: grid;
  gap: 14px;
}

.guide-list > div {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.guide-list strong {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-family: var(--font-mono);
  font-size: 0.92rem;
}

.guide-list span {
  color: var(--text-soft);
  line-height: 1.7;
}

.redeem-side-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 12px;
}

.compact-head {
  align-items: center;
}

.compact-pills {
  margin-top: 0;
}

.stock-banner-compact {
  margin-top: 0;
}

.stock-banner-compact > div {
  padding: 16px;
}

.stock-banner-compact strong {
  font-size: 1.55rem;
}

.compact-guide {
  margin-top: 0;
  padding: 16px 18px;
}

.compact-guide-list {
  gap: 10px;
}

.compact-guide-list > div {
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
}

.compact-guide-list strong {
  min-height: 32px;
  border-radius: 10px;
  font-size: 0.84rem;
}

.result-placeholder,
.result-board {
  min-height: 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 255, 0.84));
}

.result-placeholder {
  padding: 18px;
  display: grid;
  align-content: center;
  gap: 8px;
  color: var(--text-soft);
}

.result-placeholder span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary-deep);
}

.result-placeholder p {
  margin: 0;
  line-height: 1.7;
}

.result-board {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.message {
  min-height: 24px;
  margin-top: 12px;
  font-size: 0.94rem;
  color: var(--text-soft);
}

.message[data-type="success"] {
  color: var(--success);
}

.message[data-type="error"] {
  color: var(--error);
}

.message[data-type="info"] {
  color: var(--text-soft);
}

.summary-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.redeem-output {
  margin-top: 18px;
}

.result-board .summary-panel,
.result-board .download-actions,
.result-board .preview-box {
  margin-top: 0;
}

.download-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.download-actions.stacked {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.download-link {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(45, 91, 255, 0.22);
}

.preview-box,
.empty-state,
.result-meta,
.selection-summary,
.card-item,
.record-item {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 255, 0.84));
}

.preview-box {
  margin-top: 16px;
  padding: 18px;
}

.preview-box ul {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.result-board .preview-box ul {
  max-height: 150px;
  overflow: auto;
  padding-right: 4px;
}

.preview-box li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-top: 10px;
  border-top: 1px dashed rgba(23, 32, 51, 0.12);
}

.preview-box li:first-child {
  padding-top: 0;
  border-top: 0;
}

.preview-box strong,
.card-line strong {
  font-family: var(--font-mono);
  font-size: 0.98rem;
  letter-spacing: 0.04em;
}

.panel-admin {
  background: rgba(255, 255, 255, 0.82);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.admin-tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr) minmax(0, 1.08fr);
  gap: 16px;
  margin-top: 22px;
  align-items: start;
}

.tool-card,
.danger-zone {
  padding: 24px;
}

.danger-zone {
  background:
    linear-gradient(180deg, rgba(195, 71, 54, 0.08), rgba(255, 255, 255, 0.92)),
    var(--surface);
}

.danger-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.cards-board {
  margin-top: 24px;
}

.board-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.selection-summary {
  margin-top: 14px;
  padding: 14px 16px;
  color: var(--text-soft);
}

.search-field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.status-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 260px);
  gap: 14px;
  align-items: end;
  margin-top: 16px;
}

.inline-search {
  margin-top: 0;
}

.cards-list,
.records-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-right: 4px;
  overflow: auto;
}

.cards-list {
  max-height: 440px;
}

.records-list {
  max-height: 560px;
}

.record-status-list {
  max-height: 620px;
}

.cards-list::-webkit-scrollbar,
.records-list::-webkit-scrollbar {
  width: 10px;
}

.cards-list::-webkit-scrollbar-thumb,
.records-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 2px solid transparent;
  background: rgba(95, 107, 133, 0.24);
  background-clip: padding-box;
}

.card-item,
.record-item,
.empty-state {
  padding: 18px;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.card-item:hover,
.record-item:hover {
  transform: translateY(-1px);
  border-color: rgba(45, 91, 255, 0.2);
  box-shadow: 0 10px 24px rgba(23, 42, 89, 0.08);
}

.card-item.is-used {
  background: linear-gradient(180deg, rgba(31, 122, 82, 0.08), rgba(255, 255, 255, 0.94));
}

.status-item {
  border-left: 5px solid rgba(95, 107, 133, 0.26);
}

.status-item.is-blocked {
  border-left-color: var(--error);
  background: linear-gradient(180deg, rgba(195, 71, 54, 0.09), rgba(255, 255, 255, 0.95));
}

.status-item.is-full {
  border-left-color: var(--success);
  background: linear-gradient(180deg, rgba(31, 122, 82, 0.08), rgba(255, 255, 255, 0.95));
}

.status-item.is-assigned {
  border-left-color: var(--primary);
}

.status-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.status-metrics span {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(244, 247, 252, 0.86);
  color: var(--text-soft);
  font-size: 0.86rem;
}

.status-metrics strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
}

.status-reason {
  margin-top: 12px;
  color: var(--text-soft);
  line-height: 1.55;
}

.card-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.card-select input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.card-select.is-disabled {
  opacity: 0.72;
}

.card-line,
.card-meta,
.result-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.card-line span {
  color: var(--text-soft);
  font-weight: 500;
}

.card-meta {
  margin-top: 12px;
}

.record-item {
  display: grid;
  gap: 12px;
}

.record-accounts {
  display: grid;
  gap: 10px;
}

.record-account {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding-top: 10px;
  border-top: 1px dashed rgba(23, 32, 51, 0.12);
}

.record-account strong {
  font-size: 0.96rem;
  font-weight: 600;
}

.record-account span {
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  word-break: break-all;
}

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

.hidden {
  display: none;
}

@media (max-width: 1180px) {
  .hero,
  .redeem-grid,
  .admin-tool-grid,
  .redeem-dashboard,
  .hero-strip {
    grid-template-columns: 1fr;
  }

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

  .panel-head,
  .board-head,
  .tool-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 860px) {
  .stock-banner,
  .summary-panel,
  .download-actions.stacked,
  .danger-actions,
  .split {
    grid-template-columns: 1fr;
  }

  .hero-strip-note {
    grid-template-columns: 1fr;
  }

  .hero h1,
  .hero-panel h1 {
    font-size: clamp(2rem, 10vw, 3.3rem);
  }
}

@media (max-width: 720px) {
  .redeem-body {
    padding: 14px 12px 24px;
  }

  .page-shell {
    width: min(100% - 20px, 100%);
    padding: 20px 0 36px;
  }

  .hero-panel,
  .hero > .hero-copy,
  .hero-side,
  .panel,
  .tool-card,
  .danger-zone,
  .cards-board,
  .guide-card {
    padding: 22px 18px;
  }

  .brand-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-strip {
    padding: 16px;
  }

  .brand-mark {
    width: 64px;
    height: 64px;
    border-radius: 20px;
  }

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

  .board-actions {
    width: 100%;
  }

  .board-actions > * {
    flex: 1 1 calc(50% - 8px);
  }

  .status-toolbar,
  .status-metrics {
    grid-template-columns: 1fr;
  }

  .preview-box li,
  .card-line,
  .card-meta,
  .record-account {
    grid-template-columns: 1fr;
    display: grid;
    align-items: start;
  }

  .preview-box li,
  .card-line,
  .card-meta {
    gap: 8px;
  }
}

@media (min-width: 1024px) {
  .redeem-body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .redeem-composer-panel,
  .redeem-side-panel {
    overflow: visible;
  }
}
