:root {
  --p-blue: #005bea;
  --p-cyan: #00c6fb;
  --p-text: #172033;
  --p-muted: #64748b;
  --p-bg: #f4f7fb;
  --p-surface: rgba(255, 255, 255, 0.9);
  --p-border: rgba(30, 64, 175, 0.09);
  --p-shadow: 0 12px 36px rgba(15, 23, 42, 0.065);
  --p-shadow-hover: 0 18px 46px rgba(0, 91, 234, 0.11);
  --p-radius: 20px;
  --p-radius-sm: 12px;
  --p-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  min-height: 100dvh;
  margin: 0;
  color: var(--p-text);
  background-color: var(--p-bg);
  background-image:
    radial-gradient(ellipse 70% 42% at 4% 0%, rgba(0, 198, 251, 0.075), transparent 72%),
    radial-gradient(ellipse 55% 36% at 100% 0%, rgba(0, 91, 234, 0.055), transparent 72%);
  font-family: "PingFang SC", "Microsoft YaHei UI", "Noto Sans CJK SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { color: #fff; background: rgba(0, 91, 234, 0.82); }
* { scrollbar-width: thin; scrollbar-color: rgba(100, 116, 139, 0.35) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, 0.32); border-radius: 20px; }
*::-webkit-scrollbar-track { background: transparent; }

h1, h2, h3, h4, strong, .value, .num { letter-spacing: -0.018em; }
a, button, .btn, input, select, textarea, .stat-card, .section, .card, tr { transition: color .18s var(--p-ease), background-color .18s var(--p-ease), border-color .18s var(--p-ease), box-shadow .18s var(--p-ease), transform .18s var(--p-ease), opacity .18s var(--p-ease); }
a { color: var(--p-blue); text-decoration: none; }
button, .btn, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, .btn { position: relative; overflow: hidden; }
button:focus-visible, .btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(0, 91, 234, 0.24) !important;
  outline-offset: 3px !important;
}
button:disabled, .btn.disabled, .btn:disabled { cursor: not-allowed; opacity: .52; transform: none !important; box-shadow: none !important; }

.container {
  width: min(1600px, calc(100% - 40px));
  margin-right: auto;
  margin-left: auto;
}

.nav {
  position: sticky;
  top: 12px;
  z-index: 50;
  margin-bottom: 24px;
  border: 1px solid var(--p-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82) !important;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}
.nav a {
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.nav a:hover { color: var(--p-blue); background: rgba(0, 91, 234, 0.065); }
.nav a.active {
  color: #fff !important;
  background: linear-gradient(135deg, var(--p-blue), #1677ff) !important;
  box-shadow: 0 6px 18px rgba(0, 91, 234, 0.22);
}

.stat-card, .section, .card, .table-container, .login-card, .panel {
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  background: var(--p-surface);
  box-shadow: var(--p-shadow);
  backdrop-filter: blur(14px) saturate(135%);
  -webkit-backdrop-filter: blur(14px) saturate(135%);
}
.stat-card { position: relative; overflow: hidden; }
.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 91, 234, 0.15);
  box-shadow: var(--p-shadow-hover);
}
.stat-card .value, .stat-card .num { font-variant-numeric: tabular-nums; }
.section, .card, .table-container { transition: border-color .2s var(--p-ease), box-shadow .2s var(--p-ease), transform .2s var(--p-ease); }
.section:hover, .card:hover, .table-container:hover { border-color: rgba(0, 91, 234, 0.13); }
.stats-row, .tencent-stats-row { gap: 16px; }

.btn, button {
  min-height: 40px;
  border: 0;
  border-radius: var(--p-radius-sm);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}
.btn:hover, button:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(15, 23, 42, 0.11); }
.btn:active, button:active { transform: translateY(0) scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--p-blue), #1478f6); box-shadow: 0 7px 18px rgba(0, 91, 234, 0.2); }
.btn-success { box-shadow: 0 7px 18px rgba(5, 150, 105, 0.16); }
.btn-danger { box-shadow: 0 7px 18px rgba(220, 38, 38, 0.14); }
.btn-secondary { border: 1px solid var(--p-border); background: #f8fafc; color: #334155; }

.field, input[type="text"], input[type="number"], input[type="password"], input[type="date"], input[type="datetime-local"], textarea, select {
  min-height: 42px;
  border: 1px solid #d5deea;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--p-text);
  font: inherit;
  font-size: 14px;
  transition: border-color .18s var(--p-ease), box-shadow .18s var(--p-ease), background-color .18s var(--p-ease);
}
textarea { border-radius: 14px; }
.field:hover, input[type="text"]:hover, input[type="number"]:hover, input[type="password"]:hover, textarea:hover, select:hover { border-color: #a8b8cc; }
.field:focus, input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus, input[type="date"]:focus, input[type="datetime-local"]:focus, textarea:focus, select:focus {
  border-color: rgba(0, 91, 234, 0.62);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 91, 234, 0.09);
  outline: none;
}
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; accent-color: var(--p-blue); cursor: pointer; }

