:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --ink: #17201a;
  --muted: #667168;
  --panel: #ffffff;
  --line: #dfe5de;
  --accent: #1f7a5d;
  --accent-strong: #13583f;
  --warm: #e98f44;
  --danger: #b63d3d;
  --shadow: 0 18px 42px rgba(23, 32, 26, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.summary-panel {
  min-height: 218px;
  display: grid;
  grid-template-columns: 1fr minmax(240px, 320px);
  align-items: end;
  gap: 24px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(31, 122, 93, 0.12), rgba(233, 143, 68, 0.14)),
    var(--panel);
  box-shadow: var(--shadow);
}

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

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 12px;
  font-size: clamp(34px, 6vw, 62px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.2;
}

.subcopy {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.balance-card {
  min-height: 148px;
  padding: 20px;
  border: 1px solid rgba(31, 122, 93, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.balance-card span,
.balance-card small,
.stats-grid span,
.stats-grid small {
  color: var(--muted);
}

.balance-card strong {
  font-size: 54px;
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 390px) 1fr;
  gap: 20px;
  margin-top: 20px;
}

.redemption-panel {
  margin-top: 20px;
}

.left-column,
.right-column {
  display: grid;
  gap: 20px;
  align-content: start;
}

.tool-panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(23, 32, 26, 0.06);
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-heading.compact {
  align-items: center;
  margin-bottom: 14px;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: var(--accent-strong);
  background: #e7f0ec;
  font-size: 20px;
}

.icon-button.danger {
  color: var(--danger);
  background: #fae9e7;
}

.text-button {
  color: var(--accent-strong);
  background: transparent;
  font-weight: 700;
}

.burn-form,
.tea-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fbfcfb;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 122, 93, 0.14);
}

button[type="submit"],
.form-actions button {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 18px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

button.secondary {
  color: var(--accent-strong);
  background: #e7f0ec;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.stats-grid div {
  min-width: 0;
  padding: 14px 12px;
  border-radius: 8px;
  background: #f5f8f5;
}

.stats-grid strong {
  display: block;
  margin: 4px 0;
  font-size: 24px;
}

.history-list {
  display: grid;
  gap: 10px;
  max-height: 260px;
  overflow: auto;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.history-item strong {
  white-space: nowrap;
}

.pill {
  align-self: center;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: #e7f0ec;
  font-size: 13px;
  font-weight: 800;
}

.vending-machine {
  padding: 18px;
  border: 1px solid #7f3835;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.18), transparent 32%),
    #b9483f;
  box-shadow: var(--shadow);
}

.vending-sign {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 16px 18px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0)),
    #862f33;
}

.vending-sign .eyebrow,
.vending-sign h2 {
  color: #fff;
}

.vending-sign .eyebrow {
  margin-bottom: 6px;
  opacity: 0.82;
}

.sign-lights {
  display: flex;
  gap: 8px;
}

.sign-lights span {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: #ffe38e;
  box-shadow: 0 0 16px rgba(255, 227, 142, 0.75);
}

.sign-lights span:nth-child(2) {
  background: #9fe1c7;
  box-shadow: 0 0 16px rgba(159, 225, 199, 0.75);
}

.sign-lights span:nth-child(3) {
  background: #f6b6a2;
  box-shadow: 0 0 16px rgba(246, 182, 162, 0.75);
}

.vending-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 178px;
  gap: 16px;
  margin-top: 16px;
}

.vending-window {
  position: relative;
  min-height: 430px;
  padding: 16px;
  border: 7px solid #7e3032;
  border-radius: 8px;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.42) 0 7%, transparent 7% 20%, rgba(255, 255, 255, 0.2) 20% 27%, transparent 27%),
    linear-gradient(#f8fbf9 0 0);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.vending-window::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 6px;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.28), transparent 34%);
}

.vending-control {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
  padding: 14px;
  border-radius: 8px;
  background: #6e2830;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.machine-screen,
.machine-balance {
  display: grid;
  gap: 7px;
  padding: 12px;
  border-radius: 8px;
  background: #10251e;
  color: #d9fff1;
  box-shadow: inset 0 0 18px rgba(159, 225, 199, 0.15);
}

.machine-screen span,
.machine-balance span {
  color: #9fe1c7;
  font-size: 11px;
  font-weight: 800;
}

.machine-screen .pill {
  justify-self: start;
  border-radius: 6px;
  color: #10251e;
  background: #9fe1c7;
}

.machine-balance strong {
  font-size: 20px;
}

.coin-slot {
  height: 42px;
  border-radius: 8px;
  background:
    linear-gradient(#221a1c 0 0) center / 84px 8px no-repeat,
    #d5d8d1;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.08);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.keypad span {
  display: grid;
  place-items: center;
  min-height: 38px;
  border-radius: 7px;
  color: #2a2022;
  background: #f2eee7;
  font-size: 13px;
  font-weight: 900;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.1);
}

.pickup-slot {
  min-height: 78px;
  display: grid;
  place-items: center;
  border: 5px solid #3e1c21;
  border-radius: 8px;
  color: #f2eee7;
  background: #1f1518;
  font-weight: 900;
}

.pickup-slot.dispensing {
  animation: pickupPulse 900ms ease-in-out 2;
}

.ticket-strip {
  width: min(108px, 86%);
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #6e2830;
  background:
    linear-gradient(90deg, transparent 0 8px, rgba(255, 255, 255, 0.45) 8px 12px, transparent 12px 20px),
    #fff5d7;
  font-size: 13px;
  font-weight: 900;
  transform: translateY(-38px);
  opacity: 0;
  animation: ticketDrop 1200ms ease forwards;
}

.sync-button {
  min-height: 42px;
  border-radius: 8px;
  color: #10251e;
  background: #9fe1c7;
  font-weight: 900;
}

.tea-grid {
  display: grid;
  gap: 18px;
}

.brand-zone {
  display: grid;
  gap: 12px;
}

.brand-zone + .brand-zone {
  padding-top: 18px;
  border-top: 1px solid rgba(126, 48, 50, 0.18);
}

.brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #fff;
  background: #7e3032;
}

