:root {
  --ink: #183728;
  --forest: #1c4a35;
  --moss: #6b8e57;
  --cream: #f5f1e8;
  --paper: #fffdf8;
  --line: #dcd8cc;
  --muted: #758177;
  --orange: #d87542;
  --red: #b54b43;
  --shadow: 0 20px 50px rgba(26, 56, 38, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 84% 0, rgba(170, 198, 125, 0.38), transparent 23rem),
    linear-gradient(115deg, #edf0e5, var(--cream) 47%, #f3eadb);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 52px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 34px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 24px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #fff;
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 17px;
  border-radius: 12px 12px 12px 3px;
  background: var(--forest);
  box-shadow: 5px 5px 0 #b5ca8f;
}

.nav-link {
  color: #58705d;
  font-size: 14px;
  text-decoration: none;
}

.nav-link:hover {
  color: var(--forest);
}

.hero-panel {
  position: relative;
  overflow: hidden;
  padding: 46px;
  border: 1px solid rgba(70, 101, 67, 0.17);
  border-radius: 26px;
  background: rgba(255, 253, 248, 0.7);
  box-shadow: var(--shadow);
}

.hero-panel::after {
  position: absolute;
  right: -62px;
  bottom: -92px;
  width: 260px;
  height: 260px;
  border: 38px solid rgba(174, 198, 126, 0.25);
  border-radius: 50%;
  content: "";
}

.kicker {
  position: relative;
  z-index: 1;
  color: var(--moss);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin-top: 12px;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.14;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 570px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.content-grid {
  display: grid;
  grid-template-columns: 0.88fr 1.12fr;
  gap: 24px;
  margin-top: 24px;
}

.auth-layout {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.auth-card {
  width: min(100%, 560px);
}

.card {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.82);
  box-shadow: 0 12px 32px rgba(36, 61, 42, 0.06);
}

.card h2 {
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 26px;
}

.card-intro {
  margin-top: 9px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

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

.field label {
  font-size: 14px;
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  color: var(--ink);
  border: 1px solid #cdd5c4;
  border-radius: 10px;
  outline: 0;
  background: #fffefa;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgba(107, 142, 87, 0.16);
}

.field textarea {
  min-height: 94px;
  resize: vertical;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  padding: 0 18px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border: 0;
  border-radius: 10px;
  background: var(--forest);
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.button:hover {
  background: #123b28;
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.55;
  transform: none;
}

.button--orange {
  background: var(--orange);
}

.button--orange:hover {
  background: #bd5e2d;
}

.button--quiet {
  color: var(--forest);
  border: 1px solid #b9cbb0;
  background: transparent;
}

.button--quiet:hover {
  background: #edf4e8;
}

.button--danger {
  color: var(--red);
  border: 1px solid #e2b3ad;
  background: transparent;
}

.button--danger:hover {
  background: #fff0ee;
}

.form-submit {
  width: 100%;
  margin-top: 24px;
}

.auth-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
}

.auth-switch__button {
  padding: 0;
  color: var(--forest);
  font-weight: 700;
  border: 0;
  background: transparent;
}

.auth-switch__button:hover {
  text-decoration: underline;
}

.notice {
  display: none;
  margin-top: 17px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  border-radius: 10px;
}

.notice.is-visible {
  display: block;
}

.notice--success {
  color: #285332;
  background: #e5f0df;
}

.notice--error {
  color: #843d35;
  background: #fce8e5;
}

.merchant-summary {
  display: grid;
  gap: 16px;
}

.summary-box {
  padding: 19px;
  border-radius: 14px;
  background: #eaf0e3;
}

.summary-box strong,
.summary-box span {
  display: block;
}

.summary-box strong {
  font-size: 20px;
}

.summary-box span {
  margin-top: 6px;
  color: #647567;
  font-size: 13px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
}

.status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  content: "";
}

.status--pending {
  color: #8c5b1f;
  background: #fff0cd;
}

.status--pending::before {
  background: #d99429;
}

.status--approved {
  color: #2b633b;
  background: #e0efdd;
}

.status--approved::before {
  background: #4d985a;
}

.status--rejected {
  color: #93423c;
  background: #f8e2de;
}

.status--rejected::before {
  background: #c65a4e;
}

.status--handled {
  color: #295d71;
  background: #e0f2f8;
}

.status--handled::before {
  background: #3c93b1;
}

.token-box {
  margin-top: 18px;
  padding: 16px;
  border: 1px dashed #9eb58e;
  border-radius: 12px;
  background: #f6faee;
}

.token-box code {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
  color: #2a5035;
  font-family: Consolas, monospace;
  font-size: 12px;
}

.hidden {
  display: none !important;
}

.dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.dashboard-header h1 {
  font-size: 37px;
}

.dashboard-header .hero-copy {
  max-width: 640px;
}

.dashboard-header--compact {
  align-items: center;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar input {
  min-width: 240px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #cdd5c4;
  border-radius: 10px;
  outline: none;
  background: #fffefa;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.refresh-config {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  margin-bottom: 24px;
}

.refresh-config__form {
  display: flex;
  align-items: end;
  gap: 10px;
}

.refresh-config__form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.refresh-config__form input {
  width: 112px;
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  border: 1px solid #cdd5c4;
  border-radius: 10px;
  outline: 0;
  background: #fffefa;
}

.refresh-config .notice {
  grid-column: 1 / -1;
  margin-top: -6px;
}

.stat {
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.82);
}

.stat strong,
.stat span {
  display: block;
}

.stat strong {
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 33px;
}

.stat span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.merchant-list,
.qr-list {
  display: grid;
  gap: 13px;
  margin-top: 22px;
}

.collapsible-panel {
  margin-top: 18px;
}

.merchant-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(190px, 1.1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 20px;
  border: 1px solid #e2e0d8;
  border-radius: 14px;
  background: #fffefa;
}

.merchant-name {
  font-size: 17px;
  font-weight: 700;
}

.merchant-meta {
  display: grid;
  gap: 5px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.merchant-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.qr-list {
  grid-template-columns: 1fr;
}

.qr-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px;
  cursor: pointer;
  border: 1px solid #dce3d5;
  border-radius: 14px;
  outline: 0;
  background: #fffefa;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.qr-list-item:hover,
.qr-list-item:focus-visible {
  border-color: #9eb88c;
  box-shadow: 0 8px 22px rgba(36, 81, 51, 0.1);
  transform: translateY(-1px);
}

.qr-list-item .qr-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 0;
}

.qr-name {
  overflow: hidden;
  font-size: 16px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-code {
  margin-top: 6px;
  color: var(--forest);
  font-size: 13px;
  font-weight: 700;
}

.qr-date {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.qr-actions {
  display: flex;
  gap: 8px;
  margin-top: 15px;
}

.qr-preview-mask {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 42, 29, 0.58);
}

.qr-preview {
  position: relative;
  width: min(100%, 460px);
  padding: 34px;
  text-align: center;
  border-radius: 22px;
  background: #fffefa;
  box-shadow: 0 24px 70px rgba(11, 34, 20, 0.32);
}

.qr-preview__close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #607163;
  font-size: 30px;
  line-height: 1;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.qr-preview__close:hover {
  color: var(--forest);
  background: #edf4e8;
}

.qr-preview__name {
  margin-top: 10px;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 28px;
}

.qr-preview__code {
  margin-top: 10px;
  color: var(--forest);
  font-size: 14px;
  font-weight: 700;
}

.qr-preview__image {
  display: block;
  width: min(100%, 340px);
  margin: 24px auto 0;
  padding: 16px;
  background: #ffffff;
}

.qr-preview__date {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.admin-modal-mask {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 42, 29, 0.58);
}

.admin-modal {
  position: relative;
  width: min(100%, 760px);
  max-height: min(88vh, 900px);
  overflow: auto;
  padding: 34px;
  border-radius: 22px;
  background: #fffefa;
  box-shadow: 0 24px 70px rgba(11, 34, 20, 0.32);
}

.admin-modal__close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #607163;
  font-size: 30px;
  line-height: 1;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.admin-modal__close:hover {
  color: var(--forest);
  background: #edf4e8;
}

.admin-modal__title {
  margin-top: 10px;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 28px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.detail-card {
  padding: 14px;
  border: 1px solid #dde4d6;
  border-radius: 14px;
  background: #f8faf4;
}

.detail-card strong,
.detail-card span {
  display: block;
}

.detail-card strong {
  font-size: 13px;
}

.detail-card span {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.detail-section {
  margin-top: 22px;
}

.detail-section h3 {
  font-size: 18px;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.detail-row {
  padding: 12px 14px;
  border: 1px solid #e0e5db;
  border-radius: 12px;
  background: #fffefa;
}

.detail-row strong,
.detail-row span {
  display: block;
}

.detail-row strong {
  color: var(--forest);
  font-size: 14px;
}

.detail-row span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.empty {
  padding: 48px 22px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed #c6d2bd;
  border-radius: 14px;
}

.empty--compact {
  padding: 18px 16px;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 28px, 620px);
    padding-top: 20px;
  }

  .masthead {
    margin-bottom: 22px;
  }

  .hero-panel,
  .card {
    padding: 25px;
  }

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

  .auth-layout {
    margin-top: 18px;
  }

  .dashboard-header,
  .merchant-row {
    display: flex;
    align-items: stretch;
    flex-direction: column;
  }

  .refresh-config,
  .refresh-config__form {
    display: flex;
    align-items: stretch;
    flex-direction: column;
  }

  .refresh-config__form input {
    width: 100%;
  }

  .toolbar,
  .toolbar input {
    width: 100%;
  }

  .toolbar input {
    min-width: 0;
  }

  .merchant-actions {
    justify-content: flex-start;
  }

  .qr-list-item {
    align-items: stretch;
    flex-direction: column;
  }

  .qr-list-item .qr-actions {
    justify-content: flex-start;
  }

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

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