/* ============ tokens ============ */
:root {
    --bg: #080b10;
    --bg-2: #0d1118;
    --card: #191d26;
    --card-2: #14171f;
    --card-3: #101319;
    --line: rgba(255, 255, 255, .06);
    --line-2: rgba(255, 255, 255, .09);
    --text: #f2f5f8;
    --muted: #8b93a3;
    --muted-2: #616a79;
    --green: #2ff06b;
    --green-2: #1fd75f;
    --green-3: #0f3a22;
    --red: #ff4f66;
    --warn: #ffc861;
    --radius: 20px;
    --tab-h: 74px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(520px 300px at 50% -140px, rgba(47, 240, 107, .12), transparent 72%),
        linear-gradient(180deg, #0a0e14 0%, #07090d 55%, #05070a 100%);
    background-attachment: fixed;
}

input, button, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
button { border: 0; background: none; color: inherit; cursor: pointer; }

.app {
    position: relative;
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 18px 14px calc(var(--tab-h) + 28px);
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.num { font-variant-numeric: tabular-nums; }

/* ============ boot ============ */
.boot {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--bg);
    z-index: 50;
    transition: opacity .25s;
}
.boot.hide { opacity: 0; pointer-events: none; }
.boot-logo { font-size: 22px; font-weight: 800; letter-spacing: 1px; display: flex; align-items: center; gap: 8px; }
.boot-logo i { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 14px var(--green); }
.boot-spin {
    width: 26px; height: 26px; border-radius: 50%;
    border: 2px solid rgba(47, 240, 107, .18);
    border-top-color: var(--green);
    animation: spin .8s linear infinite;
}
.boot-text { color: var(--muted-2); font-size: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ pill header ============ */
.pill-head { display: flex; justify-content: center; margin: 6px 0 22px; }
.pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 11px 24px;
    border-radius: 999px;
    background: #05070a;
    border: 1.5px solid var(--green);
    box-shadow: 0 0 20px rgba(47, 240, 107, .22), inset 0 0 14px rgba(47, 240, 107, .07);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .3px;
}
.pill .ic { width: 19px; height: 19px; color: var(--green); }

/* ============ icons ============ */
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.solid { fill: currentColor; stroke: none; }

/* ============ cards ============ */
.card {
    position: relative;
    background: linear-gradient(165deg, #1c202a 0%, #171b23 55%, #151920 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .22);
}
.card.flat { background: var(--card-3); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; color: #e9eef5; }
.card-head .date { font-size: 12px; color: var(--muted-2); }

.label { color: var(--muted); font-size: 15px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* ============ pool ============ */
.addr-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.addr { flex: 1; font-size: 15px; font-weight: 700; letter-spacing: .3px; word-break: break-all; line-height: 1.4; }
.icon-btn {
    flex: none;
    width: 40px; height: 40px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(47, 240, 107, .13);
    color: var(--green);
    border: 1px solid rgba(47, 240, 107, .18);
    transition: .15s;
}
.icon-btn:active { transform: scale(.94); background: rgba(47, 240, 107, .22); }

.balance { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; }
.balance b {
    font-size: 44px; line-height: 1.1; font-weight: 800; letter-spacing: .5px;
    color: var(--green);
    text-shadow: 0 0 26px rgba(47, 240, 107, .35);
}
.balance span { font-size: 17px; font-weight: 700; color: var(--green); letter-spacing: .5px; }

.refresh-btn {
    width: 32px; height: 32px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--muted);
}
.refresh-btn.spin .ic { animation: spin .8s linear infinite; }

.tx-list { display: flex; flex-direction: column; gap: 10px; }
.tx {
    display: flex; align-items: center; gap: 13px;
    background: #12151c;
    border: 1px solid rgba(255, 255, 255, .035);
    border-radius: 16px;
    padding: 13px 14px;
}
.tx-ic {
    flex: none; width: 42px; height: 42px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.tx-ic.out { background: rgba(255, 79, 102, .13); color: var(--red); }
.tx-ic.in { background: rgba(47, 240, 107, .12); color: var(--green); }
.tx-ic .ic { width: 19px; height: 19px; }
.tx-main { flex: 1; min-width: 0; }
.tx-title { font-size: 15px; font-weight: 700; }
.tx-sub { font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.tx-right { text-align: right; flex: none; }
.tx-amount { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tx-amount.out { color: var(--red); }
.tx-amount.in { color: var(--green); }
.tx-time { font-size: 12px; color: var(--muted-2); margin-top: 2px; }

/* ============ steps ============ */
.steps { display: flex; align-items: center; gap: 10px; margin: 2px 4px 20px; }
.step { display: flex; align-items: center; gap: 8px; flex: none; }
.step i {
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: #2b303b; color: #c8d0dc; font-style: normal; font-weight: 700; font-size: 15px;
}
.step span { font-size: 15px; font-weight: 700; color: #c8d0dc; }
.step.on i { background: var(--green); color: #05170b; box-shadow: 0 0 18px rgba(47, 240, 107, .35); }
.step.on span { color: #fff; }
.step-line { flex: 1; height: 1px; background: rgba(255, 255, 255, .14); margin: 0 2px; }

/* ============ order form ============ */
.field-box {
    background: linear-gradient(165deg, #1c202a, #171b23);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px 18px;
    margin-bottom: 14px;
}
.field-box .label { font-size: 15px; }
.amount-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.amount-input {
    flex: 1; min-width: 0;
    background: transparent; border: 0; outline: none;
    color: #fff; font-size: 34px; font-weight: 700; letter-spacing: .5px;
    padding: 4px 0;
}
.amount-input::placeholder { color: #4a5160; }
.amount-value { flex: 1; font-size: 34px; font-weight: 800; color: #fff; letter-spacing: .5px; }
.amount-value.dim { color: #4a5160; }
.token {
    flex: none;
    display: inline-flex; align-items: center; gap: 8px;
    background: #05070a;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 15px;
    padding: 9px 14px;
    font-size: 15px; font-weight: 700;
}
.token .tether { width: 24px; height: 24px; flex: none; }

.hint {
    display: flex; align-items: center; gap: 8px;
    color: var(--muted); font-size: 13px;
    margin: 14px 4px 18px;
}
.hint .ic { width: 17px; height: 17px; color: var(--muted); flex: none; }

.primary {
    width: 100%;
    height: 58px;
    border-radius: 18px;
    background: linear-gradient(90deg, #23994e 0%, #1fe271 100%);
    color: #04160b;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .5px;
    box-shadow: 0 12px 28px rgba(31, 215, 95, .22);
    transition: .15s;
}
.primary:active { transform: translateY(1px) scale(.995); box-shadow: 0 6px 16px rgba(31, 215, 95, .18); }
.primary:disabled { opacity: .5; box-shadow: none; }
.primary.ghost {
    background: #1a1f28;
    color: #c9d3e0;
    border: 1px solid var(--line-2);
    box-shadow: none;
    font-size: 15px;
    height: 48px;
}
.btn-row { display: flex; gap: 12px; margin-top: 4px; }
.btn-row .primary { flex: 1; }

.link-btn {
    display: block;
    margin: 14px auto 0;
    color: var(--muted-2);
    font-size: 13px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ============ rate table ============ */
.rate-table { width: 100%; border-collapse: collapse; }
.rate-table th {
    text-align: left; font-size: 13px; font-weight: 600; color: var(--muted);
    padding: 0 2px 10px;
}
.rate-table th:last-child, .rate-table td:last-child { text-align: right; }
.rate-table td {
    padding: 12px 2px;
    border-top: 1px solid var(--line);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}
.rate-table td:last-child { color: var(--green); font-weight: 700; }
.rate-table .rng { color: #cfd7e2; }

/* ============ pay ============ */
.pay-wrap { text-align: center; }
.qr-box {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 12px; background: #fff; border-radius: 18px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .38);
    margin: 4px auto 16px;
}
.qr-box img, .qr-box canvas { display: block; }
.pay-amount { font-size: 36px; font-weight: 800; color: var(--green); letter-spacing: .5px; }
.pay-amount small { font-size: 15px; margin-left: 6px; color: var(--green); }
.pay-label { color: var(--muted); font-size: 13px; margin-top: 6px; }
.copy-line {
    display: flex; align-items: center; gap: 10px;
    background: #12151c; border: 1px solid var(--line);
    border-radius: 14px; padding: 12px 14px; margin-top: 12px;
    text-align: left;
}
.copy-line .k { flex: none; color: var(--muted); font-size: 12px; width: 48px; }
.copy-line .v { flex: 1; min-width: 0; font-size: 13px; word-break: break-all; color: #dfe7f1; }
.copy-line .v.mono { font-size: 11.5px; letter-spacing: -.2px; line-height: 1.5; }
.copy-line .icon-btn { width: 32px; height: 32px; }
.copy-line .icon-btn .ic { width: 16px; height: 16px; }

.countdown { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 13px; margin: 16px 0 4px; }
.countdown b { color: var(--warn); font-variant-numeric: tabular-nums; }

.pay-status {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 15px; border-radius: 14px; margin-bottom: 14px;
    background: rgba(47, 240, 107, .07);
    border: 1px solid rgba(47, 240, 107, .18);
    color: #9be7bb; font-size: 13px;
}
.pay-spin {
    width: 44px; height: 44px; margin: 6px auto 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 200, 97, .18);
    border-top-color: var(--warn);
    animation: spin .85s linear infinite;
}
.pay-icon { display: flex; justify-content: center; color: var(--green); }
.pay-icon .ic { width: 54px; height: 54px; stroke-width: 2; }

/* ============ orders ============ */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat {
    background: #12151c;
    border: 1px solid rgba(255, 255, 255, .035);
    border-radius: 16px;
    padding: 16px 8px;
    text-align: center;
}
.stat b { display: block; font-size: 20px; font-weight: 800; letter-spacing: .5px; }
.stat b.green { color: var(--green); }
.stat span { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; }

.tabs { position: relative; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 16px; padding-right: 44px; }
.tab {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 16px;
    border-radius: 999px;
    background: #262b36;
    color: #c4cdda;
    font-size: 14px;
    transition: .15s;
}
.tab em {
    font-style: normal;
    min-width: 20px; height: 20px; padding: 0 5px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 999px;
    background: rgba(0, 0, 0, .45);
    font-size: 11px;
    font-weight: 700;
}
.tab.on { background: linear-gradient(90deg, #4ff07e, #2ff06b); color: #05170b; font-weight: 700; }
.tab.on em { background: rgba(0, 0, 0, .75); color: #d9ffe7; }
.tabs .refresh-btn { position: absolute; right: 0; top: 2px; }

.empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px;
    padding: 56px 20px;
    color: var(--muted-2);
    font-size: 14px;
    background: linear-gradient(165deg, #1a1e27, #161a22);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.empty .ic { width: 58px; height: 58px; stroke-width: 1.1; color: #4b5464; }

.order-list { display: flex; flex-direction: column; gap: 12px; }
.order {
    background: linear-gradient(165deg, #1b1f29, #161a22);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 15px 16px;
    transition: .15s;
}
.order:active { background: #1d222c; }
.order-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.order-no { font-size: 12px; color: var(--muted-2); font-family: ui-monospace, Menlo, Consolas, monospace; }
.badge { padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.ok { background: rgba(47, 240, 107, .12); color: #55ef92; }
.badge.warn { background: rgba(255, 200, 97, .12); color: var(--warn); }
.badge.bad { background: rgba(255, 79, 102, .12); color: #ff8494; }
.badge.muted { background: rgba(255, 255, 255, .06); color: #98a2b3; }
.order-body { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.order-amount { font-size: 20px; font-weight: 800; letter-spacing: .3px; }
.order-amount small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.order-quota { text-align: right; font-size: 13px; color: var(--green); font-weight: 700; }
.order-time { font-size: 11px; color: var(--muted-2); margin-top: 8px; }

/* ============ detail ============ */
.detail-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.detail-head .big { font-size: 28px; font-weight: 800; }
.kv { display: grid; grid-template-columns: 88px 1fr; gap: 10px 12px; font-size: 13px; }
.kv .k { color: var(--muted-2); }
.kv .v { color: #dde5ef; word-break: break-all; }

.timeline { margin-top: 4px; }
.tl-item { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
    content: ''; position: absolute; left: 5px; top: 16px; bottom: 0; width: 1px;
    background: rgba(255, 255, 255, .08);
}
.tl-item:last-child::before { display: none; }
.tl-dot { flex: none; width: 11px; height: 11px; border-radius: 50%; background: #3a4250; margin-top: 4px; }
.tl-item.on .tl-dot { background: var(--green); box-shadow: 0 0 10px rgba(47, 240, 107, .5); }
.tl-item .t { font-size: 14px; font-weight: 600; }
.tl-item .d { font-size: 12px; color: var(--muted-2); margin-top: 2px; }

/* ============ me ============ */
.profile { display: flex; align-items: center; gap: 16px; }
.avatar {
    flex: none; width: 84px; height: 84px; border-radius: 50%;
    background: linear-gradient(160deg, #3bf57a, #17c455);
    display: flex; align-items: center; justify-content: center;
    font-size: 30px; font-weight: 800; color: #04160b;
    overflow: hidden;
    box-shadow: 0 0 0 4px rgba(47, 240, 107, .08);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.pinfo { flex: 1; min-width: 0; }
.pname { font-size: 21px; font-weight: 800; }
.puser { color: var(--muted); font-size: 13px; margin-top: 2px; }
.pid { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-top: 6px; }
.pid button { color: var(--muted); display: inline-flex; }

.menu { padding: 4px 18px; }
.menu-item {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
    width: 100%;
    text-align: left;
}
.menu-item:last-child { border-bottom: 0; }
.mi-icon {
    flex: none; width: 46px; height: 46px; border-radius: 50%;
    background: #0a0d12;
    display: flex; align-items: center; justify-content: center;
    color: var(--green);
}
.mi-icon .ic { width: 22px; height: 22px; }
.mi-text { flex: 1; min-width: 0; }
.mi-text b { display: block; font-size: 16px; font-weight: 700; }
.mi-text small { display: block; color: var(--muted-2); font-size: 12px; margin-top: 3px; }
.chev { color: #5b6474; flex: none; display: inline-flex; }
.chev .ic { width: 18px; height: 18px; }

/* ============ sub page ============ */
.sub-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 20px; }
.back-btn {
    width: 38px; height: 38px; border-radius: 50%;
    background: #171b23; border: 1px solid var(--line);
    display: inline-flex; align-items: center; justify-content: center;
    color: #cfd7e2;
}
.sub-head h2 { margin: 0; font-size: 17px; font-weight: 700; }

.article { color: #c7d0dc; font-size: 14px; line-height: 1.9; white-space: pre-wrap; word-break: break-word; }

.invite-box {
    background: #12151c;
    border: 1px dashed rgba(47, 240, 107, .28);
    border-radius: 14px;
    padding: 13px 14px;
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 14px;
}
.invite-box .v { flex: 1; min-width: 0; font-size: 12px; word-break: break-all; color: #cfe8da; }

.agent-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 4px; }

/* ============ tabbar ============ */
.tabbar {
    position: fixed;
    left: 50%;
    bottom: calc(10px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 496px;
    height: var(--tab-h);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px;
    border-radius: 26px;
    background: rgba(20, 23, 30, .86);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, .07);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
    z-index: 20;
}
.tabbar[hidden] { display: none; }
.tabbar button {
    flex: 1;
    height: 100%;
    border-radius: 18px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    color: #9aa4b4;
    transition: background .2s ease, color .2s ease;
}
.tabbar button .ic { width: 22px; height: 22px; }
.tabbar button span { font-size: 12px; }
.tabbar button.on {
    background: rgba(47, 240, 107, .12);
    color: var(--green);
    box-shadow: inset 0 0 0 1px rgba(47, 240, 107, .1);
}
.tabbar button.on span { font-weight: 600; }

/* ============ toast / sheet ============ */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--tab-h) + 34px + env(safe-area-inset-bottom));
    transform: translate(-50%, 16px);
    background: rgba(24, 29, 38, .96);
    border: 1px solid var(--line-2);
    color: #e8eef7;
    font-size: 13px;
    padding: 10px 18px;
    border-radius: 999px;
    opacity: 0;
    pointer-events: none;
    transition: .22s;
    z-index: 60;
    max-width: 82vw;
    text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.sheet-mask {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .6);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    display: flex; align-items: flex-end; justify-content: center;
    z-index: 55;
}
.sheet-mask[hidden] { display: none; }
.sheet {
    width: 100%; max-width: 520px;
    background: #171b23;
    border-radius: 22px 22px 0 0;
    padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line-2);
}
.sheet h4 { margin: 0 0 14px; font-size: 15px; }

/* skeleton */
.sk { background: linear-gradient(90deg, #171b23, #1f242e, #171b23); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; }
@keyframes sk { 0% { background-position: 0 0; } 100% { background-position: -200% 0; } }

@media (min-width: 560px) {
    .app { padding-top: 26px; }
    .tabbar { bottom: 16px; }
}
