/* YunPD 用户端样式（原生 CSS，无构建链） */
:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --ink: #16233a;
    --muted: #6b7a90;
    --line: #e6ebf2;
    --brand: #1f5eff;
    --brand-dark: #1746c4;
    --brand-soft: #eaf0ff;
    --green: #0f9d58;
    --green-soft: #e6f6ee;
    --red: #d93025;
    --red-soft: #fdecea;
    --amber: #b26a00;
    --amber-soft: #fff4e0;
    --radius: 14px;
    --shadow: 0 6px 24px rgba(22, 35, 58, .07);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px;
    height: 62px;
    display: flex;
    align-items: center;
    gap: 26px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 19px;
    color: var(--ink);
    letter-spacing: .4px;
}

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, #1f5eff, #3f86ff);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 15px;
}

.nav {
    display: flex;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
    padding: 8px 13px;
    border-radius: 9px;
    color: var(--muted);
    font-weight: 600;
    white-space: nowrap;
}
.nav a:hover { background: var(--brand-soft); color: var(--brand); }
.nav a.active { background: var(--brand-soft); color: var(--brand); }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--brand-soft); color: var(--brand);
    display: grid; place-items: center; font-weight: 700;
}

.container { max-width: 1180px; margin: 0 auto; padding: 26px 20px 60px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

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

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }
.card h2, .card h3 { margin: 0 0 12px; font-size: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 24px; font-weight: 800; letter-spacing: -.3px; }
.stat .hint { color: var(--muted); font-size: 12px; }
.value.pos { color: var(--green); }
.value.neg { color: var(--red); }

