/* Shared shell and controls. Page-only rules live in the matching page stylesheet. */
body {
  background: var(--gray-50);
  color: var(--text-main);
  font:
    15px/1.6 "Microsoft YaHei",
    sans-serif;
}
a {
  text-decoration: none;
  color: inherit;
}
button,
input {
  font: inherit;
}
.header {
  height: 52px;
  flex-shrink: 0;
  background: white;
  border-bottom: 1px solid var(--gray-200);
}
.header-inner {
  max-width: 1440px;
  height: 100%;
  margin: auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 30px;
}
.brand {
  font-size: 19px;
  font-weight: 700;
  white-space: nowrap;
}
.brand em {
  font-style: normal;
  color: var(--primary);
}
nav {
  display: flex;
  gap: 26px;
  height: 100%;
  align-items: center;
}
nav a {
  color: var(--text-secondary);
  padding: 12px 0;
  border-bottom: 3px solid transparent;
}
nav a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.account {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
}
.account a {
  white-space: nowrap;
}
.account a.active {
  color: var(--primary);
}
main {
  max-width: 1240px;
  min-height: calc(100vh - 190px);
  margin: auto;
  padding: 40px 24px;
}
h1 {
  font-size: 28px;
  font-weight: 650;
  margin: 0 0 8px;
}
h2 {
  font-size: 18px;
  margin: 0 0 14px;
}
.muted {
  color: var(--text-secondary);
}
.intro {
  color: var(--text-secondary);
  margin: 10px 0 28px;
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 26px;
  margin: 20px 0;
}
.badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 12px;
}
.btn,
button {
  display: inline-block;
  background: var(--primary);
  color: white;
  border: 0;
  border-radius: 5px;
  padding: 10px 20px;
  cursor: pointer;
}
.btn:hover,
button:hover {
  background: var(--primary-hover);
}
.layui-btn {
  border-radius: 5px;
  border-color: var(--primary);
  background-color: var(--primary);
  color: white;
}
.layui-btn:hover {
  border-color: var(--primary-hover);
  background-color: var(--primary-hover);
  color: white;
}
.layui-btn-primary {
  background: white;
  border: 1px solid var(--gray-300);
  color: var(--text-main);
}
.layui-btn-primary:hover {
  background: var(--gray-50);
  border-color: var(--primary);
  color: var(--primary);
}
button.secondary {
  background: white;
  border: 1px solid var(--gray-300);
  color: var(--text-main);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
form {
  max-width: 560px;
}
label {
  display: block;
  margin: 16px 0 6px;
  font-size: 13px;
}
input {
  display: block;
  width: 100%;
  padding: 11px 12px;
  margin-top: 7px;
  border: 1px solid var(--gray-300);
  border-radius: 5px;
  background: white;
}
a:focus-visible,
button:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

input:focus,
textarea:focus {
  outline: none;
}

/* Override Layui's green focus ring while keeping the resting border. */
.layui-input:hover,
.layui-input:focus,
.layui-textarea:hover,
.layui-textarea:focus {
  border-color: var(--input-border-color, #eee) !important;
  box-shadow: none;
}
.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.label {
  font-size: 13px;
  color: var(--text-secondary);
}
.form-note {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 12px 0 18px;
  line-height: 1.8;
}
.text-link {
  color: var(--primary);
  font-size: 13px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  width: max-content;
  max-width: 90vw;
  z-index: 2000;
  background: #fff7ee;
  color: #9c441e;
  border: 1px solid #efceb7;
  padding: 14px 22px;
  border-radius: 8px;
  font-size: 14px;
}
.toast.success {
  background: #f0faf2;
  border-color: #bedbc5;
  color: #27643b;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
@media (max-width: 1150px) {
  .header #username {
    display: none;
  }
  .header-inner {
    gap: 20px;
  }
  .header .account {
    gap: 12px;
  }
}
@media (max-width: 850px) {
  .header {
    height: auto;
  }
  .header-inner {
    flex-wrap: wrap;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .header nav {
    order: 3;
    width: 100%;
    height: auto;
  }
  .header nav a {
    padding: 8px 0;
  }
}
@media (max-width: 760px) {
  .header-inner {
    gap: 14px;
    padding: 10px 16px;
  }
  .header .brand {
    font-size: 17px;
  }
  .header .account {
    margin-left: 0;
  }
  main {
    padding: 26px 16px;
  }
  .page-heading {
    align-items: flex-start;
  }
}

/* Shared compact layout for profile and withdrawal dialogs. */
.agent-dialog {
  width: 100%;
  padding: 16px 20px;
}
.agent-dialog form {
  width: 100%;
  max-width: none;
}
.agent-dialog .layui-form-item {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  align-items: start;
  column-gap: 12px;
  margin: 0 0 10px;
}
.agent-dialog .layui-form-item::after {
  display: none;
}
.agent-dialog .layui-form-label {
  float: none;
  width: auto;
  margin: 0;
  padding: 9px 0;
  line-height: 20px;
}
.agent-dialog .layui-input-block {
  min-width: 0;
  margin: 0;
}
.agent-dialog .layui-input,
.agent-dialog .layui-textarea {
  margin: 0;
}
.agent-dialog .layui-input {
  height: 38px;
  padding: 0 10px;
}
.agent-dialog .layui-textarea {
  min-height: 72px;
}
.agent-dialog .layui-form-item:last-child {
  margin-bottom: 0;
}
.agent-dialog .header-dialog-actions .layui-input-block,
.agent-dialog .withdraw-dialog-actions .layui-input-block {
  grid-column: 2;
  display: flex;
  gap: 10px;
}
.agent-dialog .layui-btn {
  margin: 0;
  padding: 0 16px;
}
.layui-layer {
  max-width: calc(100vw - 32px);
}
.layui-layer,
.layui-form-select dl,
.layui-table-tips,
body[data-page="agent"] .btn {
  box-shadow: none !important;
}
@media (max-width: 480px) {
  .agent-dialog {
    padding: 12px 16px;
  }
  .agent-dialog .layui-form-item {
    grid-template-columns: 92px minmax(0, 1fr);
    column-gap: 8px;
    margin-bottom: 8px;
  }
  .agent-dialog .layui-btn {
    padding: 0 12px;
  }
}
/* Shared table appearance for orders, withdrawals and users on both platforms. */
.records-card .layui-table-view {
  margin: 0;
  border-color: var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 13px;
}

.records-card .layui-table,
.records-card .layui-table th,
.records-card .layui-table td,
.records-card .layui-table-cell,
.records-card .layui-table-init,
.records-card .layui-table-page,
.records-card .layui-table-page a,
.records-card .layui-table-page span,
.records-card .layui-table-page input,
.records-card .layui-table-page select,
.records-card .layui-table-page button {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
}

.records-card .layui-table th,
.records-card .layui-table td,
.records-card .layui-table-header,
.records-card .layui-table-page {
  border-color: var(--gray-200);
}

/* CardKey 商城公共布局：购买页和订单页共享同一套视觉基线。 */
:root {
  --shop-bg: #f5f6f4;
  --shop-surface: rgba(255, 255, 255, 0.94);
  --shop-surface-strong: #ffffff;
  --shop-text: #20242b;
  --shop-muted: #707782;
  --shop-line: #e7e8e6;
  --shop-ink: #1f252d;
  --shop-accent: #ef896e;
  --shop-success: #2eaa78;
  --shop-shadow: 0 18px 50px rgba(35, 42, 51, 0.08);
}

[data-theme="dark"] {
  --shop-bg: #15181d;
  --shop-surface: rgba(30, 34, 41, 0.96);
  --shop-surface-strong: #20242b;
  --shop-text: #f4f5f7;
  --shop-muted: #a7adb7;
  --shop-line: #363c46;
  --shop-ink: #f7f8fa;
  --shop-shadow: 0 20px 55px rgba(0, 0, 0, 0.26);
}

html,
body {
  min-height: 100%;
}

body[data-page="subscribe"],
body[data-page="order"] {
  display: block;
  margin: 0;
  color: var(--shop-text);
  background:
    radial-gradient(circle at 88% 2%, rgba(244, 179, 79, 0.16), transparent 25%),
    radial-gradient(circle at 4% 30%, rgba(239, 137, 110, 0.1), transparent 23%),
    var(--shop-bg);
  font: 15px/1.55 "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif;
}

.shell {
  width: min(980px, calc(100% - 32px));
  max-width: none;
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px 0 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.topbar .brand {
  color: var(--shop-text);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.order-link,
.theme {
  border: 1px solid var(--shop-line);
  background: var(--shop-surface);
  color: var(--shop-text);
  box-shadow: none;
}

.order-link {
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
}

.order-link:hover {
  border-color: var(--shop-accent);
  color: var(--shop-accent);
}

.theme,
.theme:hover {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  background: var(--shop-surface);
  color: var(--shop-text);
  font-size: 17px;
}

.theme:hover {
  border-color: var(--shop-accent);
  color: var(--shop-accent);
}

.hero {
  margin-bottom: 14px;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border-radius: 99px;
  background: rgba(239, 137, 110, 0.14);
  color: #9b5a44;
  font-size: 12px;
  font-weight: 700;
}

.hero h1 {
  margin: 9px 0 4px;
  color: var(--shop-text);
  font-size: clamp(27px, 4.3vw, 38px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.055em;
}

.hero p {
  margin: 0;
  color: var(--shop-muted);
}

/* 页签外观用于两个独立页面之间导航，不承载单页切换逻辑。 */
.flow-nav {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  height: auto;
  margin: 0 0 22px;
  padding: 6px;
  border: 1px solid var(--shop-line);
  border-radius: 16px;
  background: var(--shop-surface);
  box-shadow: var(--shop-shadow);
}

.flow-nav .flow-step {
  display: block;
  padding: 11px 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--shop-muted);
  font-weight: 800;
  text-align: center;
}

.flow-nav .flow-step:hover {
  background: rgba(31, 37, 45, 0.04);
  color: var(--shop-text);
}

.flow-nav .flow-step.active,
.flow-nav .flow-step.active:hover {
  background: var(--shop-ink);
  color: var(--shop-bg);
}

.flow-step small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  opacity: 0.75;
}

.section-title {
  margin: 16px 0 12px;
}

.section-title p {
  margin: 0;
  color: var(--shop-muted);
  font-size: 13px;
}

.primary,
.layui-btn.primary {
  height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 13px;
  background: var(--shop-ink);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(31, 37, 45, 0.15);
  font-weight: 800;
  line-height: 46px;
}

.primary:hover,
.layui-btn.primary:hover {
  background: #303741;
  color: #ffffff;
}

.field {
  display: grid;
  gap: 8px;
  margin: 0 0 19px;
}

.field label {
  margin: 0;
  color: var(--shop-text);
  font-size: 13px;
  font-weight: 800;
}

.field .layui-input {
  width: 100%;
  height: 50px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--shop-line);
  border-radius: 14px;
  background: var(--shop-surface-strong);
  color: var(--shop-text);
  box-shadow: none;
}

.field .layui-input::placeholder {
  color: #989ea7;
}

.field .layui-input:hover,
.field .layui-input:focus {
  border-color: var(--shop-accent) !important;
  box-shadow: 0 0 0 4px rgba(239, 137, 110, 0.12);
}

.hint {
  color: var(--shop-muted);
  font-size: 12px;
}

.trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  color: var(--shop-muted);
  font-size: 12px;
}

.trust-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #65b992;
  box-shadow: 0 0 0 4px rgba(101, 185, 146, 0.14);
}

footer {
  margin-top: 4px;
  padding: 0 0 28px;
  color: var(--shop-muted);
  font-size: 12px;
  text-align: center;
}

/* 桌面端帮助入口固定在右下角，小屏隐藏以避免遮挡正文。 */
.cat {
  position: fixed;
  right: 24px;
  bottom: 22px;
  z-index: 30;
  display: grid;
  width: 76px;
  height: 76px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(239, 137, 110, 0.3);
  border-radius: 24px;
  background: linear-gradient(145deg, #ffffff, #fff4ef);
  color: #553d63;
  box-shadow: 0 15px 35px rgba(78, 50, 39, 0.18);
  font-size: 32px;
  animation: shop-float 4s ease-in-out infinite;
}

.help-panel {
  position: fixed;
  right: 24px;
  bottom: 110px;
  z-index: 29;
  width: min(360px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 160px));
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(239, 137, 110, 0.25);
  border-radius: 20px;
  background: var(--shop-surface-strong);
  box-shadow: 0 20px 55px rgba(35, 42, 51, 0.18);
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  pointer-events: none;
  transition: 0.2s;
}

.help-panel.show {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.help-head h3 {
  margin: 0;
  color: var(--shop-text);
  font-size: 18px;
}

.help-close,
.help-close:hover {
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--shop-line);
  border-radius: 50%;
  background: transparent;
  color: var(--shop-muted);
}

.faq {
  padding: 11px 0;
  border-top: 1px solid var(--shop-line);
}

.faq button,
.faq button:hover {
  display: flex;
  width: 100%;
  justify-content: space-between;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--shop-text);
  font-weight: 800;
  text-align: left;
}

