:root {
  --bg: #f4f7f8;
  --panel: #ffffff;
  --ink: #1b2630;
  --muted: #657380;
  --line: #d9e2e7;
  --accent: #087f8c;
  --accent-dark: #05606a;
  --amber: #b96f00;
  --rose: #b42335;
  --green: #167246;
  --shadow: 0 16px 42px rgba(28, 43, 54, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(140deg, rgba(8, 127, 140, 0.1), transparent 38%),
    linear-gradient(40deg, rgba(185, 111, 0, 0.08), transparent 34%),
    var(--bg);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

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

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.redeem-surface,
.admin-login,
.panel,
.metrics div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.redeem-surface {
  width: min(720px, 100%);
  padding: 30px;
}

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

.admin-link,
.ghost-link,
button,
.download-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button,
.download-link {
  border: 0;
  padding: 0 16px;
  color: white;
  background: var(--accent);
}

button:hover,
.download-link:hover {
  background: var(--accent-dark);
}

.ghost-button,
.ghost-link,
.admin-link {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #f7fafb;
  padding: 0 14px;
}

.ghost-button:hover,
.ghost-link:hover,
.admin-link:hover {
  background: #eef4f6;
}

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

.redeem-form {
  margin-top: 28px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #344451;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  color: var(--ink);
  font: inherit;
  outline: none;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 127, 140, 0.14);
}

.input-action {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.notice {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  line-height: 1.7;
  color: var(--muted);
  background: #f8fafb;
}

.notice.compact {
  margin-top: 12px;
}

.notice.success {
  border-color: rgba(22, 114, 70, 0.3);
  color: var(--green);
  background: rgba(22, 114, 70, 0.08);
}

.notice.error {
  border-color: rgba(180, 35, 53, 0.28);
  color: var(--rose);
  background: rgba(180, 35, 53, 0.07);
}

.notice a {
  margin-top: 8px;
}

.admin-page {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 46px;
}

.admin-login {
  width: min(420px, 100%);
  margin: 10vh auto 0;
  padding: 26px;
}

.dashboard-head {
  margin-bottom: 18px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.metrics div {
  padding: 16px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.metrics strong {
  font-size: 28px;
}

.work-grid,
.simple-grid,
.list-grid {
  display: grid;
  gap: 16px;
}

.work-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: start;
}

.simple-grid {
  grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 1.1fr);
  align-items: stretch;
}

.list-grid {
  grid-template-columns: 1fr;
  margin-top: 16px;
}

.panel {
  padding: 18px;
  min-width: 0;
  overflow: hidden;
}

.output-box {
  min-height: 238px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.download-link {
  width: 100%;
  margin-top: 12px;
}

.download-link.disabled {
  pointer-events: none;
  opacity: 0.45;
}

.list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fbfcfd;
  min-width: 0;
}

.list-item strong {
  display: block;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.list-item span,
.list-item small {
  display: block;
  color: var(--muted);
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 960px) {
  .work-grid,
  .simple-grid,
  .list-grid,
  .metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .redeem-surface,
  .admin-login,
  .panel {
    padding: 18px;
  }

  .topbar,
  .dashboard-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .input-action {
    grid-template-columns: 1fr;
  }

  button,
  .admin-link,
  .ghost-link,
  .download-link {
    width: 100%;
  }
}