.btn {
    appearance: none;
    border: 1px solid transparent;
    background: var(--brand);
    color: #fff;
    border-radius: 10px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.btn.danger { background: var(--red); }
.btn.success { background: var(--green); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }

.form-row { display: grid; gap: 6px; margin-bottom: 14px; }
.form-row label { font-weight: 600; font-size: 13px; }
.form-row .help { color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 94, 255, .1); }
textarea { min-height: 92px; resize: vertical; }
.inline-input { display: flex; gap: 8px; }
.inline-input .btn { flex-shrink: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; background: #fafbfd; }
tbody tr:hover { background: #fafcff; }
td.num, th.num { text-align: right; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: #eef1f6;
    color: var(--muted);
}
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--brand-soft); color: var(--brand); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab {
    padding: 10px 14px;
    border: 0;
    background: none;
    color: var(--muted);
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    white-space: nowrap;
}
.tab:hover { color: var(--brand); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.empty { padding: 42px 12px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 13px; }
.alert.success { background: var(--green-soft); color: #0b6b3d; }
.alert.error { background: var(--red-soft); color: #a1211b; }
.alert.info { background: var(--brand-soft); color: var(--brand-dark); }
.alert.warn { background: var(--amber-soft); color: var(--amber); }

.modal-mask {
    position: fixed; inset: 0; background: rgba(18, 27, 43, .48);
    display: none; align-items: center; justify-content: center; padding: 18px; z-index: 60;
}
.modal-mask.open { display: flex; }
.modal {
    width: 100%; max-width: 480px; background: #fff; border-radius: 16px;
    padding: 22px; box-shadow: 0 20px 60px rgba(10, 20, 40, .28);
    max-height: 92vh; overflow-y: auto;
}
.modal.wide { max-width: 680px; }
.modal h3 { margin: 0 0 16px; font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.toast {
    position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px);
    background: #16233a; color: #fff; padding: 10px 18px; border-radius: 10px;
    font-size: 13.5px; opacity: 0; pointer-events: none; transition: .22s; z-index: 90;
    max-width: 86vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #b3261e; }
.toast.success { background: #0f7b47; }

.hero {
    background: radial-gradient(1200px 380px at 15% -10%, #dce8ff 0%, rgba(255,255,255,0) 62%), #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 52px 40px;
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}
.hero h1 { font-size: 34px; line-height: 1.24; margin: 0 0 14px; max-width: 640px; letter-spacing: -.6px; }
.hero p { color: var(--muted); max-width: 600px; margin: 0 0 24px; font-size: 15px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.feature { display: flex; flex-direction: column; gap: 8px; }
.feature .icon {
    width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
    background: var(--brand-soft); color: var(--brand); font-weight: 800;
}
.feature h3 { margin: 2px 0 0; font-size: 15px; }
.feature p { margin: 0; color: var(--muted); font-size: 13px; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }
.mt16 { margin-top: 16px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; }
.hidden { display: none !important; }
.copy-chip {
    display: inline-flex; align-items: center; gap: 8px;
    background: #f7f9fc; border: 1px dashed var(--line); border-radius: 10px;
    padding: 8px 12px; font-size: 12.5px;
}
.qr-box { display: grid; place-items: center; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.qr-box canvas, .qr-box svg { display: block; }

.chat { display: flex; flex-direction: column; gap: 12px; max-height: 420px; overflow-y: auto; padding: 4px; }
.msg { max-width: 76%; padding: 9px 13px; border-radius: 12px; background: #f1f4f9; font-size: 13.5px; }
.msg.mine { align-self: flex-end; background: var(--brand-soft); color: var(--brand-dark); }
.msg .meta { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.msg.admin { align-self: center; background: var(--amber-soft); color: var(--amber); max-width: 92%; }

.steps { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 18px; }
.step { flex: 1; min-width: 120px; padding: 10px 12px; border-radius: 10px; background: #f7f9fc; color: var(--muted); font-size: 12.5px; border: 1px solid var(--line); }
.step.done { background: var(--green-soft); color: var(--green); border-color: transparent; }
.step.current { background: var(--brand-soft); color: var(--brand); border-color: transparent; font-weight: 700; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 28px 18px; background: radial-gradient(900px 400px at 50% -10%, #dfe9ff, rgba(255,255,255,0) 65%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: 0 16px 50px rgba(22,35,58,.1); }
.auth-card h1 { margin: 14px 0 6px; font-size: 22px; }
.auth-card .sub { color: var(--muted); margin: 0 0 22px; font-size: 13.5px; }
.auth-card .brand { justify-content: center; }
.auth-foot { text-align: center; margin-top: 18px; color: var(--muted); font-size: 13px; }
.error-text { color: var(--red); font-size: 12.5px; margin-top: 4px; }

footer.foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 26px 16px 40px; }
footer.foot a { color: var(--muted); }

/* ---------------------------------------------------------------
   两套资产视图切换（平台资产 / 数字钱包）
   --------------------------------------------------------------- */
.view-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.view-switch__item {
    display: flex; align-items: center; gap: 13px;
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 14px 16px;
    box-shadow: var(--shadow); color: var(--ink); text-decoration: none;
    transition: transform .18s, border-color .18s, box-shadow .18s, background .18s;
}
.view-switch__item:hover { transform: translateY(-2px); border-color: var(--brand); color: var(--ink); }
.view-switch__item.active {
    border-color: var(--brand);
    background: linear-gradient(120deg, var(--brand-soft), #fff 78%);
    box-shadow: 0 10px 26px rgba(31, 94, 255, .14);
}
.view-switch__icon {
    width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px;
    display: grid; place-items: center; font-size: 19px; font-weight: 800;
    background: var(--brand-soft); color: var(--brand);
}
.view-switch__item.active .view-switch__icon { background: var(--brand); color: #fff; }
.view-switch__title { font-weight: 700; font-size: 14.5px; }
.view-switch__desc { color: var(--muted); font-size: 12.5px; margin-top: 1px; }

/* 当前视图高亮：两套资产一眼可分 */
.is-active-view > .card:first-child,
.dw-section-head.is-active-view {
    border-color: #c7d6ff;
    box-shadow: 0 8px 28px rgba(31, 94, 255, .12);
}

/* 平台资产：USDT 主余额 hero + 操作条 */
.pv-hero {
    display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
    background: linear-gradient(120deg, #eef3ff 0%, #f8faff 62%, #fff 100%);
    border: 1px solid #dfe8ff; border-radius: 14px; padding: 18px 20px;
}
.pv-hero__label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.pv-hero__value {
    font-size: 32px; font-weight: 800; letter-spacing: -.8px; color: var(--ink);
    line-height: 1.25; display: flex; align-items: baseline; gap: 8px;
}
.pv-hero__value small { font-size: 14px; font-weight: 700; color: var(--brand); letter-spacing: 0; }
.pv-hero__sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.pv-hero__side { display: flex; gap: 26px; flex-wrap: wrap; }
.pv-hero__side-item { display: flex; flex-direction: column; gap: 3px; }
.pv-hero__side-item span { color: var(--muted); font-size: 12px; }
.pv-hero__side-item strong { font-size: 15px; font-weight: 700; }
.pv-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 16px; }

/* 数字钱包：视图分隔标题 */
.dw-section-head {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 15px 18px; box-shadow: var(--shadow); margin: 24px 0 16px;
}
.dw-section-head__icon {
    width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px;
    display: grid; place-items: center; font-size: 18px; color: #fff;
    background: linear-gradient(135deg, #2a63ff, #16245f);
}
.dw-section-head h2 { margin: 0; font-size: 17px; }
.dw-section-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.dw-section-head .badge { margin-left: auto; }

/* 数字钱包主卡上的按钮 */
.dw-card__actions {
    position: relative; z-index: 1; display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap; margin-top: 18px;
}
.dw-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.3);
    border-radius: 9px; padding: 6px 12px; font-size: 12.5px; font-weight: 600;
    text-decoration: none; cursor: pointer; transition: .15s;
}
.dw-btn:hover { background: rgba(255,255,255,.3); color: #fff; }
.dw-card__note { position: relative; z-index: 1; margin: 14px 0 0; opacity: .82; line-height: 1.7; }

/* ---------------------------------------------------------------
   数字钱包：钱包风格渐变主卡
   --------------------------------------------------------------- */
.dw-card {
    position: relative; overflow: hidden;
    border-radius: 18px; padding: 22px 24px;
    background: linear-gradient(125deg, #2a63ff 0%, #2749cf 46%, #16245f 100%);
    color: #fff; box-shadow: 0 16px 38px rgba(23, 51, 150, .26);
}
.dw-card::before {
    content: ""; position: absolute; width: 360px; height: 360px; right: -110px; top: -190px;
    background: radial-gradient(circle, rgba(255,255,255,.22) 0%, rgba(255,255,255,0) 68%);
    border-radius: 50%; pointer-events: none;
}
.dw-card::after {
    content: ""; position: absolute; width: 260px; height: 260px; right: 40px; bottom: -200px;
    border: 1px solid rgba(255,255,255,.14); border-radius: 50%; pointer-events: none;
}
.dw-card__top, .dw-card__addr, .dw-card__foot { position: relative; z-index: 1; }
.dw-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dw-card__label { font-size: 12.5px; letter-spacing: 1.5px; text-transform: uppercase; opacity: .78; }
.dw-card__title { font-size: 20px; font-weight: 800; margin-top: 3px; letter-spacing: .2px; }
.dw-card__badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25);
    color: #fff; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.dw-card__badge i { width: 7px; height: 7px; border-radius: 50%; background: #7cf0b4; box-shadow: 0 0 0 3px rgba(124,240,180,.25); }
.dw-card__addr {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-top: 26px; background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.18); border-radius: 11px;
    padding: 10px 12px; width: fit-content; max-width: 100%;
}
.dw-card__addr .mono { font-size: 13px; word-break: break-all; }
.dw-card__copy {
    flex-shrink: 0; background: rgba(255,255,255,.2); color: #fff;
    border: 0; border-radius: 8px; padding: 4px 10px; font-size: 12px;
    font-weight: 600; cursor: pointer; transition: .15s;
}
.dw-card__copy:hover { background: rgba(255,255,255,.34); }
.dw-card__foot {
    display: flex; gap: 18px; flex-wrap: wrap; margin-top: 22px;
    font-size: 12.5px; opacity: .84;
}
.dw-card__foot span::before { content: "✓"; margin-right: 6px; color: #7cf0b4; font-weight: 700; }

/* 链上资产卡片网格 */
.dw-assets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.dw-assets > .empty { grid-column: 1 / -1; }
.dw-asset {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px; box-shadow: var(--shadow);
    transition: transform .18s, box-shadow .18s, border-color .18s;
}
.dw-asset:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(22,35,58,.13); border-color: #cdd9f5; }
.dw-asset__head { display: flex; align-items: center; gap: 10px; }
.dw-asset__icon {
    width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%;
    display: grid; place-items: center; color: #fff; font-size: 15px; font-weight: 800;
}
.dw-asset__icon.eth { background: linear-gradient(135deg, #7b8cff, #4a55c9); }
.dw-asset__icon.usdt { background: linear-gradient(135deg, #3fc39a, #169c74); }
.dw-asset__icon.usdc { background: linear-gradient(135deg, #4a9dff, #2169d6); }
.dw-asset__name { font-weight: 700; font-size: 13.5px; line-height: 1.3; }
.dw-asset__net { color: var(--muted); font-size: 12px; margin-top: 1px; }
.dw-asset__value {
    font-size: 21px; font-weight: 800; margin-top: 15px;
    word-break: break-all; letter-spacing: -.3px; min-height: 30px;
}
.dw-asset__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.dw-asset__foot .hint { color: var(--muted); font-size: 11.5px; }
.dw-asset.is-error { border-color: #f3c6c2; background: #fffafa; }
.dw-asset.is-error .dw-asset__value { color: var(--red); font-size: 15px; font-weight: 700; }

/* 加载骨架 */
.dw-skeleton {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px; box-shadow: var(--shadow);
}
.dw-skeleton .sk-line {
    height: 12px; border-radius: 6px; margin-bottom: 12px;
    background: linear-gradient(90deg, #eef2f8 25%, #f7f9fc 50%, #eef2f8 75%);
    background-size: 200% 100%; animation: dw-shimmer 1.3s infinite linear;
}
.dw-skeleton .sk-line.lg { height: 26px; width: 68%; }
.dw-skeleton .sk-line.sm { width: 45%; height: 10px; margin-bottom: 0; }
.dw-skeleton .sk-circle { width: 36px; height: 36px; border-radius: 50%; margin-bottom: 14px;
    background: linear-gradient(90deg, #eef2f8 25%, #f7f9fc 50%, #eef2f8 75%);
    background-size: 200% 100%; animation: dw-shimmer 1.3s infinite linear; }
@keyframes dw-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* 平台资产表合计行 */
tr.total-row td { background: var(--brand-soft); font-weight: 800; color: var(--brand-dark); border-bottom: 0; }
tr.total-row:hover td { background: var(--brand-soft); }

/* 资产明细小标题（不包在 .card 内时保持字号） */
.card-head h3.dw-list-title { font-size: 16px; margin: 0; }

@media (max-width: 900px) {
    .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dw-assets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
    .topbar-inner { height: auto; padding: 10px 14px; flex-wrap: wrap; gap: 10px; }
    .nav { order: 3; width: 100%; }
    .container { padding: 18px 14px 48px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .hero { padding: 32px 22px; }
    .hero h1 { font-size: 25px; }
    .card { padding: 16px; }
    .stat .value { font-size: 20px; }
    .hide-sm { display: none !important; }
    .view-switch { grid-template-columns: 1fr; }
    .dw-assets { grid-template-columns: 1fr; }
    .dw-card { padding: 18px; }
    .pv-hero__value { font-size: 26px; }
    .pv-hero__side { gap: 16px; }
    .dw-section-head .badge { margin-left: 0; }
}
