:root {
  --bg: #0b1220;
  --card: #131d30;
  --card-2: #182338;
  --line: rgba(255, 255, 255, 0.08);
  --text: #e8eef8;
  --muted: #8ea1ba;
  --accent: #5eead4;
  --accent-2: #60a5fa;
  --cloth: #f59e0b;
  --general: #5eead4;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 18px;
  --pad: 20px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background:
    radial-gradient(1000px 620px at 82% -12%, rgba(96, 165, 250, 0.18), transparent 60%),
    radial-gradient(760px 520px at -8% 2%, rgba(94, 234, 212, 0.12), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
    "Helvetica Neue", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

body.lock { overflow: hidden; }

.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) var(--pad)
           calc(30px + env(safe-area-inset-bottom));
}

/* ---------------- 顶栏 ---------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0 16px;
}

.brand { font-size: 15px; font-weight: 600; letter-spacing: 0.02em; }

.chip {
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}
.chip:active { transform: scale(0.98); }

/* ---------------- 登录 ---------------- */

.login { padding-top: 12vh; text-align: center; }

.mark {
  width: 62px;
  height: 62px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  font-size: 26px;
  font-weight: 700;
  color: #04211d;
  background: linear-gradient(140deg, var(--accent), #7dd3fc);
  box-shadow: 0 14px 34px -14px rgba(94, 234, 212, 0.7);
}

.login h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.01em; }

.sub { color: var(--muted); font-size: 14px; margin: 0 0 26px; }

.login-form { display: grid; gap: 12px; text-align: left; }

.hint { color: var(--muted); font-size: 12px; margin: 22px 0 0; }

/* ---------------- 汇总卡 ---------------- */

.summary-card {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 20px;
  background: linear-gradient(150deg, #17324a 0%, #15243a 55%, #131d30 100%);
  border: 1px solid rgba(94, 234, 212, 0.22);
}

.summary-card::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -70px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(94, 234, 212, 0.25), transparent 65%);
}

.s-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

.live { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; }
.live i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.16);
}

.s-num { display: flex; align-items: baseline; gap: 8px; margin: 8px 0 12px; }