.table-container { overflow: auto; }
table { border-collapse: separate; border-spacing: 0; }
th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #475569;
  background: #f6f9fd;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .025em;
  backdrop-filter: blur(12px);
}
th, td { border-bottom: 1px solid #edf1f7; }
td { font-size: 14px; }
tbody tr:hover { background: rgba(0, 91, 234, 0.032); }
tbody tr:last-child td { border-bottom: 0; }
.table-header h2, .section h2 { color: #16243b; }

.badge { border: 1px solid transparent; border-radius: 999px; font-weight: 650; letter-spacing: .01em; }
.badge-success { border-color: rgba(5, 150, 105, .12); }
.badge-warning { border-color: rgba(217, 119, 6, .14); }
.badge-danger, .badge-error { border-color: rgba(220, 38, 38, .12); }

.ratio-bar-bg { overflow: hidden; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .035); }
.ratio-bar-fill { transition: width .45s var(--p-ease); }

.modal[id], .modal-overlay, .modal-mask {
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}
.modal-content, .modal-overlay > .modal, .modal-mask > .modal, .modal-box {
  max-height: min(88dvh, 920px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, .76);
  border-radius: 22px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 28px 90px rgba(15, 23, 42, .24);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  animation: premium-modal-in .22s var(--p-ease) both;
}
.modal-close, .close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-height: 36px;
  border-radius: 50%;
  color: #64748b;
  background: transparent;
  box-shadow: none;
  font-size: 22px;
}
.modal-close:hover, .close:hover { color: #1e293b; background: #f1f5f9; box-shadow: none; transform: rotate(4deg); }
@keyframes premium-modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.965); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast, #toast {
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 14px;
  box-shadow: 0 16px 44px rgba(15, 23, 42, .18);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.empty { border: 1px dashed #d7e0ec; border-radius: 16px; background: rgba(248, 250, 252, .72); }
.pagination-controls button, .page-btn { min-width: 40px; border: 1px solid var(--p-border); background: #fff; box-shadow: none; }
.pagination-controls button:hover, .page-btn:hover { border-color: rgba(0, 91, 234, .28); color: var(--p-blue); background: rgba(0, 91, 234, .05); }

.premium-ripple {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: currentColor;
  opacity: .13;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  animation: premium-ripple .28s ease-out forwards;
}
@keyframes premium-ripple { to { opacity: 0; transform: translate(-50%, -50%) scale(22); } }

@media (max-width: 768px) {
  body { font-size: 15px; }
  .container { width: min(100% - 24px, 1600px); }
  .nav { top: 6px; margin-bottom: 16px; overflow-x: auto; border-radius: 13px; white-space: nowrap; }
  .stat-card, .section, .card, .table-container, .login-card, .panel { border-radius: 16px; }
  .modal-content, .modal-overlay > .modal, .modal-mask > .modal, .modal-box { width: calc(100vw - 24px) !important; max-width: calc(100vw - 24px) !important; max-height: 90dvh; border-radius: 18px; }
  .btn, button { min-height: 44px; }
  th, td { padding: 10px 9px; }
  td { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* Contrast refinements: keep the existing palette while making dense text readable. */
::placeholder { color: #64748b !important; opacity: 1 !important; }
.hint, .unit, .label, .muted, .text-muted, .text-secondary, .pagination-info, .pagination-bar {
  color: #526174 !important;
}
.stat-card .label { color: #526174 !important; font-weight: 500; }
td { color: #27364a; }
td small, th small, small { font-size: 12px !important; }
td small, th small, small[style*="color:#888"], small[style*="color:#666"] {
  color: #526174 !important;
}
td span[style*="color:#ccc"], td span[style*="color:#888"] { color: #718096 !important; }
td a[style*="font-size:10px"], td span[style*="font-size:11px"], td span[style*="font-size:12px"] { font-size: 12px !important; }
.link-url { color: #005bea !important; font-weight: 500; }
.order-id { color: #526174 !important; font-weight: 500; }
.remain-num.zero { color: #64748b !important; }
.badge-success { color: #047857 !important; }
.badge-warning { color: #b45309 !important; }
.badge-danger, .badge-error { color: #b91c1c !important; }
.badge-primary { color: #005bea !important; }

/* The public redemption page is intentionally dark; do not apply light admin surfaces. */
body.public-redeem {
  background-color: #0d0d0d;
  background-image: none;
  color: #fff;
}
body.public-redeem .card,
body.public-redeem .modal-box,
body.public-redeem .qr-wait-box {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(26, 26, 26, 0.97);
  color: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}
body.public-redeem .notice-title,
body.public-redeem .notice-line,
body.public-redeem .claim-title,
body.public-redeem .scan-title { color: #f4f6fa !important; }
body.public-redeem .tips-title,
body.public-redeem .tip,
body.public-redeem .scan-sub,
body.public-redeem .claim-sub { color: #b4bdca !important; }
body.public-redeem .modal-close { color: #aab5c4 !important; }
body.public-redeem .modal-close:hover { color: #fff !important; background: rgba(255,255,255,.08) !important; }
body.public-redeem .how-link { color: #526174 !important; }
