/* ==========================================================================
   USDT 支付系统 - 全局样式（原生 CSS，浅色清新风格）
   ========================================================================== */

:root {
    --primary: #0f9d76;
    --primary-light: #35c5a0;
    --primary-soft: rgba(15, 157, 118, .1);
    --accent: #3b82f6;
    --danger: #e5484d;
    --warning: #f0a020;
    --ink: #0f1f2e;
    --ink-2: #33475b;
    --muted: #7188a0;
    --line: rgba(15, 31, 46, .08);
    --card: rgba(255, 255, 255, .86);
    --bg: #f1f7fa;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 18px 44px -24px rgba(15, 48, 70, .35);
    --sidebar: 240px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--bg);
    background-image:
        radial-gradient(1000px 520px at 8% -10%, rgba(53, 197, 160, .18), transparent 60%),
        radial-gradient(900px 480px at 100% 0%, rgba(59, 130, 246, .12), transparent 55%),
        radial-gradient(700px 420px at 50% 110%, rgba(15, 157, 118, .08), transparent 60%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar);
    flex: 0 0 var(--sidebar);
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 18px;
    background: rgba(255, 255, 255, .72);
    backdrop-filter: blur(14px);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 22px;
    z-index: 30;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: grid; place-items: center;
    color: #fff; font-weight: 700; font-size: 15px;
    box-shadow: 0 10px 22px -12px rgba(15, 157, 118, .9);
}
.brand-text strong { display: block; font-size: 15px; letter-spacing: .3px; }
.brand-text span { font-size: 11px; color: var(--muted); letter-spacing: .8px; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label { font-size: 11px; color: var(--muted); letter-spacing: 1px; padding: 10px 12px 4px; text-transform: uppercase; }
.nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 12px;
    color: var(--ink-2); font-size: 13.5px;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav a .ico { width: 20px; height: 20px; display: grid; place-items: center; opacity: .75; }
.nav a:hover { background: rgba(15, 157, 118, .07); color: var(--primary); }
.nav a.active {
    background: linear-gradient(135deg, rgba(15, 157, 118, .14), rgba(53, 197, 160, .1));
    color: var(--primary); font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(15, 157, 118, .16);
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.userchip {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; border-radius: 14px;
    background: rgba(255, 255, 255, .8);
    border: 1px solid var(--line);
}
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #d7f3ea, #eaf5ff);
    color: var(--primary); font-weight: 700; font-size: 13px;
}
.userchip .meta { min-width: 0; }
.userchip .meta strong { display: block; font-size: 13px; }
.userchip .meta span { font-size: 11px; color: var(--muted); }
.logout {
    font-size: 12px; color: var(--muted); padding: 6px 10px;
    border-radius: 10px; text-align: center; border: 1px dashed var(--line);
}
.logout:hover { color: var(--danger); border-color: rgba(229, 72, 77, .35); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; gap: 14px;
    padding: 18px 28px;
    position: sticky; top: 0; z-index: 20;
    background: linear-gradient(180deg, rgba(241, 247, 250, .95), rgba(241, 247, 250, .55));
    backdrop-filter: blur(8px);
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 650; letter-spacing: .2px; }
.topbar .sub { font-size: 12.5px; color: var(--muted); }
.topbar .spacer { flex: 1; }

.menu-btn {
    display: none;
    width: 38px; height: 38px; border-radius: 11px;
    border: 1px solid var(--line); background: #fff; color: var(--ink-2);
    cursor: pointer;
}

.content { padding: 4px 28px 40px; }

/* ---------- 卡片 / 网格 ---------- */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, .9);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    padding: 20px;
    backdrop-filter: blur(10px);
}
.card.tight { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 15px; margin: 0; font-weight: 650; }
.card-head .hint { font-size: 12px; color: var(--muted); }