.s-num span {
  font-size: 64px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  background: linear-gradient(100deg, #ffffff, #9ff3e4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}

.s-num em { font-style: normal; color: var(--muted); font-size: 15px; }

.s-kinds { display: flex; gap: 8px; flex-wrap: wrap; }

.kind-pill {
  --kc: var(--accent);
  font-size: 11.5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.kind-pill[data-kind="cloth"] { --kc: var(--cloth); }
.kind-pill[data-kind="general"] { --kc: var(--general); }
.kind-pill i { width: 6px; height: 6px; border-radius: 2px; background: var(--kc); }
.kind-pill b { color: var(--text); font-weight: 600; }

/* ---------------- 面板 ---------------- */

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 14px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
}

.panel h2 { font-size: 15px; margin: 0; font-weight: 600; letter-spacing: 0.01em; }

.panel-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.count {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: #04211d;
  background: var(--accent);
}

/* ---------------- 表单 ---------------- */

input, textarea {
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease;
  resize: vertical;
}

input::placeholder, textarea::placeholder { color: rgba(142, 161, 186, 0.6); }
input:focus, textarea:focus {
  border-color: rgba(94, 234, 212, 0.55);
  background: rgba(94, 234, 212, 0.06);
}

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

.field { display: grid; gap: 7px; font-size: 13px; color: var(--muted); }
.field em { font-style: normal; opacity: 0.7; }

.btn {
  font: inherit;
  border: 0;
  cursor: pointer;
  width: 100%;
  padding: 13px 16px;
  border-radius: 13px;
  font-weight: 600;
  font-size: 15px;
  transition: transform 0.12s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.985); }
.btn[disabled] { opacity: 0.55; cursor: default; }

.btn-primary {
  color: #04211d;
  background: linear-gradient(100deg, var(--accent), #7dd3fc);
  box-shadow: 0 10px 26px -14px rgba(94, 234, 212, 0.8);
}

/* 券类型选择 */
.kind-picker { display: flex; gap: 8px; flex-wrap: wrap; }

.kind-chip {
  --kc: var(--accent);
  font: inherit;
  font-size: 13px;
  padding: 9px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.kind-chip[data-kind="cloth"] { --kc: var(--cloth); }
.kind-chip[data-kind="general"] { --kc: var(--general); }
.kind-chip i { width: 6px; height: 6px; border-radius: 2px; background: var(--kc); opacity: 0.6; }
.kind-chip.active { color: var(--text); border-color: rgba(94, 234, 212, 0.5); background: rgba(94, 234, 212, 0.1); }
.kind-chip[data-kind="cloth"].active { border-color: rgba(245, 158, 11, 0.5); background: rgba(245, 158, 11, 0.12); }
.kind-chip.active i { opacity: 1; }

.qty-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; }

.stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
}

.stepper button {
  font: inherit;
  width: 34px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.stepper button:active { background: rgba(94, 234, 212, 0.2); }

.stepper input {
  width: 52px;
  text-align: center;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------------- 券卡片 ---------------- */

.cards { display: grid; gap: 10px; }

.vcard {
  --kc: var(--accent);
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 13px 14px 13px 17px;
}
.vcard::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--kc);
  opacity: 0.85;
}
.vcard[data-kind="cloth"] { --kc: var(--cloth); }
.vcard[data-kind="general"] { --kc: var(--general); }
.vcard.is-used { opacity: 0.94; }

.v-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.v-kind { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; }
.v-kind i { width: 7px; height: 7px; border-radius: 2px; background: var(--kc); flex-shrink: 0; }

.v-no { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.v-desc { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.v-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 11px; }
.v-time { font-size: 11px; color: var(--muted); }

.v-body { display: flex; gap: 10px; margin-top: 10px; align-items: flex-start; }

.v-thumb {
  width: 58px;
  height: 58px;
  border-radius: 11px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex-shrink: 0;
  background: #0d1626;
  display: block;
}

.v-thumb-empty {
  width: 58px;
  height: 58px;
  border-radius: 11px;
  border: 1px dashed var(--line);
  display: grid;
  place-items: center;
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
}

.v-reason { margin: 0; font-size: 13px; line-height: 1.45; word-break: break-word; }
.v-meta { margin: 3px 0 0; font-size: 11px; color: var(--muted); }

/* 待确认卡片 */
.pcard {
  --kc: var(--accent);
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(251, 191, 36, 0.22);
  border-radius: 15px;
  padding: 13px 14px;
  display: grid;
  gap: 8px;
}
.pcard[data-kind="cloth"] { --kc: var(--cloth); }
.pcard[data-kind="general"] { --kc: var(--general); }

.p-actions { display: flex; gap: 8px; margin-top: 2px; }
.p-actions .btn-mini { flex: 1; padding: 9px 12px; }

.v-thumb[data-photo] { cursor: zoom-in; }

/* 看大图 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(3, 7, 14, 0.94);
  display: grid;
  place-items: center;
  padding: 18px;
  animation: fade 0.15s ease;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; object-fit: contain; }

/* ---------------- 列表（发行记录） ---------------- */

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

.row-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 11px 13px;
}

.row-main { min-width: 0; flex: 1; }

.row-title { margin: 0; font-size: 13.5px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.row-meta { margin: 3px 0 0; font-size: 11.5px; color: var(--muted); }

.row-actions { display: flex; gap: 6px; flex-shrink: 0; }

.btn-mini {
  font: inherit;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 9px;
  cursor: pointer;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
}
.btn-mini:active { transform: scale(0.97); }
.btn-mini:disabled { opacity: 0.5; }

.btn-ok {
  color: #04211d;
  background: linear-gradient(100deg, var(--accent), #7dd3fc);
  border-color: transparent;
  font-weight: 600;
}

.badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-pending { color: #3b2400; background: var(--warn); }
.badge-issue { color: #04211d; background: var(--accent); }
.badge-issue[data-kind="cloth"] { background: var(--cloth); }

.plus { color: var(--accent); font-weight: 600; }

.empty { color: var(--muted); font-size: 13px; margin: 4px 0 0; text-align: center; padding: 10px 0; }

.foot { text-align: center; color: var(--muted); font-size: 11.5px; padding-top: 22px; opacity: 0.7; }

.err { color: var(--danger); font-size: 13px; margin: 2px 0 0; }

/* ---------------- 兑换面板 ---------------- */

.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }

.sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 14, 0.68);
  backdrop-filter: blur(3px);
  animation: fade 0.18s ease;
}

.sheet-panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #121b2c;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  padding: 10px 20px calc(22px + env(safe-area-inset-bottom));
  animation: rise 0.22s ease;
}

@keyframes rise { from { transform: translateY(26px); opacity: 0.5; } to { transform: translateY(0); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.grip { width: 38px; height: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.18); margin: 4px auto 14px; }

.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.sheet h2 { font-size: 17px; margin: 0; }

.sheet-desc { color: var(--muted); font-size: 13px; margin: 8px 0 16px; line-height: 1.55; }

.upload {
  width: 100%;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 12px;
  padding: 16px;
  font: inherit;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}
.upload:active { background: rgba(94, 234, 212, 0.08); }
.upload-icon { font-size: 17px; color: var(--accent); }

.preview { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.preview img { width: 76px; height: 76px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }

/* ---------------- toast ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  background: #0f1a2c;
  border: 1px solid rgba(94, 234, 212, 0.4);
  color: var(--text);
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 70;
  max-width: calc(100% - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: rgba(248, 113, 113, 0.45); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
