:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --surface: #ffffff;
  --ink: #17211e;
  --muted: #6d7975;
  --line: #dfe7e4;
  --green: #087f5b;
  --green-dark: #066447;
  --green-soft: #e9f7f1;
  --amber: #a96300;
  --amber-soft: #fff4dc;
  --red: #b42318;
  --red-soft: #fff0ee;
  --blue: #245ea8;
  --blue-soft: #edf4ff;
  --shadow: 0 16px 45px rgba(31, 57, 49, 0.09);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }

.page-shell { max-width: 1220px; margin: 0 auto; padding: 38px 24px 64px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 0; font-size: clamp(28px, 4vw, 44px); line-height: 1.08; letter-spacing: -.04em; }
.subtitle { margin: 12px 0 0; color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.mode-badge { display: inline-flex; align-items: center; padding: 9px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--amber-soft); color: var(--amber); }
.mode-badge.wechat { background: var(--green-soft); color: var(--green); }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.summary-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 19px 20px; box-shadow: 0 7px 20px rgba(31,57,49,.045); }
.summary-card span { display: block; color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.summary-card strong { font-size: 30px; }
.unpaid-card strong { color: var(--red); }
.paid-card strong { color: var(--green); }
.pending-card strong { color: var(--amber); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; margin-bottom: 14px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter { border: 0; border-radius: 12px; padding: 10px 13px; background: transparent; color: var(--muted); font-weight: 700; }
.filter:hover { background: #f1f5f3; }
.filter.active { background: var(--ink); color: white; }
.search-box { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.search-box input { width: 190px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; outline: none; background: #fbfcfc; }
.search-box input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(8,127,91,.12); }

.table-card { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { text-align: left; padding: 16px 18px; border-bottom: 1px solid #edf1ef; }
th { color: var(--muted); font-size: 12px; letter-spacing: .05em; text-transform: uppercase; background: #fbfcfc; }
tbody tr:hover { background: #fcfefd; }
tbody tr:last-child td { border-bottom: 0; }
.action-col { text-align: right; }
td:last-child { text-align: right; }
.seat-name { font-weight: 800; }
.money { font-variant-numeric: tabular-nums; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-unpaid { background: var(--red-soft); color: var(--red); }
.status-paid { background: var(--green-soft); color: var(--green); }
.status-pending { background: var(--amber-soft); color: var(--amber); }
.status-refunding { background: var(--blue-soft); color: var(--blue); }
.time-muted { color: var(--muted); font-size: 13px; }
.empty-state { padding: 48px; text-align: center; color: var(--muted); }

.btn { display: inline-flex; justify-content: center; align-items: center; border: 0; border-radius: 11px; padding: 10px 14px; text-decoration: none; font-weight: 800; transition: .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--green); color: white; }
.btn.primary:hover { background: var(--green-dark); }
.btn.secondary { background: #eef3f1; color: var(--ink); }
.btn.refund { background: var(--red-soft); color: var(--red); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.wide { width: 100%; margin-top: 12px; padding: 13px 16px; }

.modal[hidden], .toast[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(12, 23, 19, .62); backdrop-filter: blur(5px); }
.modal-panel { position: relative; width: min(420px, 100%); background: white; border-radius: 24px; padding: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.25); text-align: center; }
.modal-panel h2 { margin: 0; font-size: 25px; }
.modal-close { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #f1f4f3; font-size: 24px; color: var(--muted); }
.modal-seat { margin: 8px 0 18px; color: var(--muted); }
.qr-frame { width: 230px; height: 230px; margin: 0 auto 16px; padding: 12px; background: white; border: 1px solid var(--line); border-radius: 18px; }
.qr-frame img { width: 100%; height: 100%; object-fit: contain; }
.amount-line { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.amount-line span { color: var(--muted); }
.amount-line strong { font-size: 22px; }
.payment-tip { color: var(--muted); font-size: 13px; line-height: 1.6; }
.payment-status { padding: 11px 12px; border-radius: 12px; font-weight: 800; }
.payment-status.pending { background: var(--amber-soft); color: var(--amber); }
.payment-status.paid { background: var(--green-soft); color: var(--green); }
.payment-status.failed { background: var(--red-soft); color: var(--red); }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 40; transform: translateX(-50%); padding: 12px 18px; border-radius: 12px; background: var(--ink); color: white; box-shadow: var(--shadow); }

@media (max-width: 780px) {
  .page-shell { padding: 24px 14px 48px; }
  .topbar { flex-direction: column; }
  .header-actions { justify-content: flex-start; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-box input { flex: 1; width: auto; }
}

/* Production additions */
.user-area { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-name { color: var(--muted); font-size: 14px; }
.btn.danger { background: #fff1f2; border-color: #fecdd3; color: #be123c; }
.btn.danger:hover { background: #ffe4e6; }
.system-note { margin: 0 0 18px; padding: 12px 16px; border: 1px solid #dbeafe; background: #eff6ff; color: #1e40af; border-radius: 12px; font-size: 14px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #f5f7fb; }
.login-card { width: min(420px, 100%); background: white; border: 1px solid var(--line); border-radius: 22px; padding: 34px; box-shadow: 0 18px 50px rgba(15,23,42,.08); }
.login-card h1 { margin: 6px 0 8px; }
.login-card .subtitle { margin-bottom: 24px; }
.form-field { display: grid; gap: 8px; margin: 16px 0; }
.form-field span { font-size: 14px; font-weight: 700; }
.form-field input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px 13px; font: inherit; outline: none; }
.form-field input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.login-error { padding: 10px 12px; border-radius: 10px; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; font-size: 14px; }
.login-help { margin: 16px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
.btn[disabled] { opacity: .58; cursor: not-allowed; }
.payment-expiry { color: var(--muted); font-size: 13px; text-align: center; margin: 4px 0 10px; }
.status-error { color: #b91c1c; }
@media (max-width: 720px) {
  .header-actions { align-items: flex-start; }
  .user-area { width: 100%; }
  .user-area .btn { flex: 1; text-align: center; }
}
