/* ===== 鉴权页面（登录 / 注册 / 二次验证 / 客户中心）===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 10px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(15,23,42,0.14);
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f0f4f8;
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* 背景装饰 */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 12% 18%, rgba(37, 99, 235, 0.13), transparent 45%),
        radial-gradient(circle at 88% 82%, rgba(124, 58, 237, 0.11), transparent 45%),
        #f0f4f8;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 36px 34px 30px;
    position: relative;
    z-index: 2;
    animation: cardIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-card.wide { max-width: 760px; }

@keyframes cardIn {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 26px;
}

.auth-brand svg { flex-shrink: 0; }

.auth-brand-text strong {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: 0.2px;
}

.auth-brand-text span {
    font-size: 12px;
    color: var(--gray-400);
}

.auth-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 13.5px;
    color: var(--gray-500);
    margin-bottom: 24px;
    line-height: 1.55;
}

/* 表单 */
.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 7px;
}

.field input {
    width: 100%;
    padding: 11px 13px;
    font-size: 14.5px;
    font-family: inherit;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    background: var(--gray-50);
    color: var(--gray-900);
    transition: 0.18s ease;
    outline: none;
}

.field input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3.5px rgba(37, 99, 235, 0.12);
}

.field input::placeholder { color: var(--gray-400); }

.field .hint {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 5px;
}

.btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.18s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.34);
}

.btn-primary:disabled {
    opacity: 0.62;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-ghost {
    background: var(--gray-100);
    color: var(--gray-700);
    font-weight: 500;
}

.btn-ghost:hover { background: var(--gray-200); }

.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
    font-weight: 500;
}

.btn-danger:hover { background: #fecaca; }

.btn-sm {
    width: auto;
    padding: 7px 14px;
    font-size: 13px;
    border-radius: 7px;
}

/* 提示条 */
.auth-alert {
    padding: 11px 13px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
    line-height: 1.5;
}

.auth-alert.show { display: block; }

.auth-alert.error {
    background: var(--danger-light);
    color: #991b1b;
    border-left: 3px solid var(--danger);
}

.auth-alert.success {
    background: var(--success-light);
    color: #166534;
    border-left: 3px solid var(--success);
}

.auth-alert.warning {
    background: var(--warning-light);
    color: #92400e;
    border-left: 3px solid var(--warning);
}

.auth-alert.info {
    background: var(--primary-light);
    color: #1e40af;
    border-left: 3px solid var(--primary);
}

/* 底部链接 */
.auth-footer {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--gray-100);
    font-size: 13px;
    color: var(--gray-500);
    text-align: center;
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover { text-decoration: underline; }

.auth-links {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
    font-size: 13px;
}

.auth-links a {
    color: var(--gray-500);
    text-decoration: none;
}

.auth-links a:hover { color: var(--primary); }

/* 邮箱验证码行布局 */
.code-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.code-row .code-input {
    flex: 1 1 auto;
    min-width: 120px;
}

.code-row .code-send-btn {
    width: auto !important;
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 0 16px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    background: #fff;
    color: #374151;
    font-size: 13.5px;
    cursor: pointer;
    font-family: inherit;
}

/* 邮箱验证码输入：强制单框，避免 Safari 渲染成分段 6 格 OTP UI */
.code-input,
#code,
#fp-code {
    -webkit-appearance: none;
    appearance: none;
    text-align: center;
    font-family: 'SF Mono', Consolas, monospace !important;
    letter-spacing: 0 !important;
    caret-color: #2563eb;
}

/* 阻止 Safari 把 6 位数字输入当成安全码 */
.code-input::-webkit-textfield-decoration-container,
#code::-webkit-textfield-decoration-container,
#fp-code::-webkit-textfield-decoration-container {
    display: flex;
    align-items: center;
}

/* 某些浏览器插件/密码管理器会注入 6 格 UI，隐藏它 */
.code-input ~ div[class*="otp"],
#code ~ div[class*="otp"],
#fp-code ~ div[class*="otp"],
.code-input ~ div[class*="verification"],
#code ~ div[class*="verification"],
#fp-code ~ div[class*="verification"] {
    display: none !important;
}
    letter-spacing: 12px;
    text-align: center;
    font-size: 24px !important;
    font-weight: 600;
    font-family: 'SF Mono', Consolas, monospace !important;
    padding: 13px !important;
}

/* 二维码绑定 */
.totp-setup {
    text-align: center;
}

.totp-qr {
    display: inline-block;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    margin: 6px 0 14px;
}

.totp-qr img { display: block; width: 200px; height: 200px; }

.totp-secret {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--gray-50);
    border: 1px dashed var(--gray-300);
    border-radius: 7px;
    padding: 8px 12px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 13px;
    color: var(--gray-700);
    word-break: break-all;
    margin-bottom: 16px;
}

.totp-steps {
    text-align: left;
    font-size: 13px;
    color: var(--gray-600);
    background: var(--gray-50);
    border-radius: 8px;
    padding: 13px 15px 13px 30px;
    margin-bottom: 18px;
    line-height: 1.85;
}

.totp-steps li { margin: 0; }