.brand-header strong {
  overflow-wrap: anywhere;
}

.brand-header span {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 900;
  opacity: 0.86;
}

.brand-header.alittle {
  background: #8a6c44;
}

.brand-header.mixue {
  background: #c9403c;
}

.brand-header.heytea {
  background: #173b31;
}

.brand-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

.tea-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(126, 48, 50, 0.24);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(44, 25, 20, 0.1);
}

.tea-card::after {
  content: "";
  display: block;
  height: 8px;
  background:
    repeating-linear-gradient(90deg, #5d4240 0 16px, #c7b9aa 16px 26px);
}

.slot-label {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  min-width: 34px;
  padding: 4px 7px;
  border-radius: 6px;
  color: #fff;
  background: rgba(23, 32, 26, 0.78);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.tea-image,
.image-preview {
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(31, 122, 93, 0.12), rgba(233, 143, 68, 0.16)),
    #f6f4ef;
  color: var(--muted);
  text-align: center;
}

.tea-image {
  aspect-ratio: 1 / 1;
}

.tea-image img,
.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tea-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.tea-title-row {
  display: grid;
  gap: 5px;
}

.tea-title-row h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.tea-brand-tag {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tea-price {
  color: var(--warm);
  font-weight: 900;
  white-space: nowrap;
}

.tea-actions {
  display: grid;
  grid-template-columns: 1fr 40px 40px;
  gap: 8px;
}

.tea-actions button {
  min-height: 38px;
  border-radius: 8px;
  font-weight: 800;
}

.buy-btn {
  color: #fff;
  background: var(--accent);
}

.buy-btn:disabled {
  cursor: not-allowed;
  color: #818b83;
  background: #e7ebe6;
}

.mini-btn {
  color: var(--ink);
  background: #f1f4f1;
}

.mini-btn.delete {
  color: var(--danger);
  background: #fae9e7;
}

.file-picker input {
  display: none;
}

.file-picker span {
  min-height: 44px;
  display: flex;
  align-items: center;
  border: 1px dashed #b9c6bd;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fbfcfb;
  overflow-wrap: anywhere;
}

.preview-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  align-items: stretch;
}

.image-preview {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
}

.form-actions {
  display: grid;
  gap: 10px;
  align-content: end;
}

.storage-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.secondary-action,
.import-action {
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--accent-strong);
  background: #e7f0ec;
  font-weight: 900;
  text-align: center;
}

.import-action {
  cursor: pointer;
}

.import-action input {
  display: none;
}

.empty-state {
  padding: 24px;
  border: 1px dashed #b9c6bd;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.redemption-records {
  display: grid;
  gap: 10px;
}

.redemption-record {
  display: grid;
  grid-template-columns: minmax(140px, 190px) 1fr auto;
  gap: 14px;
  align-items: center;
  min-height: 58px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.redemption-record time,
.redemption-record span {
  color: var(--muted);
  font-size: 14px;
}

.redemption-record strong {
  overflow-wrap: anywhere;
}

.coupon-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 18, 15, 0.82);
}

.coupon-overlay[hidden] {
  display: none;
}

.coupon-viewer {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  display: grid;
  gap: 16px;
  padding: 20px;
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.35);
}

.coupon-heading {
  padding-right: 44px;
}

.coupon-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: var(--ink);
  background: #f1f4f1;
  font-size: 26px;
  line-height: 1;
}

.coupon-image {
  width: 100%;
  max-height: calc(100vh - 210px);
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
}

.download-button {
  min-height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 900;
  text-decoration: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  max-width: min(520px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  background: rgba(23, 32, 26, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

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

@keyframes pickupPulse {
  0%,
  100% {
    box-shadow: none;
  }

  50% {
    box-shadow: 0 0 0 5px rgba(255, 227, 142, 0.24), inset 0 0 22px rgba(255, 227, 142, 0.2);
  }
}

@keyframes ticketDrop {
  0% {
    opacity: 0;
    transform: translateY(-38px);
  }

  35% {
    opacity: 1;
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .summary-panel,
  .workspace {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    align-items: stretch;
    padding: 24px;
  }

  .balance-card {
    min-height: 120px;
  }

  .vending-body {
    grid-template-columns: 1fr;
  }

  .vending-control {
    grid-template-columns: repeat(4, 1fr);
    align-items: stretch;
  }

  .machine-screen,
  .machine-balance,
  .coin-slot,
  .pickup-slot {
    min-height: 76px;
  }

  .keypad {
    grid-template-columns: repeat(3, 1fr);
  }

  .redemption-record {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 10px 0;
  }

  .summary-panel,
  .tool-panel,
  .vending-machine {
    padding: 18px;
  }

  h1 {
    font-size: 34px;
  }

  .stats-grid,
  .preview-row,
  .storage-actions {
    grid-template-columns: 1fr;
  }

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

  .vending-sign,
  .vending-control {
    grid-template-columns: 1fr;
  }

  .vending-window {
    min-height: 0;
    padding: 12px;
    border-width: 5px;
  }
}
