/* ==========================================================
   SellNzt 样式表
   - body.pay   客户付款页（浅色，手机优先）
   - body.admin 后台管理（深色）
   ========================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --alipay: #1677ff;
  --wechat: #07c160;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

/* ---------------- 客户付款页 ---------------- */
body.pay {
  background: linear-gradient(180deg, #eef3fb 0%, #f7f9fc 240px, #f7f9fc 100%);
  color: #111827;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.pay-wrap { max-width: 480px; margin: 0 auto; padding: 20px 16px 48px; }

.pay-head { display: flex; align-items: center; gap: 12px; padding: 8px 4px 18px; }
.pay-head .logo {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #1e40af); color: #fff;
  font-weight: 800; font-size: 15px; letter-spacing: .5px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .28);
}
.pay-head h1 { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.pay-head p { font-size: 12px; color: #6b7280; margin-top: 2px; }

.card {
  background: #fff; border-radius: var(--radius); padding: 22px 20px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, .07), 0 1px 2px rgba(15, 23, 42, .04);
  border: 1px solid rgba(15, 23, 42, .04);
}
.card h2 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }

.hidden { display: none !important; }

/* 单价识别 */
.price-line { display: flex; align-items: center; gap: 10px; margin-top: 10px; min-height: 24px; }
.tier-badge {
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
  background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; white-space: nowrap;
}
.tier-badge.ok { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.tier-badge.warn { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.unit-text { font-size: 13px; color: #6b7280; }
.unit-text b { color: #111827; font-size: 15px; }

/* 商品类型下拉 */
.product-select {
  width: 100%; height: 50px; padding: 0 42px 0 14px;
  border: 1.5px solid #e5e7eb; border-radius: 12px; background-color: #fff;
  font-size: 15px; font-weight: 600; color: #111827; font-family: inherit;
  cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.product-select:focus { outline: none; border-color: var(--brand); }
.product-meta { font-size: 12px; color: #94a3b8; margin-top: 6px; }
.product-meta.hidden { display: none; }

/* 通过专属链接进来时，账号框锁定不让改 */
input.locked {
  background: #f1f5f9; color: #64748b; cursor: default;
  border-style: dashed;
}

/* 商品数量 */
.qty-row { display: flex; align-items: center; gap: 10px; }
.qty-btn {
  width: 52px; height: 52px; flex: 0 0 52px; border-radius: 12px; border: 1.5px solid #e5e7eb;
  background: #fff; font-size: 22px; font-weight: 700; color: #374151; cursor: pointer;
  font-family: inherit; display: grid; place-items: center; user-select: none;
}
.qty-btn:active { background: #f3f4f6; }
.qty-row input {
  flex: 1; height: 52px; padding: 0; text-align: center;
  font-size: 20px; font-weight: 800; border: 1.5px solid #e5e7eb; border-radius: 12px;
}
.qty-row input::-webkit-outer-spin-button,
.qty-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-row input[type="number"] { -moz-appearance: textfield; }

/* 金额汇总 */
.total-box {
  margin-top: 18px; border-radius: 12px; padding: 14px 16px;
  background: linear-gradient(135deg, #eff5ff, #f8fbff); border: 1px solid #dbeafe;
}
.total-row { display: flex; justify-content: space-between; font-size: 13px; color: #4b6a8f; padding: 3px 0; }
.total-row.main {
  margin-top: 8px; padding-top: 10px; border-top: 1px dashed #c7dcf5;
  font-size: 14px; color: #1e3a5f; font-weight: 600; align-items: baseline;
}
.total-row.main strong { font-size: 26px; font-weight: 800; color: var(--brand); letter-spacing: -.5px; }

.pay-meta { font-size: 12px; color: #6b7280; margin-top: 8px; }

/* 表单 */
label { display: block; font-size: 13px; color: #374151; font-weight: 600; margin: 16px 0 7px; }
label .req { color: var(--bad); }
input[type="text"], input[type="number"], input[type="password"], textarea, select {
  width: 100%; border: 1.5px solid #e5e7eb; border-radius: 11px; padding: 12px 13px;
  font-size: 15px; font-family: inherit; color: #111827; background: #fff; outline: none;
  transition: .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
input::placeholder { color: #9ca3af; }

.amount-input { position: relative; }
.amount-input span {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-size: 20px; font-weight: 700; color: #111827;
}
.amount-input input { padding-left: 34px; font-size: 22px; font-weight: 700; height: 56px; }

/* 支付方式 */
.methods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.method {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid #e5e7eb; background: #fff; border-radius: 11px; height: 50px;
  font-size: 14px; font-weight: 600; color: #374151; cursor: pointer; font-family: inherit;
  transition: .15s;
}
.method.active { border-color: var(--brand); background: #eff5ff; color: var(--brand); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.alipay { background: var(--alipay); }
.dot.wechat { background: var(--wechat); }

/* 按钮 */
.btn-primary {
  width: 100%; margin-top: 22px; height: 52px; border: none; border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; font-size: 16px;
  font-weight: 700; cursor: pointer; font-family: inherit;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .28); transition: .15s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(37, 99, 235, .34); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-ghost {
  width: 100%; margin-top: 10px; height: 46px; border: none; border-radius: 12px;
  background: transparent; color: #6b7280; font-size: 14px; cursor: pointer; font-family: inherit;
}
.btn-ghost:hover { background: #f3f4f6; color: #111827; }

.notice { font-size: 12px; color: #6b7280; line-height: 1.6; margin-top: 14px; text-align: center; }
.notice.err { color: var(--bad); }

/* 扫码步骤 */
.pay-amount { text-align: center; padding: 6px 0 18px; }
.pay-amount small { display: block; font-size: 12px; color: #6b7280; margin-bottom: 6px; }
.pay-amount strong { font-size: 38px; font-weight: 800; letter-spacing: -.5px; }
.pay-amount strong span { font-size: 38px; }

.qr-box {
  width: 236px; height: 236px; margin: 0 auto; border-radius: 14px;
  background: #fff; border: 1px solid #e5e7eb; padding: 10px; display: grid; place-items: center;
}
.qr-box img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
/* 当面付的动态二维码是 canvas，要覆盖它写死的宽高 */
.qr-box canvas { width: 100% !important; height: 100% !important; border-radius: 8px; }
#qrDynamic { width: 100%; height: 100%; display: grid; place-items: center; }
.qr-tip { text-align: center; font-size: 13px; color: #4b5563; margin-top: 16px; line-height: 1.6; }
.qr-tip b { color: #111827; }

.order-line {
  text-align: center; font-size: 12px; color: #9ca3af; margin-top: 14px;
  padding-top: 14px; border-top: 1px dashed #e5e7eb;
}
.order-line code { color: #4b5563; font-size: 12px; letter-spacing: .3px; }

/* 状态 */
.status-icon { font-size: 44px; text-align: center; margin: 4px 0 10px; }
#stepStatus h2 { text-align: center; margin-bottom: 6px; }
.muted { color: #6b7280; font-size: 13px; text-align: center; line-height: 1.7; }

.timeline { margin: 22px 0 6px; }
.tl-item { display: flex; gap: 12px; padding-bottom: 18px; position: relative; }
.tl-item:not(:last-child)::before {
  content: ""; position: absolute; left: 9px; top: 22px; bottom: 0; width: 2px; background: #e5e7eb;
}
.tl-item.done:not(:last-child)::before { background: #bbf7d0; }
.tl-dot {
  width: 20px; height: 20px; border-radius: 50%; flex: 0 0 20px; display: grid; place-items: center;
  background: #e5e7eb; color: #9ca3af; font-size: 11px; font-weight: 700; z-index: 1;
}
.tl-item.done .tl-dot { background: var(--ok); color: #fff; }
.tl-item.now .tl-dot { background: var(--brand); color: #fff; animation: pulse 1.4s infinite; }
.tl-title { font-size: 14px; font-weight: 600; color: #9ca3af; }
.tl-item.done .tl-title, .tl-item.now .tl-title { color: #111827; }
.tl-desc { font-size: 12px; color: #9ca3af; margin-top: 2px; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .45); }
  50% { box-shadow: 0 0 0 7px rgba(37, 99, 235, 0); }
}

/* ---------------- 后台管理 ---------------- */
body.admin {
  background: #0f1115; color: #e6e9ef; min-height: 100vh;
  font-size: 14px; -webkit-font-smoothing: antialiased;
}

/* 登录 */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 380px; background: #171a21; border: 1px solid #262b36;
  border-radius: 16px; padding: 32px 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.login-card .logo {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; font-weight: 800;
  font-size: 14px; margin-bottom: 18px;
}
.login-card h1 { font-size: 19px; margin-bottom: 6px; }
.login-card p.sub { font-size: 13px; color: #8b93a7; margin-bottom: 22px; }
body.admin label { color: #9aa3b5; font-size: 12px; margin: 14px 0 6px; }
body.admin input[type="text"], body.admin input[type="password"], body.admin input[type="number"],
body.admin textarea, body.admin select {
  background: #0f1115; border: 1px solid #2b3140; color: #e6e9ef; border-radius: 10px;
  padding: 11px 12px; font-size: 14px;
}
body.admin input:focus, body.admin textarea:focus, body.admin select:focus {
  border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}
body.admin .btn-primary {
  margin-top: 20px; height: 46px; font-size: 15px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #2563eb); box-shadow: 0 8px 20px rgba(37, 99, 235, .3);
}
.err-msg { color: #f87171; font-size: 13px; margin-top: 12px; text-align: center; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 208px; flex: 0 0 208px; background: #12151b; border-right: 1px solid #22262f;
  padding: 20px 14px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.sidebar .brand .logo {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8); font-weight: 800; font-size: 11px; color: #fff;
}
.sidebar .brand b { font-size: 14px; }
.sidebar .brand span { display: block; font-size: 11px; color: #6b7383; font-weight: 400; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px;
  color: #9aa3b5; cursor: pointer; font-size: 14px; border: none; background: none;
  font-family: inherit; text-align: left; width: 100%;
}
.nav-item:hover { background: #1b1f27; color: #e6e9ef; }
.nav-item.active { background: #1e2a3d; color: #93c5fd; font-weight: 600; }
.sidebar .spacer { flex: 1; }
.sidebar .foot { font-size: 11px; color: #4b5563; padding: 8px 12px; line-height: 1.6; }

.main { flex: 1; padding: 26px 30px 60px; max-width: 1400px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; font-weight: 700; }
.page-head .sub { font-size: 12px; color: #6b7383; margin-top: 4px; }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: #171a21; border: 1px solid #242935; border-radius: 12px; padding: 16px 18px;
}
.stat .k { font-size: 12px; color: #8b93a7; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 6px; letter-spacing: -.3px; }
.stat .v.money { color: #fbbf24; }
.stat .v.warn { color: #fbbf24; }
.stat .v.ok { color: #4ade80; }

/* 工具栏 */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input[type="text"] { width: 240px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  padding: 7px 13px; border-radius: 8px; border: 1px solid #262b36; background: #171a21;
  color: #9aa3b5; font-size: 13px; cursor: pointer; font-family: inherit;
}
.tab.active { background: #1e2a3d; border-color: #2f4a72; color: #93c5fd; font-weight: 600; }
.btn {
  padding: 9px 15px; border-radius: 9px; border: 1px solid #2b3140; background: #1b1f27;
  color: #d3d8e3; font-size: 13px; cursor: pointer; font-family: inherit; white-space: nowrap;
}
.btn:hover { background: #232833; }
.btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.danger { color: #fca5a5; border-color: #4b2222; }
.btn.danger:hover { background: #2a1616; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 表格 */
.table-wrap { background: #171a21; border: 1px solid #242935; border-radius: 12px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 12px 14px; color: #7b8397; font-weight: 600; font-size: 12px;
  background: #14171d; border-bottom: 1px solid #242935; white-space: nowrap;
}
td { padding: 13px 14px; border-bottom: 1px solid #1e222b; color: #c8cedb; vertical-align: middle; }
tbody tr:hover { background: #1a1e26; }
tbody tr:last-child td { border-bottom: none; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; color: #8b93a7; }
.amount-cell { font-weight: 700; color: #fbbf24; font-variant-numeric: tabular-nums; }
.empty { padding: 50px; text-align: center; color: #5b6478; font-size: 13px; }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.badge.pending { background: #2a2113; color: #fbbf24; border-color: #4a3a15; }
.badge.claimed { background: #1f2436; color: #93c5fd; border-color: #2f4a72; }
.badge.paid { background: #12251f; color: #4ade80; border-color: #1e4a38; }
.badge.approving { background: #241f33; color: #c4b5fd; border-color: #3b2f5c; }
.badge.approved { background: #10251a; color: #34d399; border-color: #1a4a33; }
.badge.approve_failed { background: #2a1616; color: #f87171; border-color: #4b2222; }
.badge.cancelled { background: #1c1f26; color: #6b7383; border-color: #2b3140; }

.pager { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 14px 4px; font-size: 13px; color: #7b8397; }

/* 详情抽屉 */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 40;
  opacity: 0; pointer-events: none; transition: .2s;
}
.drawer-mask.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: #14171d;
  border-left: 1px solid #242935; z-index: 41; transform: translateX(100%); transition: .24s;
  display: flex; flex-direction: column;
}
.drawer.show { transform: translateX(0); }
.drawer-head {
  padding: 18px 20px; border-bottom: 1px solid #242935; display: flex;
  justify-content: space-between; align-items: center;
}
.drawer-head h3 { font-size: 15px; }
.drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid #242935; display: flex; gap: 8px; flex-wrap: wrap; }
.kv { display: flex; padding: 9px 0; border-bottom: 1px solid #1e222b; font-size: 13px; gap: 12px; }
.kv .k { width: 92px; flex: 0 0 92px; color: #7b8397; }
.kv .v { flex: 1; color: #d3d8e3; word-break: break-all; }
.log-box {
  background: #0b0d11; border: 1px solid #22262f; border-radius: 9px; padding: 12px;
  font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; line-height: 1.7;
  color: #8b93a7; white-space: pre-wrap; max-height: 240px; overflow: auto; margin-top: 10px;
}
.shot { width: 100%; border-radius: 9px; border: 1px solid #242935; margin-top: 10px; display: block; }
.close-x { background: none; border: none; color: #7b8397; font-size: 20px; cursor: pointer; line-height: 1; }

/* 设置页 */
.panel { background: #171a21; border: 1px solid #242935; border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.panel h3 { font-size: 14px; margin-bottom: 4px; }
.panel .hint { font-size: 12px; color: #6b7383; line-height: 1.7; margin-bottom: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } }
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; min-height: 300px; }
.qr-thumb { width: 120px; height: 120px; border-radius: 10px; border: 1px solid #2b3140; object-fit: contain; background: #fff; }
.qr-row { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.row-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.switch { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; color: #9aa3b5; }
.switch input { width: 18px; height: 18px; accent-color: #2563eb; }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: #1f2530; border: 1px solid #2f3745; color: #e6e9ef; padding: 12px 20px;
  border-radius: 10px; font-size: 13px; z-index: 99; opacity: 0; pointer-events: none;
  transition: .22s; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: #4b2222; color: #fca5a5; }
#toast.ok { border-color: #1e4a38; color: #6ee7b7; }

/* 商品列表行编辑（后台） */
.product-rows { display: flex; flex-direction: column; gap: 8px; }
.product-row { display: flex; gap: 8px; align-items: stretch; }
.product-row .p-name { flex: 1 1 auto; min-width: 0; }
.product-row .p-denom { flex: 0 0 170px; }
.product-row .p-del {
  flex: 0 0 42px; border-radius: 10px; border: 1px solid #2b3140; background: #0f1115;
  color: #8b93a7; cursor: pointer; font-family: inherit; font-size: 14px;
}
.product-row .p-del:hover { border-color: #7f1d1d; color: #f87171; background: #1a0f11; }

/* 手机适配 */
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none; height: auto; position: static; flex-direction: row;
    align-items: center; padding: 10px 12px; gap: 6px; overflow-x: auto;
  }
  .sidebar .brand { padding: 0 10px 0 4px; }
  .sidebar .brand span { display: none; }
  .sidebar .spacer, .sidebar .foot { display: none; }
  .nav-item { width: auto; padding: 8px 12px; white-space: nowrap; }
  .main { padding: 16px 14px 50px; }
  .toolbar input[type="text"] { width: 100%; }
  .table-wrap { overflow-x: auto; }
  table { min-width: 720px; }
  .product-row { flex-wrap: wrap; }
  .product-row .p-name, .product-row .p-denom { flex: 1 1 100%; }
  .product-row .p-del { flex: 0 0 100%; height: 34px; }
}
