:root {
  --bg: #f6f4f1;
  --surface: #ffffff;
  --ink: #1c1917;
  --ink-2: #57534e;
  --ink-3: #a8a29e;
  --line: #e7e5e4;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --accent-soft: #fff1e8;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(28, 25, 23, .05), 0 4px 16px rgba(28, 25, 23, .04);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141210; --surface: #1f1c19; --ink: #f5f5f4; --ink-2: #c4bfba; --ink-3: #78716c;
    --line: #2f2b27; --accent: #f97316; --accent-ink: #1c1917; --accent-soft: #3a2416;
    --ok: #4ade80; --warn: #fbbf24; --danger: #f87171;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
/* 始终为滚动条预留位置：页面内容变长/变短时（加载、刷新、切换页面）不会左右晃动 */
html { scrollbar-gutter: stable; background: var(--bg); }
/* 页面加载中时先不显示页脚，避免它在底部闪一下又被内容推走 */
main.wrap:has(> .loading) + .footer, main.wrap:has(#pane > .loading) + .footer { visibility: hidden; }
body { background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.55; min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
main.wrap { flex: 1; padding-top: 20px; padding-bottom: 40px; }
.footer { color: var(--ink-3); font-size: 12px; padding-bottom: 24px; text-align: center; }

/* ---------- 顶栏 ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; gap: 20px; height: 60px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; flex-shrink: 0; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 16px; }
.search { flex: 1; display: flex; max-width: 520px; border: 1.5px solid var(--accent); border-radius: 999px; overflow: hidden; background: var(--surface); }
.search input { flex: 1; border: 0; padding: 8px 16px; outline: none; background: transparent; min-width: 0; }
.search button { border: 0; background: var(--accent); color: var(--accent-ink); padding: 0 18px; cursor: pointer; font-weight: 600; }
.nav { display: flex; gap: 4px; align-items: center; margin-left: auto; flex-shrink: 0; }
.nav a, .nav button { padding: 6px 10px; border-radius: 8px; color: var(--ink-2); background: none; border: 0; cursor: pointer; white-space: nowrap; }
.nav a:hover, .nav button:hover, .nav a.active { color: var(--ink); background: var(--bg); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; text-align: center; line-height: 18px; margin-left: 2px; }

@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .brand-name { display: none; }
  .nav { overflow-x: auto; flex: 1; min-width: 0; margin-left: 0; justify-content: flex-end; }
  .card { padding: 16px; }
  .summary { margin: 16px -16px -16px; padding: 12px 16px; }
}

/* ---------- 通用 ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); font-size: 12px; }
.price { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.price small { font-size: .75em; margin-right: 1px; }
.strike { color: var(--ink-3); text-decoration: line-through; font-size: 12px; margin-left: 6px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.empty { text-align: center; color: var(--ink-3); padding: 48px 0; }
.loading { text-align: center; color: var(--ink-3); padding: 40px 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.lg { padding: 12px 28px; font-size: 16px; }
.link { color: var(--accent); cursor: pointer; background: none; border: 0; padding: 0; }

label.field { display: block; }
label.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
input.input, select.input, textarea.input { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); outline: none; }
input.input:focus, select.input:focus, textarea.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 100px; resize: vertical; }

/* 底部灰线用内阴影绘制，标签不需要 margin-bottom:-1px 去压线，内容不会比容器高出 1px，
   因而不会在 Windows 上出现带上下箭头的竖向滚动条。横向仍可滑动（窄屏），但隐藏滚动条。 */
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px 0 var(--line); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; flex-shrink: 0; }
.tabs .active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 5px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; color: var(--ink-2); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--bg); color: var(--ink-2); }
.tag.pending { background: #fef3c7; color: #92400e; }
.tag.paid, .tag.active, .tag.on { background: #dcfce7; color: #166534; }
.tag.shipped { background: #dbeafe; color: #1e40af; }
.tag.completed { background: var(--bg); color: var(--ink-2); }
.tag.cancelled, .tag.rejected, .tag.suspended, .tag.off, .tag.closed { background: #fee2e2; color: #991b1b; }
@media (prefers-color-scheme: dark) {
  .tag.pending { background: #422006; color: #fde68a; }
  .tag.paid, .tag.active, .tag.on { background: #052e16; color: #86efac; }
  .tag.shipped { background: #172554; color: #93c5fd; }
  .tag.cancelled, .tag.rejected, .tag.suspended, .tag.off, .tag.closed { background: #450a0a; color: #fca5a5; }
}

.toast { position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 20px; border-radius: 999px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 50; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

/* ---------- 首页 / 商品网格 ---------- */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.sorts { display: flex; gap: 2px; background: var(--surface); border-radius: 8px; padding: 3px; border: 1px solid var(--line); }
.sorts button { border: 0; background: none; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--ink-2); }
.sorts button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-top: 16px; }
.pcard { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; display: flex; flex-direction: column; }
.pcard:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(28,25,23,.08); }
.pcard .thumb { aspect-ratio: 1; background: var(--bg); }
.pcard .thumb img { width: 100%; height: 100%; object-fit: cover; }
.pcard .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pcard .title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.pcard .meta { display: flex; justify-content: space-between; align-items: baseline; margin-top: auto; }
.pcard .price { font-size: 17px; }
.noimg { width: 100%; height: 100%; display: grid; place-items: center; color: var(--ink-3); font-size: 34px; background: linear-gradient(135deg, var(--bg), var(--line)); }
.more { text-align: center; margin-top: 20px; }

/* ---------- 商品详情 ---------- */
.crumbs { font-size: 13px; color: var(--ink-3); margin: -6px 0 12px; }
.crumbs a { color: var(--ink-2); }
.crumbs a:hover { color: var(--accent); }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
@media (max-width: 760px) { .detail { grid-template-columns: 1fr; gap: 16px; } }
.gallery .main { aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.gallery .main img { width: 100%; height: 100%; object-fit: cover; }
.gallery .thumbs { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.gallery .thumbs img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.gallery .thumbs img.active { border-color: var(--accent); }
.pricebox { background: var(--accent-soft); border-radius: 10px; padding: 14px 16px; margin: 12px 0; }
.pricebox .price { font-size: 28px; }
.skus { display: flex; gap: 8px; flex-wrap: wrap; }
.sku { padding: 6px 14px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.sku.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
/* 商品页：带图规格 */
.sku.has-img { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; }
.sku.has-img img { width: 30px; height: 30px; border-radius: 5px; object-fit: cover; flex-shrink: 0; }
.sku:disabled { opacity: .4; cursor: not-allowed; text-decoration: line-through; }
.qty { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty button { width: 32px; border: 0; background: var(--bg); cursor: pointer; }
.qty input { width: 48px; text-align: center; border: 0; padding: 6px 0; background: var(--surface); outline: none; }
.desc { white-space: pre-wrap; color: var(--ink-2); }
.shopline { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin-top: 16px; }
.avatar { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- 购物车 / 订单 ---------- */
.group { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.group + .group { margin-top: 12px; }
.group-head { padding: 10px 14px; background: var(--bg); display: flex; align-items: center; gap: 10px; font-weight: 600; flex-wrap: wrap; }
.line { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); }
.line:first-of-type { border-top: 0; }
.line .pic { width: 64px; height: 64px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--bg); }
.line .pic img { width: 100%; height: 100%; object-fit: cover; }
.line .info { flex: 1; min-width: 0; }
.line .info .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line.off { opacity: .5; }
.summary { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 14px 20px; display: flex; align-items: center; gap: 16px; margin: 16px -20px -20px; border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; }
.summary .price { font-size: 22px; }
.addr { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer; display: block; }
.addr.active { border-color: var(--accent); background: var(--accent-soft); }
.addr input { display: none; }

/* ---------- 后台 ---------- */
.console { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; }
@media (max-width: 760px) { .console { grid-template-columns: minmax(0, 1fr); } } /* minmax(0,…)：宽内容（表格、长地址）不会把整页撑宽 */
.side { display: flex; flex-direction: column; gap: 2px; }
.side a { display: flex; align-items: center; gap: 10px; padding: 9px 12px 9px 14px; border-radius: 8px; color: var(--ink-2); white-space: nowrap; transition: background .15s, color .15s; }
.side a:hover { background: var(--surface); color: var(--ink); }
.side a.active { background: var(--surface); color: var(--accent); font-weight: 600; box-shadow: var(--shadow); }
.side a svg { flex-shrink: 0; opacity: .7; transition: opacity .15s; }
.side a:hover svg, .side a.active svg { opacity: 1; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-group + .side-group { margin-top: 14px; }
.nav-group-title { font-size: 12px; color: var(--ink-3); letter-spacing: .06em; padding: 0 14px 4px; white-space: nowrap; }
.side-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-style: normal; font-weight: 600; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.side-badge[hidden] { display: none; }
.side-badge.soft { background: var(--accent-soft); color: var(--accent); }

/* 商家中心：顶部店铺信息栏与经营概览 */
.console-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.console-head h1 { margin: 0; font-size: 20px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.console-head .ch-main { flex: 1; min-width: 0; }
.console-head .ch-sub { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.console-head .btn svg { flex-shrink: 0; }
.ov-top { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px; }
@media (max-width: 900px) { .ov-top { grid-template-columns: minmax(0, 1fr); } }
.ov-balance, .ov-todo { border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.ov-balance { background: linear-gradient(135deg, var(--accent-soft), var(--surface) 75%); border: 1px solid var(--line); }
.ov-balance .k, .ov-todo .k { color: var(--ink-2); font-size: 13px; }
.ov-balance .v { font-size: 34px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; overflow-wrap: anywhere; }
.ov-balance .row { flex-wrap: wrap; gap: 12px; align-items: center; }
.ov-note { color: var(--ink-3); font-size: 12px; }
.ov-todo { background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.ov-todo .k { margin-bottom: 4px; }
.todo { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--ink-2); transition: background .15s; }
.todo:hover { background: var(--bg); }
.todo span { flex: 1; }
.todo b { font-variant-numeric: tabular-nums; color: var(--ink-3); font-weight: 600; }
.todo.on { color: var(--ink); }
.todo.on svg { color: var(--accent); }
.todo.on b { color: var(--accent); font-size: 16px; }
.table td.amt { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.table td.amt .price { color: inherit; }
.table td.amt.pos { color: var(--ok); }
.table td.amt.neg { color: var(--ink); }
@media (max-width: 760px) {
  .side { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 2px; }
  .side-group { flex-direction: row; gap: 4px; flex-shrink: 0; }
  .side-group + .side-group { margin-top: 0; margin-left: 4px; padding-left: 8px; border-left: 1px solid var(--line); }
  .nav-group-title { display: none; }
  .side a { padding: 7px 12px; }
}
.shop-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; }
.shop-rate b { color: var(--accent); font-size: 16px; font-variant-numeric: tabular-nums; margin-right: 2px; }
@media (max-width: 760px) { .shop-stats { align-items: flex-start; } }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat .k { color: var(--ink-2); font-size: 13px; }
.stat .v { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--ink-2); font-weight: 500; font-size: 13px; }
.table .mini { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--bg); }
.imgs { display: flex; gap: 8px; flex-wrap: wrap; }
.imgs .im { position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; background: var(--bg); }
.imgs .im img { width: 100%; height: 100%; object-fit: cover; }
.imgs .im button { position: absolute; top: 2px; right: 2px; border: 0; border-radius: 999px; width: 22px; height: 22px; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
.imgs .add { width: 84px; height: 84px; border: 1.5px dashed var(--line); border-radius: 8px; display: grid; place-items: center; color: var(--ink-3); cursor: pointer; font-size: 26px; }
.skurow { display: grid; grid-template-columns: 42px 2fr 1fr 1fr 1fr auto; gap: 8px; align-items: center; }
@media (max-width: 600px) {
  .skurow { display: flex; flex-wrap: wrap; }
  .skurow [data-f="name"] { flex: 1 1 calc(100% - 50px); }
  .skurow [data-f="price"], .skurow [data-f="original_price"], .skurow [data-f="stock"] { flex: 1 1 26%; min-width: 0; }
  .skurow .sku-picker { flex-basis: 100%; }
}
/* 规格图片：表单中的选择按钮与图片选择面板 */
.sku-img { width: 42px; height: 42px; padding: 0; border: 1.5px dashed var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-3); cursor: pointer; display: grid; place-items: center; overflow: hidden; flex-shrink: 0; transition: border-color .15s, color .15s; }
.sku-img:hover, .sku-img[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.sku-img.set { border-style: solid; }
.sku-img img { width: 100%; height: 100%; object-fit: cover; }
.sku-picker { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--bg); }
.sku-picker > span { width: 100%; font-size: 13px; }
.sku-picker button { width: 56px; height: 56px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: var(--surface); cursor: pointer; }
.sku-picker button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sku-picker button:hover { border-color: var(--line); }
.sku-picker button.on { border-color: var(--accent); }
.sku-picker button.none { width: auto; padding: 0 12px; font-size: 13px; color: var(--ink-2); border: 1.5px dashed var(--line); }
.sku-picker button.none.on { border: 1.5px solid var(--accent); color: var(--accent); }
.auth { max-width: 380px; margin: 40px auto; }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); }

@media (max-width: 760px) {
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pcard .price { font-size: 15px; }
}

/* ---------- 消息 ---------- */
.chat {
  --chat-bg: #faf8f5; --bubble-theirs: #ffffff; --bubble-shadow: 0 1px 1.5px rgba(28,25,23,.08);
  display: grid; grid-template-columns: 320px minmax(0, 1fr); flex: 1; min-height: 0; max-height: 760px;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow), 0 0 0 1px var(--line); overflow: hidden;
}
@media (prefers-color-scheme: dark) { .chat { --chat-bg: #181512; --bubble-theirs: #2a2622; --bubble-shadow: none; } }

/* 聊天页铺满顶栏以下的可视区域：页面本身不滚动，只有会话列表和消息区各自滚动 */
body:has(.chat) { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
main.wrap:has(.chat) { display: flex; flex-direction: column; min-height: 0; padding-bottom: 36px; }
main.wrap:has(.chat) + .footer { display: none; }

/* 头像 */
.ava { --ava-bg: var(--accent-soft); --ava-fg: var(--accent); width: 44px; height: 44px; border-radius: 50%; background: var(--ava-bg); color: var(--ava-fg);
  display: inline-grid; place-items: center; font-weight: 600; font-size: 17px; flex-shrink: 0; overflow: hidden; }
@media (prefers-color-scheme: dark) { .ava:not(:has(img)) { filter: saturate(.8) brightness(.85); } }
.ava img { width: 100%; height: 100%; object-fit: cover; }
.ava.sm { width: 30px; height: 30px; font-size: 13px; }
.ava.lg { width: 40px; height: 40px; font-size: 16px; }
.ava.xl { width: 64px; height: 64px; font-size: 26px; margin-bottom: 6px; }

/* 侧栏 */
.chat-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--surface); }
.side-top { padding: 18px 16px 12px; display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid var(--line); }
.side-title { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.side-title-row { display: flex; align-items: center; justify-content: space-between; }
.icon-btn.sound-btn { color: var(--accent); }
.icon-btn.sound-btn.off { color: var(--ink-3); }
.seg { display: flex; background: var(--bg); border-radius: 10px; padding: 3px; gap: 2px; }
.seg a { flex: 1; text-align: center; padding: 6px 8px; border-radius: 8px; color: var(--ink-2); font-size: 13px; position: relative; transition: background .15s, color .15s; }
.seg a.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg .dot { position: absolute; top: 6px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.side-search { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 10px; padding: 0 12px; color: var(--ink-3); border: 1px solid transparent; transition: border-color .15s; }
.side-search:focus-within { border-color: var(--accent); background: var(--surface); }
.side-search input { border: 0; outline: none; background: transparent; padding: 8px 0; flex: 1; min-width: 0; color: var(--ink); }
.convs { overflow-y: auto; flex: 1; padding: 6px; }
.convs-empty { text-align: center; color: var(--ink-3); padding: 48px 16px; font-size: 13px; }
.conv { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; position: relative; transition: background .12s; }
.conv + .conv { margin-top: 2px; }
.conv:hover { background: var(--bg); }
.conv.active { background: var(--accent-soft); }
.conv.active::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--accent); }
.ava-wrap { position: relative; flex-shrink: 0; }
.ava-badge { position: absolute; top: -3px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 11px; line-height: 18px; text-align: center; font-weight: 600; box-shadow: 0 0 0 2px var(--surface); }
.conv-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.conv-top { display: flex; align-items: baseline; gap: 8px; }
.conv-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.conv-time { font-size: 12px; color: var(--ink-3); flex-shrink: 0; }
.conv-last { font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv.unread .conv-name { font-weight: 700; }
.conv.unread .conv-last { color: var(--ink-2); }

/* 主区域 */
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--chat-bg); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.head-info { min-width: 0; }
.head-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-sub { font-size: 12px; color: var(--ink-3); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; flex-shrink: 0; font-size: 20px; line-height: 1; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.chat-back { display: none; margin-left: -8px; }

.msgs-wrap { position: relative; flex: 1; min-height: 0; }
.msgs { position: absolute; inset: 0; overflow-y: auto; padding: 20px 24px 12px; display: flex; flex-direction: column; scroll-behavior: auto; }
.older { text-align: center; font-size: 12px; padding: 4px 0 12px; }
.msgs-hello { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 24px; }
.sep { display: flex; justify-content: center; margin: 14px 0 8px; }
.sep span { font-size: 11.5px; color: var(--ink-3); background: rgba(120, 113, 108, .1); padding: 2px 10px; border-radius: 999px; }

.msg { display: flex; align-items: flex-end; gap: 8px; max-width: min(72%, 560px); margin-top: 18px; animation: msg-in .18s ease-out; }
.msg.join-prev { margin-top: 8px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-ava { width: 30px; flex-shrink: 0; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .msg { animation: none; } }

.bubble { padding: 9px 14px; border-radius: 18px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; font-size: 14.5px;
  background: var(--bubble-theirs); color: var(--ink); box-shadow: var(--bubble-shadow); }
.msg.theirs .bubble { border-bottom-left-radius: 6px; }
.msg.theirs.join-prev .bubble { border-top-left-radius: 6px; }
.msg.mine .bubble { background: linear-gradient(135deg, #e0571b, var(--accent)); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 1px 2px rgba(194, 65, 12, .25); }
.msg.mine.join-prev .bubble { border-top-right-radius: 6px; }
@media (prefers-color-scheme: dark) { .msg.mine .bubble { background: linear-gradient(135deg, #fb8a3c, var(--accent)); color: #1c1917; } }

.m-image { padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 14px; overflow: hidden; box-shadow: var(--bubble-shadow); display: block; }
.m-image img { max-width: 240px; max-height: 280px; min-width: 60px; min-height: 60px; object-fit: cover; display: block; transition: transform .2s; }
.m-image:hover img { transform: scale(1.02); }

.m-card { display: flex; flex-direction: column; width: 280px; max-width: 100%; background: var(--surface); border-radius: 14px; overflow: hidden; box-shadow: var(--bubble-shadow), 0 0 0 1px var(--line); transition: box-shadow .15s; }
.m-card:hover { box-shadow: 0 4px 14px rgba(28,25,23,.1), 0 0 0 1px var(--line); }
.m-card-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); padding: 8px 12px 0; font-weight: 500; }
.m-card-label { white-space: nowrap; min-width: 0; }
.m-card-label .faint { overflow: hidden; text-overflow: ellipsis; min-width: 0; font-weight: 400; }
.m-card-label .tag { flex-shrink: 0; }
.m-card-body { display: flex; gap: 10px; padding: 10px 12px; }
.m-card .pic { width: 64px; height: 64px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--bg); }
.m-card .pic img { width: 100%; height: 100%; object-fit: cover; }
.m-card .pic .noimg { font-size: 20px; }
.m-card-info { min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 4px; }
.m-card .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13.5px; line-height: 1.4; }
.m-card-foot { border-top: 1px solid var(--line); padding: 7px 12px; font-size: 12px; color: var(--accent); }

.m-status { align-self: center; flex-shrink: 0; }
.m-status.sending { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--ink-3); animation: spin .8s linear infinite; }
.m-status.fail { width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--danger); color: #fff; font-weight: 700; cursor: pointer; font-size: 12px; }
.msg:has(.m-status.sending) .bubble { opacity: .75; }
@keyframes spin { to { transform: rotate(360deg); } }

.jump { position: absolute; right: 20px; bottom: 14px; display: inline-flex; align-items: center; gap: 6px; height: 36px; min-width: 36px; padding: 0 9px;
  border-radius: 18px; border: 0; background: var(--surface); color: var(--ink-2); box-shadow: 0 4px 14px rgba(0,0,0,.12), 0 0 0 1px var(--line); cursor: pointer; }
.jump[hidden] { display: none; }
.jump.has-new { background: var(--accent); color: var(--accent-ink); padding-right: 14px; }
.jump span:empty { display: none; }
.jump span { font-size: 13px; font-weight: 500; }

/* 待发送卡片 */
#ctx { padding: 0 20px; display: flex; flex-direction: column; gap: 8px; }
#ctx:not(:empty) { padding-top: 10px; }
.ctx-card { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 12px; padding: 10px 10px 10px 12px; box-shadow: 0 0 0 1px var(--line); animation: msg-in .2s ease-out; }
.ctx-card .pic { width: 46px; height: 46px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--bg); }
.ctx-card .pic img { width: 100%; height: 100%; object-fit: cover; }
.ctx-card .pic .noimg { font-size: 16px; }
.ctx-info { flex: 1; min-width: 0; font-size: 13px; }
.ctx-info .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 输入框 */
.composer { padding: 12px 20px 10px; }
.composer-box { display: flex; align-items: flex-end; gap: 6px; background: var(--surface); border-radius: 16px; padding: 6px 6px 6px 8px;
  box-shadow: 0 0 0 1px var(--line), 0 2px 8px rgba(28,25,23,.04); transition: box-shadow .15s; }
.composer-box:focus-within { box-shadow: 0 0 0 1.5px var(--accent), 0 0 0 5px var(--accent-soft); }
.composer textarea { flex: 1; border: 0; outline: none; resize: none; background: transparent; padding: 7px 4px; min-height: 36px; max-height: 140px; line-height: 1.5; font-size: 14.5px; color: var(--ink); }
.counter { font-size: 11px; color: var(--ink-3); align-self: center; }
.send { width: 36px; height: 36px; border-radius: 12px; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; transition: transform .1s, opacity .15s; }
.send:disabled { opacity: .35; cursor: default; }
.send:not(:disabled):active { transform: scale(.92); }
.composer-hint { font-size: 11px; color: var(--ink-3); text-align: right; padding: 5px 4px 0; }

.chat-empty { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px; }
.chat-empty-title { font-size: 16px; font-weight: 600; margin-top: 8px; }

.lightbox { position: fixed; inset: 0; background: rgba(10, 8, 6, .86); z-index: 60; display: grid; place-items: center; cursor: zoom-out; padding: 24px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }

@media (max-width: 760px) {
  main.wrap:has(.chat) { padding: 0; }
  .chat { grid-template-columns: 1fr; border-radius: 0; box-shadow: none; max-height: none; }
  .chat.has-conv .chat-side { display: none; }
  .chat:not(.has-conv) .chat-main { display: none; }
  .chat-side { border-right: 0; }
  .chat-back { display: inline-grid; }
  .chat-head { padding: 8px 12px; }
  .chat-head .btn.ghost span { display: none; }
  .msgs { padding: 14px 12px 8px; }
  .msg { max-width: 86%; }
  .composer { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .composer-hint { display: none; }
  #ctx { padding: 0 10px; }
}

/* ---------- 确认对话框 ---------- */
dialog.confirm { padding: 0; border: 0; border-radius: 16px; background: var(--surface); color: var(--ink); width: min(360px, calc(100% - 32px)); box-shadow: 0 24px 60px rgba(28, 25, 23, .22), 0 2px 8px rgba(28, 25, 23, .08); animation: confirm-in .18s cubic-bezier(.2, .9, .3, 1.2); }
dialog.confirm::backdrop { background: rgba(28, 25, 23, .42); backdrop-filter: blur(3px); animation: confirm-fade .18s ease-out; }
.confirm-body { padding: 28px 24px 20px; text-align: center; }
.confirm-icon { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; font-weight: 700; color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent-soft) 50%, transparent); }
.confirm-icon.danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 6%, transparent); }
.confirm-body h3 { margin: 0 0 6px; font-size: 17px; }
.confirm-body p { margin: 0; color: var(--ink-2); font-size: 14px; text-wrap: balance; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.confirm-actions .btn { padding: 10px 16px; border-radius: 10px; }
.confirm-actions .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }
@keyframes confirm-in { from { opacity: 0; transform: translateY(8px) scale(.96); } }
@keyframes confirm-fade { from { opacity: 0; } }
@media (prefers-color-scheme: dark) { dialog.confirm { box-shadow: 0 24px 60px rgba(0, 0, 0, .6); border: 1px solid var(--line); } dialog.confirm::backdrop { background: rgba(0, 0, 0, .6); } }
@media (prefers-reduced-motion: reduce) { dialog.confirm, dialog.confirm::backdrop { animation: none; } }

/* ---------- 评价 ---------- */
.stars { display: inline-flex; gap: 1px; color: var(--line); letter-spacing: 0; vertical-align: -1px; font-size: 15px; line-height: 1; }
.stars i { font-style: normal; }
.stars i.on { color: #f59e0b; }
.stars.sm { font-size: 12px; }
.rating-link { color: var(--ink-2); }
.rating-link:hover { color: var(--accent); }
.rating-link b { color: var(--ink); }
.rv-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.rv-top h2 { margin: 0; }
.rv-score { display: flex; align-items: center; gap: 10px; }
.rv-score > b { font-size: 32px; line-height: 1; color: var(--accent); font-weight: 700; }
.rv-score .stars { font-size: 16px; }
.rv-filters { margin: 14px 0 4px; }
.rv-filters .chip { font-size: 13px; }
.rv-filters .chip:disabled { opacity: .45; cursor: default; }
.reviews { display: flex; flex-direction: column; }
.review { padding: 16px 0; border-bottom: 1px solid var(--line); }
.reviews > .review:last-child, .rv-m:last-child .review { border-bottom: 0; }
.review-head { display: flex; align-items: center; gap: 10px; }
.review-head .who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.review-head .who strong { font-weight: 600; font-size: 13px; }
.review-text { margin: 10px 0 0; white-space: pre-wrap; word-break: break-word; }
.review-pics { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.review-pic { width: 84px; height: 84px; padding: 0; border: 0; border-radius: 8px; overflow: hidden; cursor: zoom-in; background: var(--bg); }
.review-pic img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.review-pic:hover img { transform: scale(1.05); }
.review-pics.sm .review-pic { width: 48px; height: 48px; }
.review-reply { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: var(--bg); color: var(--ink-2); font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.review-reply b { color: var(--ink); font-weight: 600; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 4px 0; }

/* 商户评价管理 */
.rv-m { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 2px; }
.rv-m:first-child { border-top: 0; }
.rv-m .review { border-bottom: 0; padding-top: 10px; }
.rv-m-product { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.rv-m-product .pic { width: 32px; height: 32px; border-radius: 6px; overflow: hidden; background: var(--bg); flex-shrink: 0; }
.rv-m-product .pic img, .rv-m-product .pic .noimg { width: 100%; height: 100%; object-fit: cover; }
.rv-m-product:hover > span:nth-child(2) { color: var(--accent); }
#rvStats { margin-bottom: 16px; }
.reply-form { display: flex; gap: 8px; margin-top: 12px; }
.reply-form .input { flex: 1; min-width: 0; }

/* 发表评价 */
.review-form { max-width: 760px; margin: 0 auto; }
.rf-item { padding: 20px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.rf-product { display: flex; gap: 12px; align-items: center; }
.rf-product .pic { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: var(--bg); flex-shrink: 0; }
.rf-product .pic img { width: 100%; height: 100%; object-fit: cover; }
.rf-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.star-pick { display: inline-flex; gap: 4px; }
.star-pick button { border: 0; background: none; padding: 0 2px; font-size: 28px; line-height: 1; color: var(--line); cursor: pointer; transition: transform .12s, color .12s; }
.star-pick button.on { color: #f59e0b; }
.star-pick button:hover { transform: scale(1.15); }
.star-pick button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.rf-label { color: var(--warn); font-weight: 600; min-width: 4em; }
.rf-pics { display: flex; gap: 10px; flex-wrap: wrap; }
.rf-pic { position: relative; width: 80px; height: 80px; border-radius: 8px; overflow: hidden; background: var(--bg); }
.rf-pic img { width: 100%; height: 100%; object-fit: cover; }
.rf-pic button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; line-height: 1; font-size: 15px; }
.rf-add { width: 80px; height: 80px; border-radius: 8px; border: 1.5px dashed var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--ink-3); cursor: pointer; font-size: 24px; line-height: 1.1; transition: border-color .15s, color .15s; }
.rf-add span { font-size: 11px; }
.rf-add:hover { border-color: var(--accent); color: var(--accent); }
.rf-add.loading-pic { opacity: .5; pointer-events: none; }
.rf-foot { padding-top: 20px; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--ink-2); }
@media (max-width: 760px) {
  .review-pic { width: 72px; height: 72px; }
  .rf-foot .btn.lg { padding: 10px 20px; }
}
#reviews { scroll-margin-top: 84px; margin-top: 20px; }

/* ---------- 用户菜单 ---------- */
.nav .user-btn { display: inline-flex; align-items: center; gap: 7px; padding: 4px 8px 4px 4px; border-radius: 999px; color: var(--ink); }
.nav .user-btn:hover, .nav .user-btn.active, .nav .user-btn[aria-expanded="true"] { background: var(--bg); }
.user-initial { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 600; flex-shrink: 0; }
.user-name { max-width: 9em; overflow: hidden; text-overflow: ellipsis; }
.user-btn .caret { color: var(--ink-3); transition: transform .15s; flex-shrink: 0; }
.user-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }
.user-menu { position: fixed; z-index: 40; min-width: 200px; max-width: calc(100vw - 16px); padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(28, 25, 23, .14), 0 2px 6px rgba(28, 25, 23, .06); animation: um-in .14s ease-out; transform-origin: top right; }
.user-menu[hidden] { display: none; }
.um-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.um-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-mail { color: var(--ink-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-item { display: flex; align-items: center; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer; text-align: left; font-size: 14px; }
.um-item:hover, .um-item:focus-visible { background: var(--bg); outline: none; }
.um-item.danger { color: var(--danger); }
.um-sep { height: 1px; background: var(--line); margin: 4px 2px; }
@keyframes um-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@media (prefers-color-scheme: dark) { .user-menu { box-shadow: 0 12px 32px rgba(0, 0, 0, .5); } }
@media (prefers-reduced-motion: reduce) { .user-menu { animation: none; } }
@media (max-width: 760px) { .user-name { display: none; } .nav .user-btn { padding: 3px 6px 3px 3px; gap: 4px; } }

/* 站内切换页面时：旧内容保留到新页面就绪；加载稍慢（>250ms）才淡化，快速切换完全无感 */
#app[aria-busy="true"] { opacity: .6; pointer-events: none; transition: opacity .2s ease .25s; }

/* ---------- 管理后台 · USDC 收款 ---------- */
.gw { --gw-ok: #15803d; --gw-ok-bg: #dcfce7; --gw-warn: #b45309; --gw-warn-bg: #fef3c7; --gw-info: #1d4ed8; --gw-info-bg: #dbeafe;
  --gw-bad: var(--danger); --gw-bad-bg: #fee2e2; --gw-muted: var(--ink-3); --gw-muted-bg: var(--bg); }
@media (prefers-color-scheme: dark) {
  .gw { --gw-ok: #4ade80; --gw-ok-bg: rgba(74, 222, 128, .12); --gw-warn: #fbbf24; --gw-warn-bg: rgba(251, 191, 36, .12);
    --gw-info: #93c5fd; --gw-info-bg: rgba(147, 197, 253, .12); --gw-bad-bg: rgba(248, 113, 113, .12); }
}
.gw-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.gw-head h2 { margin: 0; }
.gw-nets { display: flex; gap: 6px; flex-wrap: wrap; }
.gw-chain { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 6px; background: var(--bg); color: var(--ink-2); font-size: 12px; font-weight: 500; border: 1px solid var(--line); }
.gw-chain::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #2775ca; } /* USDC 品牌蓝 */

.gw-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.gw-stat { padding: 14px 16px; border-radius: 12px; background: var(--bg); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gw-stat span { color: var(--ink-2); font-size: 13px; }
.gw-stat b { font-size: 22px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gw-stat b small { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.gw-stat em { font-style: normal; color: var(--ink-3); font-size: 12px; }
.gw-stat.alert { background: var(--gw-bad-bg); }
.gw-stat.alert span, .gw-stat.alert b { color: var(--gw-bad); }
.gw-tabs { margin-bottom: 4px; }
.gw-tabs .badge { background: var(--danger); color: #fff; margin-left: 6px; }

.gw-list { display: flex; flex-direction: column; }
.gw-row { position: relative; display: flex; gap: 16px; align-items: flex-start; padding: 16px 4px 16px 16px; border-bottom: 1px solid var(--line); }
.gw-row::before { content: ''; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 3px; background: var(--line); }
.gw-row.tone-ok::before { background: var(--gw-ok); }
.gw-row.tone-warn::before { background: var(--gw-warn); }
.gw-row.tone-info::before { background: var(--gw-info); }
.gw-row.tone-bad::before { background: var(--gw-bad); }
.gw-row.tone-wait::before { background: var(--ink-3); }
.gw-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.gw-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gw-status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--gw-muted-bg); color: var(--gw-muted); }
.gw-status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.gw-status.ok { background: var(--gw-ok-bg); color: var(--gw-ok); }
.gw-status.warn { background: var(--gw-warn-bg); color: var(--gw-warn); }
.gw-status.info { background: var(--gw-info-bg); color: var(--gw-info); }
.gw-status.bad { background: var(--gw-bad-bg); color: var(--gw-bad); }
.gw-status.wait { background: var(--bg); color: var(--ink-2); }
.gw-status.wait i { animation: gw-pulse 1.6s ease-in-out infinite; }
.gw-status.info i { animation: gw-pulse 1.6s ease-in-out infinite; }
@keyframes gw-pulse { 50% { opacity: .3; } }
.gw-time { font-size: 12px; margin-left: auto; }
.gw-amount { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.gw-amount b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.gw-amount .unit { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-right: 4px; }
.gw-progress { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.gw-progress .bar { width: 160px; max-width: 40%; height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; }
.gw-progress .bar span { display: block; height: 100%; border-radius: 3px; background: var(--gw-warn); }
.gw-meta { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.gw-id { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 2px 6px; margin-left: -6px; border: 0; border-radius: 6px; background: none; color: var(--ink-2); cursor: copy; font-size: 12px; }
.gw-id code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.gw-id svg { color: var(--ink-3); opacity: 0; transition: opacity .15s; flex-shrink: 0; }
.gw-id:hover { background: var(--bg); }
.gw-id:hover svg, .gw-id:focus-visible svg { opacity: 1; }
.gw-buyer { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.gw-alert { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 8px; background: var(--gw-bad-bg); color: var(--gw-bad); font-size: 13px; }
.gw-alert span { color: var(--ink-2); }
.gw-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; flex-shrink: 0; width: 104px; }
.gw-actions .btn { width: 100%; }
.gw-empty { display: inline-flex; flex-direction: column; align-items: center; gap: 10px; color: var(--ink-2); }
.gw-empty i { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 20px; font-weight: 700; background: var(--gw-ok-bg); color: var(--gw-ok); }
@media (prefers-reduced-motion: reduce) { .gw-status i { animation: none !important; } }
@media (max-width: 900px) { .gw-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .gw-row { flex-direction: column; align-items: stretch; gap: 12px; padding-right: 0; }
  .gw-actions { flex-direction: row; width: 100%; flex-wrap: wrap; }
  .gw-actions .btn { width: auto; flex: 1; }
  .gw-time { margin-left: 0; width: 100%; }
  .gw-stat b { font-size: 18px; }
}
.gw-progress.full .bar span { background: var(--gw-ok); }
.gw-flag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--gw-bad); color: #fff; }
@media (prefers-color-scheme: dark) { .gw-flag { color: #1c1917; } }

/* 确认框：影响范围 / 提醒 / 输入确认 */
dialog.confirm.wide { width: min(440px, calc(100% - 32px)); }
.confirm-details { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 16px 0 0; border-radius: 10px; overflow: hidden; background: var(--line); border: 1px solid var(--line); text-align: left; }
.confirm-details > div { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; background: var(--surface); font-size: 13px; min-width: 0; }
.confirm-details dt { color: var(--ink-2); white-space: nowrap; }
.confirm-details dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.confirm-notes { margin: 14px 0 0; padding: 10px 12px 10px 28px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 9%, var(--surface)); color: var(--danger); text-align: left; font-size: 13px; }
.confirm-notes li + li { margin-top: 4px; }
.confirm-type { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; text-align: left; font-size: 13px; color: var(--ink-2); }
.confirm-type span { word-break: break-all; }
.confirm-actions.single { grid-template-columns: 1fr; }
.confirm-actions .btn:disabled { opacity: .45; cursor: not-allowed; }

/* 用户管理 */
.users-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.users-head h2 { margin: 0; }
.users-search { display: flex; gap: 8px; flex: 1; max-width: 420px; min-width: 240px; }
.users-search .input { flex: 1; min-width: 0; }
.users-hint { min-height: 20px; margin-bottom: 4px; }

/* 多币种 */
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 600px) { .grid3 { grid-template-columns: 1fr 1fr; } .grid3 > :nth-child(2) { order: 3; grid-column: 1 / -1; } }
.cur-note { margin: 4px 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--ink-2); font-size: 13px; }
.cur-note b { color: var(--accent); }

/* ---------- 提现 ---------- */
.mono, .mono input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.neg { margin-right: 1px; }
.wd .wd-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; margin: 4px 0 20px; }
.wd-balance { padding: 16px 18px; border-radius: 12px; background: var(--accent-soft); display: flex; flex-direction: column; gap: 4px; }
.wd-balance span { color: var(--ink-2); font-size: 13px; }
.wd-balance b { font-size: 28px; line-height: 1.2; }
.wd-balance b .price { color: var(--ink); }
.wd-balance em { font-style: normal; color: var(--ink-3); font-size: 12px; }
.wd-rules { margin: 0; padding: 14px 16px 14px 32px; border-radius: 12px; background: var(--bg); color: var(--ink-2); font-size: 13px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.wd-rules b { color: var(--ink); }
.wd-form { display: flex; flex-direction: column; gap: 14px; max-width: 560px; }
.wd-form > .btn { align-self: flex-start; }
.wd-chains { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.wd-chain { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: 14px; }
.wd-chain::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #2775ca; }
.wd-chain:hover { border-color: var(--ink-3); }
.wd-chain.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.wd-amount { display: flex; gap: 8px; }
.wd-amount .input { flex: 1; min-width: 0; }
.wd-calc { min-height: 20px; font-size: 13px; color: var(--ink-2); }
.wd-calc b { color: var(--ink); }
.wd-calc .bad, .bad { color: var(--danger); }
.wd-note { padding: 8px 12px; border-radius: 8px; background: var(--bg); color: var(--ink-2); font-size: 13px; }
.wd-note.bad { background: color-mix(in srgb, var(--danger) 9%, var(--surface)); color: var(--danger); }
@media (max-width: 760px) { .wd .wd-top { grid-template-columns: 1fr; } }

.gw-id > span { white-space: nowrap; flex-shrink: 0; }

/* ---------- 店铺保证金 ---------- */
.deposit-badge { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5; vertical-align: middle; white-space: nowrap; color: #166534; background: #dcfce7; }
.shopline .deposit-badge { margin-left: 6px; }
.wd-balance em .deposit-badge { margin-left: 0; margin-right: 6px; }
.dep-quick { display: flex; gap: 8px; flex-wrap: wrap; margin: -4px 0 4px; }
.dep-refund { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { .deposit-badge { color: #86efac; background: rgba(34, 197, 94, .16); } }

/* ---------- 后台：首页 SEO ---------- */
.seo-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 28px; margin-top: 14px; align-items: start; }
.seo-form { display: grid; gap: 14px; }
.seo-count { font-style: normal; font-size: 12px; color: var(--muted); margin-left: 6px; }
.seo-count.over { color: #b45309; }
.seo-actions { display: flex; gap: 10px; }
.serp { padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.serp-url { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.serp-title { font-size: 19px; line-height: 1.35; color: #1a0dab; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.serp-desc { margin-top: 6px; font-size: 14px; line-height: 1.55; color: var(--ink-2, var(--muted)); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.serp-kw { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
@media (max-width: 860px) { .seo-grid { grid-template-columns: 1fr; } }
@media (prefers-color-scheme: dark) { .serp-title { color: #8ab4f8; } .seo-count.over { color: #fbbf24; } }
.serp-kw .chip { cursor: default; padding: 2px 10px; font-size: 12.5px; }

/* 提现网络设置 */
.wdset-chains { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.wdset-chain { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border, #e5e7eb); border-radius: 999px; cursor: pointer; }
.wdset-chain:has(input:checked) { border-color: var(--primary, #4f46e5); background: rgba(79, 70, 229, .08); }
