:root {
  --ink: #050505;
  --paper: #ffffff;
  --mist: #f5f5f3;
  --line: #deded8;
  --muted: #696963;
  --violet: #494fdf;
  --violet-soft: #ececff;
  --danger: #d92d20;
  --ok: #087443;
  --radius: 20px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--mist);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: inherit; text-decoration: none; }
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 480px;
  background: var(--ink);
  color: var(--paper);
}
.login-hero { padding: 72px; display: flex; flex-direction: column; justify-content: space-between; }
.login-hero h1 { font-size: clamp(52px, 7vw, 108px); line-height: .9; letter-spacing: -0.08em; margin: 0; max-width: 760px; }
.login-hero p { color: #b9b9b1; font-size: 18px; max-width: 520px; }
.login-card {
  align-self: center;
  margin: 32px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 28px;
  padding: 34px;
}
.login-card h2 { margin: 0 0 8px; font-size: 30px; letter-spacing: -0.04em; }
.login-card .sub { margin: 0 0 26px; color: var(--muted); }
.app-top {
  background: var(--ink);
  color: var(--paper);
  padding: 22px 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { font-weight: 800; letter-spacing: -0.04em; font-size: 22px; }
.nav { display: flex; gap: 10px; align-items: center; }
.nav a { color: #d7d7d0; padding: 10px 16px; border: 1px solid #303030; border-radius: 999px; }
.nav a:hover, .nav .active { color: var(--paper); background: #1b1b1b; }
.page { max-width: 1180px; margin: 0 auto; padding: 34px 24px 80px; }
.hero-card {
  background: var(--ink);
  color: var(--paper);
  border-radius: 28px;
  padding: 34px;
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  overflow: hidden;
  position: relative;
}
.hero-card:after {
  content: "";
  position: absolute;
  right: -90px;
  top: -100px;
  width: 260px;
  height: 260px;
  background: var(--violet);
  border-radius: 999px;
}
.hero-card h1 { margin: 0; font-size: clamp(36px, 5vw, 64px); letter-spacing: -0.07em; line-height: .95; }
.hero-card p { color: #c8c8c1; margin: 12px 0 0; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.card h2, .card h3 { margin: 0 0 16px; letter-spacing: -0.04em; }
.metric { font-size: 38px; letter-spacing: -0.06em; font-weight: 820; }
.muted { color: var(--muted); }
.badge { display: inline-flex; align-items: center; padding: 7px 12px; border-radius: 999px; font-size: 13px; background: #eeeeea; color: var(--ink); }
.badge.ok { background: #e8f8ef; color: var(--ok); }
.badge.warn { background: #fff1e6; color: #a85000; }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.btn {
  border: 0;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 750;
  cursor: pointer;
}
.btn.secondary { background: #eeeeea; color: var(--ink); }
.btn.violet { background: var(--violet); }
.btn.danger { background: var(--danger); color: var(--paper); }
.inline-form { display: inline-flex; margin: 0; }
.empty-state { text-align: center; padding: 54px 24px; border: 1px dashed var(--line); border-radius: var(--radius); background: #fafaf8; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions.compact { gap: 6px; align-items: flex-start; }
.form { display: grid; gap: 16px; }
.field label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 14px; }
input, select {
  width: 100%;
  height: 56px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 18px;
  padding: 0 16px;
  font: inherit;
  outline: none;
}
input:focus, select:focus { border-color: var(--violet); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 16px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 650; font-size: 13px; }
.codebox {
  background: #0c0c0c;
  color: var(--paper);
  border-radius: 18px;
  padding: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.copy { border: 1px solid #333; background: #171717; color: var(--paper); border-radius: 999px; padding: 8px 12px; cursor: pointer; }
.error { background: #fff0f0; color: var(--danger); padding: 12px 14px; border-radius: 14px; margin-bottom: 16px; }
.notice { background: #ebfff3; color: var(--ok); padding: 12px 14px; border-radius: 14px; margin-bottom: 16px; }
@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { padding: 36px; }
  .grid, .grid.two, .hero-card { grid-template-columns: 1fr; }
  .app-top { flex-direction: column; align-items: flex-start; gap: 16px; }
}

.field-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.checkline { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.checkline input { width: 18px; height: 18px; }
.table-scroll { overflow-x: auto; }
.nowrap { white-space: nowrap; }

.page-enter { animation: page-enter .34s ease both; }
@keyframes page-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.filter-card { margin-bottom: 16px; padding: 18px; }
.filter-form { display: grid; grid-template-columns: minmax(240px, 1.4fr) repeat(4, minmax(140px, 1fr)) auto; gap: 12px; align-items: end; }
.filter-form .field label { margin-bottom: 6px; }
.filter-form input, .filter-form select { height: 48px; border-radius: 16px; }
.filter-actions { display: flex; gap: 8px; align-items: center; }
.order-head { justify-content: space-between; margin-bottom: 14px; }
.order-head h2, .order-head p { margin: 0; }
.order-head p { margin-top: 4px; }
.order-table th { white-space: nowrap; }
.order-table td { line-height: 1.48; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 12px; }
.order-codes { min-width: 220px; }
.wrap-text { max-width: 180px; overflow-wrap: anywhere; }
.badge.status-success { background: #e8f8ef; color: var(--ok); }
.badge.status-pending { background: #fff1e6; color: #a85000; }
.badge.status-expired { background: #eeeeea; color: var(--muted); }
.badge.warn { background: #fff1e6; color: #a85000; margin-top: 4px; }
.inline-form { display: inline-flex; margin: 2px 4px 2px 0; vertical-align: top; }
.btn.mini { padding: 7px 10px; font-size: 12px; border-radius: 999px; }
.btn.danger { background: var(--danger); color: white; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding-top: 18px; }
.btn.disabled, .btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.pagination button { border: 0; }
.btn.is-loading { opacity: .72; pointer-events: none; }
.btn.is-loading:after { content: ""; width: 12px; height: 12px; margin-left: 8px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 999px; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 1180px) { .filter-form { grid-template-columns: repeat(3, minmax(0, 1fr)); } .filter-actions { grid-column: 1 / -1; } }
@media (max-width: 680px) { .filter-form { grid-template-columns: 1fr; } .pagination, .order-head { align-items: flex-start; flex-direction: column; } }

/* Vue 管理后台增强：保留原黑白蓝紫风格，升级按钮、表格、弹窗细节 */
[v-cloak] { display: none; }
.admin-vue-shell { position: relative; }
.admin-hero { min-height: 188px; align-items: end; box-shadow: 0 24px 70px -42px rgba(0,0,0,.55); }
.admin-hero:before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 27px;
  pointer-events: none;
  background:
    radial-gradient(circle at 84% 12%, rgba(73,79,223,.36), transparent 28%),
    linear-gradient(135deg, rgba(255,255,255,.08), transparent 36%);
}
.admin-hero > * { position: relative; z-index: 1; }
.eyebrow {
  display: inline-flex;
  margin-bottom: 14px;
  color: #c8c8ff;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 850;
}
.hero-actions { align-self: end; }
.dashboard-grid { margin-bottom: 16px; }
.stat-card { position: relative; overflow: hidden; min-height: 138px; }
.stat-card:after {
  content: "";
  position: absolute;
  right: -38px;
  bottom: -46px;
  width: 118px;
  height: 118px;
  border-radius: 999px;
  background: var(--violet-soft);
}
.stat-card > * { position: relative; z-index: 1; }
.stat-card small { display: block; color: var(--muted); margin-top: 10px; }
.metric.compact { font-size: 23px; word-break: break-all; letter-spacing: -.04em; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.section-head h2, .section-head p { margin: 0; }
.section-head p { margin-top: 5px; }
.admin-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.toolbar-input, .toolbar-select { height: 44px; border-radius: 999px; background: #fafaf8; }
.toolbar-input { width: min(280px, 44vw); }
.toolbar-select { width: 136px; }
.table-card { padding: 18px; overflow: hidden; }
.pretty-scroll { border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.vue-table { border-collapse: separate; border-spacing: 0; width: 100%; }
.vue-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, #fbfbf8, #f2f2ee);
  border-bottom: 1px solid var(--line);
  color: #565650;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.vue-table th, .vue-table td { padding: 16px 14px; }
.vue-table tbody td { border-bottom: 1px solid rgba(222,222,216,.72); }
.vue-table tbody tr:last-child td { border-bottom: 0; }
.vue-table tbody tr { transition: background .18s ease, transform .18s ease, box-shadow .18s ease; }
.vue-table tbody tr:hover { background: #fbfbff; box-shadow: inset 4px 0 0 var(--violet); }
.entity-cell { display: flex; align-items: center; gap: 12px; min-width: 180px; }
.entity-cell .avatar {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: inline-grid;
  place-items: center;
  background: #111;
  color: #fff;
  font-weight: 850;
  box-shadow: 0 8px 20px -12px rgba(0,0,0,.8);
}
.entity-cell strong { display: block; }
.entity-cell span:not(.avatar) { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.channel-meter { width: 86px; height: 8px; border-radius: 999px; background: #ecece7; overflow: hidden; margin-bottom: 7px; }
.channel-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--violet), #7278ff); }
.table-actions { min-width: 168px; }
.money { font-size: 16px; letter-spacing: -.02em; }
.vue-pagination { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.vue-filter { grid-template-columns: minmax(240px, 1.4fr) repeat(4, minmax(130px, 1fr)) auto; }

.ui-btn {
  position: relative;
  overflow: hidden;
  gap: 8px;
  border: 1px solid transparent;
  box-shadow: 0 10px 24px -18px rgba(0,0,0,.9);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}
.ui-btn:hover:not(:disabled):not(.disabled) { transform: translateY(-1px); box-shadow: 0 16px 34px -22px rgba(0,0,0,.9); }
.ui-btn:active:not(:disabled):not(.disabled) { transform: translateY(0); }
.ui-btn.violet { background: linear-gradient(135deg, #3d43d6, #6268ff); }
.ui-btn.secondary { border-color: rgba(5,5,5,.06); background: linear-gradient(180deg, #f7f7f2, #e9e9e3); }
.ui-btn.danger { background: linear-gradient(135deg, #d92d20, #f04438); }
.ui-btn.mini { min-height: 34px; padding: 0 12px; font-size: 12px; }
.ui-btn__shine {
  position: absolute;
  inset: -60% auto auto -40%;
  width: 70%;
  height: 220%;
  transform: rotate(28deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.34), transparent);
  opacity: 0;
  transition: left .42s ease, opacity .18s ease;
}
.ui-btn:hover .ui-btn__shine { left: 82%; opacity: .8; }
.ui-btn__content { position: relative; z-index: 1; display: inline-flex; align-items: center; }

.toast {
  position: fixed;
  right: 26px;
  top: 22px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px;
  background: rgba(15,15,15,.92);
  color: #fff;
  box-shadow: 0 28px 80px -42px #000;
  backdrop-filter: blur(14px);
}
.toast.error { background: rgba(129, 22, 16, .94); }
.toast-dot { width: 9px; height: 9px; border-radius: 999px; background: #75f0a2; box-shadow: 0 0 0 5px rgba(117,240,162,.12); }
.toast.error .toast-dot { background: #ffd1cc; box-shadow: 0 0 0 5px rgba(255,209,204,.14); }
.toast-slide-enter-active, .toast-slide-leave-active { transition: opacity .2s ease, transform .2s ease; }
.toast-slide-enter-from, .toast-slide-leave-to { opacity: 0; transform: translateY(-10px); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5,5,5,.48);
  backdrop-filter: blur(10px);
}
.modal-card {
  position: relative;
  width: min(460px, 100%);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 28px;
  background: linear-gradient(180deg, #fff, #f7f7f2);
  padding: 28px;
  box-shadow: 0 38px 110px -48px rgba(0,0,0,.85);
}
.modal-orb {
  position: absolute;
  right: -36px;
  top: -44px;
  width: 128px;
  height: 128px;
  border-radius: 999px;
  background: var(--violet);
  opacity: .18;
}
.modal-orb.danger { background: var(--danger); }
.modal-kicker { color: var(--violet); font-size: 12px; letter-spacing: .15em; text-transform: uppercase; font-weight: 850; }
.modal-card h3 { margin: 12px 0 10px; font-size: 30px; letter-spacing: -.05em; }
.modal-card p { margin: 0; color: var(--muted); line-height: 1.7; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.modal-fade-enter-active, .modal-fade-leave-active { transition: opacity .18s ease; }
.modal-fade-enter-active .modal-card, .modal-fade-leave-active .modal-card { transition: transform .18s ease, opacity .18s ease; }
.modal-fade-enter-from, .modal-fade-leave-to { opacity: 0; }
.modal-fade-enter-from .modal-card, .modal-fade-leave-to .modal-card { opacity: 0; transform: translateY(12px) scale(.98); }

.form-card { padding: 22px; }
.form-block {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  background: #fff;
}
.form-block + .form-block { margin-top: 2px; }
.form-block h2 { margin: 0 0 16px; }
.form-block h3 { margin: 20px 0 12px; }
.ysm-config { background: #fafaf8; }
.form-actions { padding-top: 4px; }
input:disabled { color: var(--muted); background: #f1f1ed; cursor: not-allowed; }
.badge.neutral { background: #eeeeea; color: var(--muted); }

@media (max-width: 980px) {
  .section-head { flex-direction: column; }
  .admin-toolbar { width: 100%; justify-content: flex-start; }
  .toolbar-input { width: 100%; }
  .vue-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .toast { left: 16px; right: 16px; top: 16px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  .vue-filter { grid-template-columns: 1fr; }
  .table-card { padding: 12px; }
}

/* 订单表格宽屏优化：列更宽，表格区域支持横向和纵向滚动 */
.table-scroll {
  overflow: auto;
  max-height: min(68vh, 760px);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(73,79,223,.55) #eeeeea;
}
.table-scroll::-webkit-scrollbar { width: 12px; height: 12px; }
.table-scroll::-webkit-scrollbar-track { background: #eeeeea; border-radius: 999px; }
.table-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, rgba(73,79,223,.75), rgba(114,120,255,.75));
  border: 3px solid #eeeeea;
  border-radius: 999px;
}
.order-scroll-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}
.order-scroll-hint:before {
  content: "";
  width: 34px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--violet), #d6d6ff);
}
.order-table {
  min-width: 1500px;
  table-layout: fixed;
}
.order-table th, .order-table td { padding: 18px 18px; }
.order-table th:nth-child(1), .order-table td:nth-child(1) { width: 190px; }
.order-table th:nth-child(2), .order-table td:nth-child(2) { width: 300px; }
.order-table th:nth-child(3), .order-table td:nth-child(3) { width: 280px; }
.order-table th:nth-child(4), .order-table td:nth-child(4) { width: 120px; }
.order-table th:nth-child(5), .order-table td:nth-child(5) { width: 110px; }
.order-table th:nth-child(6), .order-table td:nth-child(6) { width: 120px; }
.order-table th:nth-child(7), .order-table td:nth-child(7) { width: 180px; }
.order-table th:nth-child(8), .order-table td:nth-child(8) { width: 220px; }
.order-table th:nth-child(9), .order-table td:nth-child(9) { width: 180px; }
.order-table .wrap-text { max-width: none; min-width: 240px; }
.order-table .order-codes { min-width: 270px; }
.order-table .table-actions { min-width: 150px; }

/* 商户端订单少一列，单独给更舒展的列宽 */
.merchant-order-table { min-width: 1320px; }
.merchant-order-table th:nth-child(1), .merchant-order-table td:nth-child(1) { width: 310px; }
.merchant-order-table th:nth-child(2), .merchant-order-table td:nth-child(2) { width: 300px; }
.merchant-order-table th:nth-child(3), .merchant-order-table td:nth-child(3) { width: 130px; }
.merchant-order-table th:nth-child(4), .merchant-order-table td:nth-child(4) { width: 120px; }
.merchant-order-table th:nth-child(5), .merchant-order-table td:nth-child(5) { width: 130px; }
.merchant-order-table th:nth-child(6), .merchant-order-table td:nth-child(6) { width: 200px; }
.merchant-order-table th:nth-child(7), .merchant-order-table td:nth-child(7) { width: 230px; }
.merchant-order-table th:nth-child(8), .merchant-order-table td:nth-child(8) { width: 180px; }

.page-heading { display: flex; align-items: end; justify-content: space-between; margin: 6px 0 24px; }
.page-heading h1 { margin: 0; font-size: 42px; }
.page-heading p { margin: 8px 0 0; color: var(--muted); }
.payment-link-layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
.money-input { display: grid; grid-template-columns: auto 1fr; align-items: center; border: 1px solid var(--line); background: #fff; }
.money-input:focus-within { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft); }
.money-input span { padding-left: 16px; color: var(--muted); font-size: 20px; }
.money-input input { border: 0; box-shadow: none; font-size: 28px; font-weight: 700; }
.payment-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.payment-methods label { cursor: pointer; }
.payment-methods input { position: absolute; opacity: 0; pointer-events: none; }
.payment-methods span { display: block; padding: 13px; border: 1px solid var(--line); text-align: center; background: #fff; }
.payment-methods input:checked + span { border-color: var(--violet); color: var(--violet); background: var(--violet-soft); font-weight: 700; }
.btn.full { width: 100%; justify-content: center; }
.payment-link-result { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 28px; align-items: center; padding: 26px; margin-bottom: 18px; color: #fff; background: #151515; border-radius: 8px; }
.payment-link-result h2 { margin: 10px 0 4px; font-size: 36px; }
.payment-link-result p { margin: 0 0 18px; color: #c8c8c1; }
.payment-link-qr { width: 192px; height: 192px; padding: 12px; background: #fff; }
.payment-link-qr img, .payment-link-qr canvas { width: 100%; height: 100%; display: block; }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }
.copy-row input { min-width: 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; }
.payment-link-item { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 0; border-top: 1px solid var(--line); }
.payment-link-main > div { display: flex; align-items: center; gap: 10px; }
.payment-link-main strong { font-size: 22px; }
.payment-link-main p { margin: 5px 0; }
.payment-link-main small { color: var(--muted); }
.payment-link-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.payment-link-actions form { margin: 0; }
.icon-action { display: inline-flex; border: 0; background: transparent; color: var(--violet); padding: 7px; cursor: pointer; font: inherit; }
.danger-text { color: var(--danger); }

@media (max-width: 760px) {
  .table-scroll { max-height: 70vh; }
  .order-table { min-width: 1380px; }
  .merchant-order-table { min-width: 1220px; }
  .payment-link-layout, .payment-link-result { grid-template-columns: 1fr; }
  .payment-link-qr { justify-self: center; }
  .copy-row { grid-template-columns: 1fr 1fr; }
  .copy-row input { grid-column: 1 / -1; }
  .payment-link-item { align-items: flex-start; flex-direction: column; }
}