.stat { position: relative; overflow: hidden; }
.stat .stat-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.4px; margin-top: 6px; }
.stat .stat-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.stat .stat-foot { font-size: 12px; color: var(--muted); margin-top: 6px; }
.stat::after {
    content: ""; position: absolute; right: -30px; top: -30px;
    width: 110px; height: 110px; border-radius: 50%;
    background: radial-gradient(circle, rgba(53, 197, 160, .18), transparent 70%);
}
.stat.blue::after { background: radial-gradient(circle, rgba(59, 130, 246, .16), transparent 70%); }
.stat.amber::after { background: radial-gradient(circle, rgba(240, 160, 32, .16), transparent 70%); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
th {
    text-align: left; font-weight: 600; font-size: 12px; color: var(--muted);
    padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 12px; border-bottom: 1px solid rgba(15, 31, 46, .05); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(15, 157, 118, .035); }
.mono { font-family: "JetBrains Mono", Consolas, "Courier New", monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 徽标 ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
    background: rgba(113, 136, 160, .12); color: var(--ink-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.paid { background: rgba(15, 157, 118, .12); color: #0b7f5f; }
.badge.pending { background: rgba(240, 160, 32, .14); color: #a86a00; }
.badge.expired { background: rgba(113, 136, 160, .14); color: #63758a; }
.badge.closed { background: rgba(229, 72, 77, .12); color: #b3353a; }
.badge.soft { background: rgba(59, 130, 246, .12); color: #2d6cd6; }
.badge.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.badge.ghost::before { display: none; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border-radius: 12px; border: 1px solid transparent;
    font-size: 13px; font-weight: 550; cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
    background: #fff; color: var(--ink-2); border-color: var(--line);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 20px -14px rgba(15, 48, 70, .6); }
.btn:active { transform: translateY(0); }
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff; border: 0;
    box-shadow: 0 12px 26px -16px rgba(15, 157, 118, .95);
}
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: rgba(229, 72, 77, .28); background: rgba(229, 72, 77, .06); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.field .tip { font-size: 11.5px; color: var(--muted); }
input[type="text"], input[type="password"], input[type="number"], input[type="email"], select, textarea {
    width: 100%; padding: 10px 12px; border-radius: 12px;
    border: 1px solid var(--line); background: rgba(255, 255, 255, .9);
    font-size: 13px; color: var(--ink); outline: none;
    transition: border-color .16s ease, box-shadow .16s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: rgba(15, 157, 118, .45);
    box-shadow: 0 0 0 4px rgba(15, 157, 118, .1);
}
textarea { min-height: 84px; resize: vertical; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }

/* ---------- 提示条 ---------- */
.flash {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 12px 14px; border-radius: 14px; margin-bottom: 16px;
    font-size: 13px; border: 1px solid transparent;
}
.flash.success { background: rgba(15, 157, 118, .1); color: #0b7f5f; border-color: rgba(15, 157, 118, .18); }
.flash.error { background: rgba(229, 72, 77, .08); color: #b3353a; border-color: rgba(229, 72, 77, .2); }

.empty { padding: 36px 12px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager span {
    min-width: 32px; height: 32px; padding: 0 10px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px; font-size: 12.5px;
    background: #fff; border: 1px solid var(--line); color: var(--ink-2);
}
.pager .active { background: var(--primary); color: #fff; border-color: transparent; }
.pager .disabled { opacity: .45; pointer-events: none; }

/* ---------- 地址 / 复制 ---------- */
.addr {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 12px; border-radius: 12px;
    background: rgba(241, 247, 250, .9); border: 1px dashed var(--line);
    font-family: "JetBrains Mono", Consolas, monospace; font-size: 12.5px;
    word-break: break-all;
}
.copy {
    flex: 0 0 auto; border: 0; background: transparent; color: var(--primary);
    cursor: pointer; font-size: 12px;
}

/* ---------- 链卡片 ---------- */
.chain-card { display: flex; flex-direction: column; gap: 10px; }
.chain-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chain-top > .chain-top { flex: 1; min-width: 0; }
.chain-icon {
    flex: 0 0 38px;
    width: 38px; height: 38px; border-radius: 12px;
    background: linear-gradient(135deg, rgba(15, 157, 118, .14), rgba(59, 130, 246, .12));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 11px; letter-spacing: .3px; color: var(--primary);
    overflow: hidden; white-space: nowrap; padding: 0 4px;
}
.chain-meta { min-width: 0; flex: 1; }
.chain-meta strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chain-meta span { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 登录页 ---------- */
.guest {
    min-height: 100vh; display: grid; place-items: center; padding: 28px 18px;
}
.guest-card {
    width: 100%; max-width: 420px;
    background: rgba(255, 255, 255, .86);
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: 24px; padding: 34px 30px;
    box-shadow: 0 30px 70px -40px rgba(15, 48, 70, .6);
    backdrop-filter: blur(16px);
}
.guest-head { text-align: center; margin-bottom: 22px; }
.guest-head .brand-mark { margin: 0 auto 12px; width: 46px; height: 46px; border-radius: 14px; font-size: 17px; }
.guest-head h1 { font-size: 20px; margin: 0 0 4px; }
.guest-head p { margin: 0; font-size: 12.5px; color: var(--muted); }
.guest .field { margin-bottom: 14px; }
.guest-foot { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 18px; }
.guest-foot a { color: var(--primary); font-weight: 550; }

/* ---------- 收银台 ---------- */
.pay-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.pay-card {
    width: 100%; max-width: 440px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(255, 255, 255, .95);
    border-radius: 26px; padding: 26px 24px 22px;
    box-shadow: 0 40px 80px -46px rgba(15, 48, 70, .65);
    backdrop-filter: blur(18px);
}
.pay-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.pay-head strong { font-size: 15px; }
.pay-amount { text-align: center; margin: 18px 0 6px; }
.pay-amount .value { font-size: 34px; font-weight: 700; letter-spacing: -1px; }
.pay-amount .value small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.pay-amount .chain { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.qr-box {
    width: 220px; height: 220px; margin: 16px auto 14px;
    padding: 10px; border-radius: 18px; background: #fff;
    border: 1px solid var(--line); box-shadow: inset 0 0 0 6px rgba(241, 247, 250, .9);
}
.qr-box img { width: 100%; height: 100%; }
.pay-countdown { text-align: center; font-size: 13px; color: var(--ink-2); }
.pay-countdown b { color: var(--warning); font-variant-numeric: tabular-nums; }
.pay-info { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.pay-info .row { display: flex; flex-direction: column; gap: 5px; }
.pay-info .row .label { font-size: 11.5px; color: var(--muted); }
.pay-tip { margin-top: 16px; font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.pay-state {
    margin-top: 16px; padding: 14px; border-radius: 16px; text-align: center;
    background: rgba(15, 157, 118, .1); color: #0b7f5f; font-size: 13px;
}
.pay-state.expired { background: rgba(113, 136, 160, .14); color: #63758a; }

/* ---------- 文档 ---------- */
.doc h3 { font-size: 14px; margin: 22px 0 8px; }
.doc h3:first-child { margin-top: 0; }
.doc p { font-size: 13px; color: var(--ink-2); margin: 6px 0; }
.doc code {
    background: rgba(15, 31, 46, .06); padding: 2px 6px; border-radius: 6px;
    font-family: "JetBrains Mono", Consolas, monospace; font-size: 12px;
}
.doc pre {
    background: #0f2231; color: #dfeaf2; border-radius: 14px;
    padding: 16px; overflow-x: auto; font-size: 12px; line-height: 1.7;
    font-family: "JetBrains Mono", Consolas, monospace;
}
.doc pre .c { color: #7ea7bd; }

/* ---------- 弹层 ---------- */
.modal-mask {
    position: fixed; inset: 0; z-index: 90;
    display: none; padding: 24px 18px;
    background: radial-gradient(120% 120% at 50% 0%, rgba(15, 48, 70, .34), rgba(9, 22, 34, .52));
    backdrop-filter: blur(6px) saturate(120%);
    -webkit-backdrop-filter: blur(6px) saturate(120%);
    overflow-y: auto;
}
.modal-mask.show {
    display: flex; align-items: flex-start; justify-content: center;
    animation: mask-in .2s ease both;
}
.modal {
    width: 100%; max-width: 480px; background: #fff; border-radius: 20px;
    padding: 22px; box-shadow: 0 40px 80px -40px rgba(15, 48, 70, .7);
    max-height: calc(100vh - 48px); overflow-y: auto;
    margin: auto;
    animation: dialog-in .28s cubic-bezier(.22, 1, .36, 1) both;
}
.modal .form-grid { gap: 12px; }
.modal h3 { margin: 0 0 14px; font-size: 16px; }

/* 自定义确认弹窗 */
body.modal-open { overflow: hidden; }
.confirm-card {
    position: relative; width: 100%; max-width: 420px; margin: auto;
    padding: 26px 26px 22px; overflow: hidden;
    background: #fff; border-radius: 22px;
    box-shadow: 0 40px 90px -40px rgba(9, 35, 55, .78), inset 0 0 0 1px rgba(255, 255, 255, .7);
    animation: dialog-in .28s cubic-bezier(.22, 1, .36, 1) both;
}
.confirm-card::before {
    content: ""; position: absolute; left: -20%; right: -20%; top: -70px; height: 170px;
    background: radial-gradient(60% 100% at 50% 0%, rgba(53, 197, 160, .26), transparent 72%);
    pointer-events: none;
}
.confirm-card.danger::before {
    background: radial-gradient(60% 100% at 50% 0%, rgba(229, 72, 77, .2), transparent 72%);
}
.confirm-icon {
    position: relative; width: 48px; height: 48px; border-radius: 16px;
    display: grid; place-items: center; margin-bottom: 15px;
    color: #0b7f5f;
    background: linear-gradient(135deg, rgba(15, 157, 118, .16), rgba(53, 197, 160, .07));
    box-shadow: inset 0 0 0 1px rgba(15, 157, 118, .16);
}
.confirm-icon svg { width: 22px; height: 22px; }
.confirm-card.danger .confirm-icon {
    color: #b3353a;
    background: linear-gradient(135deg, rgba(229, 72, 77, .16), rgba(229, 72, 77, .05));
    box-shadow: inset 0 0 0 1px rgba(229, 72, 77, .2);
}
.confirm-title {
    position: relative; margin: 0 0 8px;
    font-size: 16.5px; font-weight: 650; letter-spacing: .2px;
}
.confirm-msg {
    position: relative; margin: 0;
    font-size: 13px; line-height: 1.75; color: var(--ink-2);
    word-break: break-word; white-space: pre-line;
}
.confirm-actions {
    position: relative; display: flex; justify-content: flex-end; gap: 10px;
    margin-top: 22px;
}
.confirm-actions .btn { min-width: 92px; }
.btn-danger-solid {
    background: linear-gradient(135deg, #e5484d, #f1716f);
    color: #fff; border: 0;
    box-shadow: 0 12px 26px -16px rgba(229, 72, 77, .9);
}

@keyframes mask-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes dialog-in {
    from { opacity: 0; transform: translateY(12px) scale(.965); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0;
        transform: translateX(-104%);
        transition: transform .24s ease;
        box-shadow: 0 30px 60px -30px rgba(15, 48, 70, .6);
        background: rgba(255, 255, 255, .96);
    }
    .sidebar.open { transform: translateX(0); }
    .menu-btn { display: grid; place-items: center; }
    .topbar { padding: 14px 16px; }
    .content { padding: 4px 16px 32px; }
    .grid-2 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .card { padding: 16px; border-radius: 16px; }
    .stat .stat-value { font-size: 21px; }
    .topbar h1 { font-size: 16px; }
    .topbar .sub { display: none; }
    .content { padding: 4px 12px 28px; }
    .pay-card { padding: 22px 16px 18px; }
    .qr-box { width: 190px; height: 190px; }
    .confirm-card { padding: 22px 20px 18px; border-radius: 20px; }
    .confirm-actions .btn { flex: 1; min-width: 0; }
}

/* 遮罩（移动端侧栏展开） */
.side-mask {
    position: fixed; inset: 0; background: rgba(15, 31, 46, .3);
    display: none; z-index: 25;
}
.side-mask.show { display: block; }