/* ===== 客户中心 ===== */
.portal-shell {
    min-height: 100vh;
    background: #f0f4f8;
}

.portal-header {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.portal-header .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 15px;
    color: var(--gray-900);
    text-decoration: none;
}

.portal-user {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13.5px;
}

.portal-user .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.portal-main {
    max-width: 1080px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

.portal-main h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}

.portal-main .lead {
    color: var(--gray-500);
    font-size: 13.5px;
    margin-bottom: 24px;
}

.portal-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    align-items: start;
}

@media (max-width: 900px) {
    .portal-grid { grid-template-columns: 1fr; }
}

.panel {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-head h2 {
    font-size: 15px;
    font-weight: 600;
}

.panel-body { padding: 18px 20px; }

.order-item {
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
    transition: 0.18s;
}

.order-item:hover { border-color: var(--gray-300); }

.order-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.order-name {
    font-weight: 600;
    font-size: 14.5px;
    color: var(--gray-900);
}

.order-meta {
    font-size: 12px;
    color: var(--gray-400);
    font-family: 'SF Mono', Consolas, monospace;
    margin-top: 3px;
}

.order-amount {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
    white-space: nowrap;
}

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.7;
}

.badge.pending { background: var(--warning-light); color: #92400e; }
.badge.paid { background: var(--primary-light); color: #1e40af; }
.badge.delivering { background: #ede9fe; color: #5b21b6; }
.badge.completed { background: var(--success-light); color: #166534; }
.badge.expired,
.badge.cancelled { background: var(--gray-100); color: var(--gray-500); }

.delivery-box {
    margin-top: 10px;
    background: var(--gray-900);
    color: #a7f3d0;
    border-radius: 8px;
    padding: 12px 14px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-all;
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.12);
    color: #e2e8f0;
    border: none;
    border-radius: 5px;
    padding: 3px 9px;
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
}

.copy-btn:hover { background: rgba(255,255,255,0.24); }

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-400);
    font-size: 13.5px;
}

.empty-state svg {
    width: 46px;
    height: 46px;
    stroke: var(--gray-300);
    margin-bottom: 12px;
}

/* 安全设置项 */
.security-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 0;
    border-bottom: 1px solid var(--gray-100);
    gap: 14px;
}

.security-item:last-child { border-bottom: none; }

.security-item .info strong {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--gray-800);
}

.security-item .info span {
    font-size: 12px;
    color: var(--gray-400);
}

.dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.dot.on { background: var(--success); }
.dot.off { background: var(--gray-300); }

/* USDT 支付面板 */
.usdt-pay {
    text-align: center;
}

.usdt-amount {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.usdt-amount small {
    font-size: 14px;
    color: var(--gray-500);
    font-weight: 500;
    letter-spacing: 0;
}

.usdt-addr {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 11px 13px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 12.5px;
    color: var(--gray-700);
    word-break: break-all;
    margin: 12px 0;
    position: relative;
    text-align: left;
    padding-right: 60px;
}

.usdt-tip {
    font-size: 12.5px;
    color: var(--warning);
    background: var(--warning-light);
    border-radius: 8px;
    padding: 10px 13px;
    text-align: left;
    line-height: 1.65;
    margin-top: 14px;
}

.countdown {
    font-family: 'SF Mono', Consolas, monospace;
    font-weight: 600;
}

/* 顶部小提示 */
.env-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--warning);
    color: #fff;
    text-align: center;
    font-size: 12.5px;
    padding: 6px;
    z-index: 999;
    font-weight: 500;
}

/* ===== 两步验证绑定层（全站通用）===== */
.totp-layer {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(17, 24, 39, .55);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    animation: totpFade .18s ease;
}

@keyframes totpFade { from { opacity: 0; } to { opacity: 1; } }

.totp-layer-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
    padding: 26px 28px 22px;
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    text-align: center;
    animation: totpRise .22s cubic-bezier(.2, .8, .3, 1);
}

@keyframes totpRise {
    from { opacity: 0; transform: translateY(14px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

.totp-layer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.totp-layer-head h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: #111827;
    letter-spacing: -.01em;
}

.totp-layer-close {
    border: none;
    background: none;
    font-size: 24px;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
    padding: 0 2px;
    margin-left: auto;
    transition: color .15s;
}

.totp-layer-close:hover { color: #4b5563; }

.totp-layer-tip {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.75;
    margin: 0 0 16px;
    text-align: left;
}

.totp-layer .totp-steps {
    margin-bottom: 16px;
    font-size: 12.5px;
}

.totp-layer .totp-qr { margin: 0 0 14px; }

.totp-layer .totp-secret {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    max-width: 100%;
    font-size: 12px;
}

.totp-layer-err {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 12.5px;
    border-radius: 7px;
    padding: 9px 12px;
    margin-bottom: 12px;
    text-align: left;
}

.totp-layer-foot {
    font-size: 11.5px;
    color: #9ca3af;
    line-height: 1.7;
    margin: 14px 0 0;
    text-align: left;
}

@media (max-width: 480px) {
    .totp-layer-card { padding: 22px 18px 18px; }
    .totp-layer .totp-qr img { width: 170px; height: 170px; }
}