.faq button::after { content: "＋"; color: var(--shop-muted); }
.faq.open button::after { content: "－"; }
.faq p {
  max-height: 0;
  overflow: hidden;
  margin: 0;
  color: var(--shop-muted);
  font-size: 13px;
  transition: 0.2s;
}
.faq.open p { max-height: 140px; margin-top: 8px; }

[data-theme="dark"] body[data-page="subscribe"],
[data-theme="dark"] body[data-page="order"] {
  background:
    radial-gradient(circle at 88% 2%, rgba(244, 179, 79, 0.09), transparent 28%),
    radial-gradient(circle at 4% 30%, rgba(239, 137, 110, 0.07), transparent 25%),
    var(--shop-bg);
}

[data-theme="dark"] .eyebrow {
  background: rgba(239, 137, 110, 0.16);
  color: #ffc0ad;
}

[data-theme="dark"] .flow-nav .flow-step:hover { background: #252b33; }
[data-theme="dark"] .flow-nav .flow-step.active,
[data-theme="dark"] .flow-nav .flow-step.active:hover,
[data-theme="dark"] .primary,
[data-theme="dark"] .layui-btn.primary {
  background: linear-gradient(135deg, #f0a087, #ef816a);
  color: #251a17;
}

[data-theme="dark"] .field .layui-input {
  border-color: #3a414c;
  background: #20252d;
  color: var(--shop-text);
}

[data-theme="dark"] .field .layui-input::placeholder { color: #78818d; }
[data-theme="dark"] .cat {
  border-color: #554039;
  background: linear-gradient(145deg, #2a2525, #211d1d);
  color: #e7c9ee;
}
[data-theme="dark"] .toast {
  border-color: #465149;
  background: #20372d;
  color: #b8e5cf;
}

@keyframes shop-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@media (max-width: 680px) {
  .shell { width: min(calc(100% - 24px), 520px); padding-top: 17px; }
  .order-link { padding: 8px 10px; }
  .flow-nav .flow-step { padding: 9px 6px; font-size: 13px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 30px; }
  .cat, .help-panel { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cat { animation: none; }
}

.records-card .layui-table-header,
.records-card .layui-table-header th {
  background-color: var(--gray-100);
}

.records-card .layui-table-header th {
  color: var(--text-secondary);
}

.records-card .layui-table-header .layui-table-cell {
  text-align: center;
}

.records-card .layui-table-cell {
  padding: 0 12px;
  height: 44px;
  line-height: 44px;
  font-variant-numeric: tabular-nums;
}

.records-card .layui-table-body td {
  color: var(--text-main);
}

.records-card .order-date {
  display: inline-block;
  vertical-align: middle;
  line-height: 18px;
  font-size: inherit;
}

.records-card .order-date small {
  display: block;
  font-size: inherit;
}

.records-card .layui-table-main {
  scrollbar-width: thin;
  scrollbar-color: var(--gray-400) var(--gray-50);
}

.records-card .layui-table-page {
  height: auto;
  min-height: 42px;
  padding: 6px 10px;
  background: var(--gray-50);
}

/* 接口操作按钮：加载时保持原有配色和尺寸，仅增加旋转状态与处理文案。 */
.layui-btn.is-loading,
.layui-btn.is-loading:hover,
button.is-loading,
button.is-loading:hover {
  opacity: 1;
  cursor: wait;
  pointer-events: none;
}

.is-loading::before {
  content: "";
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 9px;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: shop-spin 0.7s linear infinite;
}

/*
 * 页面提示统一为遮挡层中央 Toast。
 * hidden 控制 DOM 可见性，show 只负责进出场动画，避免占用页面文档流。
 */
.feedback-open {
  overflow: hidden !important;
}

.feedback-mask {
  position: fixed;
  inset: 0;
  z-index: 1900;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(18, 22, 27, 0.38);
  backdrop-filter: blur(3px);
}

.global-loading {
  display: flex;
  min-width: 210px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 17px 22px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.96);
  color: #20242b;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
  font-size: 14px;
}

.global-loading-spinner {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 3px solid rgba(239, 137, 110, 0.25);
  border-top-color: var(--shop-accent);
  border-radius: 50%;
  animation: shop-spin 0.7s linear infinite;
}

.toast {
  top: 50%;
  right: auto;
  bottom: auto;
  left: 50%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
  max-width: none;
  padding: 13px 16px;
  transform: translate(-50%, calc(-50% - 12px)) scale(0.98);
  border: 1px solid #f0c9bb;
  border-radius: 14px;
  background: #fff8f5;
  color: #963f2c;
  box-shadow: 0 18px 45px rgba(36, 27, 24, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast::before {
  content: "!";
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin-top: 1px;
  place-items: center;
  border-radius: 50%;
  background: #ef896e;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.toast.show {
  transform: translate(-50%, -50%);
  opacity: 1;
}

.toast.success {
  border-color: #bfe4d2;
  background: #f3fbf7;
  color: #256b4e;
}

.toast.success::before {
  content: "✓";
  background: var(--shop-success);
}

[data-theme="dark"] .toast,
[data-theme="dark"] .toast.success {
  border-color: #414853;
  background: #22272f;
  color: #f3f5f7;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.42);
}

[data-theme="dark"] .feedback-mask {
  background: rgba(5, 7, 10, 0.56);
}

[data-theme="dark"] .global-loading {
  border-color: #414853;
  background: #22272f;
  color: #f3f5f7;
  box-shadow: 0 25px 75px rgba(0, 0, 0, 0.5);
}

@keyframes shop-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 560px) {
  .toast {
    top: 50%;
    right: auto;
    width: calc(100vw - 24px);
  }
}
