/* ===== 全局样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --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;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    color: var(--gray-800);
    background: var(--gray-100);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== 页面容器 ===== */
.page {
    min-height: 100vh;
    padding-bottom: 70px;
    animation: fadeIn 0.3s ease;
}

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

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

/* ===== 顶部导航栏 ===== */
.header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    margin: 0;
    padding: 0;
}

.header-back {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    text-decoration: none;
}
.header-logout {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
}

/* ===== 底部导航 ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
    z-index: 100;
    border-top: 1px solid var(--gray-200);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--gray-400);
    font-size: 11px;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--primary);
}

.nav-icon {
    font-size: 22px;
    margin-bottom: 2px;
}

/* ===== 卡片 ===== */
.card {
    background: white;
    border-radius: 12px;
    margin: 12px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--gray-800);
}

/* ===== 余额卡片 ===== */
.balance-card {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white;
    border-radius: 16px;
    margin: 12px;
    padding: 24px 20px;
    position: relative;
    overflow: hidden;
}

.balance-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.balance-amount {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.balance-unit {
    font-size: 16px;
    font-weight: 400;
}

/* ===== 快捷入口 ===== */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 8px;
    padding: 12px 8px;
}

.quick-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--gray-700);
}

.quick-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 8px;
    background: var(--gray-100);
}

.quick-icon.blue { background: #dbeafe; }
.quick-icon.green { background: #d1fae5; }
.quick-icon.orange { background: #fef3c7; }
.quick-icon.red { background: #fee2e2; }
.quick-icon.purple { background: #ede9fe; }
.quick-icon.cyan { background: #cffafe; }
.quick-icon.indigo { background: #e0e7ff; }
.quick-icon.pink { background: #fce7f3; }
.quick-icon.gray { background: #f3f4f6; }
.quick-icon.ai { background: #f5d0fe; }

.quick-text {
    font-size: 12px;
    color: var(--gray-600);
    white-space: nowrap;
}

/* ===== 表单 ===== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 15px;
    background: white;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

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

/* ===== 验证码行 ===== */
.code-input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.code-input-row .form-input {
  flex: 1;
  min-width: 0;
}

.code-input-row .btn {
  width: auto;
  flex-shrink: 0;
  padding: 12px 16px;
  font-size: 14px;
  white-space: nowrap;
}

/* ===== 按钮 ===== */
.btn {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-appearance: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: white;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
    display: inline-block;
    width: auto;
}

/* ===== 列表 ===== */
.list {
    background: white;
    border-radius: 12px;
    margin: 12px;
    overflow: hidden;
}

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

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

.list-left {
    flex: 1;
}

.list-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.list-subtitle {
    font-size: 13px;
    color: var(--gray-400);
}

.list-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== 状态标签 ===== */
.tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.tag-success {
    background: #d1fae5;
    color: #065f46;
}

.tag-warning {
    background: #fef3c7;
    color: #92400e;
}

.tag-danger {
    background: #fee2e2;
    color: #991b1b;
}

.tag-info {
    background: #dbeafe;
    color: #1e40af;
}

.tag-gray {
    background: var(--gray-100);
    color: var(--gray-500);
}

/* ===== 步骤条 ===== */
.steps {
    display: flex;
    justify-content: space-between;
    padding: 20px 16px;
    position: relative;
}

.steps::before {
    content: '';
    position: absolute;
    top: 32px;
    left: 40px;
    right: 40px;
    height: 2px;
    background: var(--gray-200);
    z-index: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gray-300);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.step.active .step-dot {
    background: var(--primary);
}

.step.completed .step-dot {
    background: var(--success);
}

.step-label {
    font-size: 12px;
    color: var(--gray-400);
}

.step.active .step-label {
    color: var(--primary);
    font-weight: 500;
}

/* ===== 二维码容器 ===== */
.qrcode-container {
    text-align: center;
    padding: 24px;
}

.qrcode-image {
    width: 200px;
    height: 200px;
    margin: 0 auto 16px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
}

.qrcode-image img {
    max-width: 100%;
    max-height: 100%;
}

.qrcode-tip {
    font-size: 13px;
    color: var(--gray-500);
    line-height: 1.6;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-text {
    font-size: 15px;
    color: var(--gray-400);
    margin-bottom: 20px;
}

/* ===== 提示信息 ===== */
.tip-box {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px;
    font-size: 13px;
    color: #92400e;
    line-height: 1.5;
}

/* ===== 加载中 ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.75);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

/* ===== 图片上传 ===== */
.upload-box {
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.upload-box:active {
    border-color: var(--primary);
}

.upload-icon {
    font-size: 32px;
    color: var(--gray-400);
    margin-bottom: 8px;
}

.upload-text {
    font-size: 13px;
    color: var(--gray-400);
}

/* ===== 金额输入 ===== */
.amount-input {
    font-size: 32px;
    font-weight: 600;
    text-align: center;
    border: none;
    border-bottom: 2px solid var(--gray-300);
    padding: 8px;
    width: 100%;
    outline: none;
}

.amount-input:focus {
    border-color: var(--primary);
}

/* ===== 登录页 ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(180deg, #dbeafe 0%, #eff6ff 40%, white 100%);
}

.login-logo {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo-icon {
    display: block;
    width: 120px;
    height: auto;
    margin: 0 auto 12px;
}

.login-logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-800);
}

.login-logo-sub {
    font-size: 14px;
    color: var(--gray-400);
    margin-top: 4px;
}

/* ===== 入口页身份选择 ===== */
.auth-entry-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.auth-entry-title {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 24px;
    color: var(--gray-800);
}

.user-type-selector {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.user-type-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 12px;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.user-type-option.active {
    border-color: var(--primary);
    background: #eff6ff;
}

.user-type-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.user-type-label {
    font-size: 15px;
    font-weight: 500;
    color: var(--gray-700);
}

.user-type-option.active .user-type-label {
    color: var(--primary);
}

.auth-entry-agreement {
    text-align: center;
    margin-bottom: 24px;
    font-size: 13px;
}

.auth-entry-agreement a {
    color: var(--primary);
    text-decoration: underline;
}

.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.login-tabs {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--gray-200);
}

.login-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 15px;
    color: var(--gray-400);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.login-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 500;
}

.login-tab.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: var(--gray-400);
}

/* ===== 响应式 ===== */
@media (min-width: 768px) {
    #app {
        max-width: 430px;
        margin: 0 auto;
        box-shadow: 0 0 20px rgba(0,0,0,0.1);
        min-height: 100vh;
        background: var(--gray-100);
    }

    .bottom-nav {
        max-width: 430px;
        margin: 0 auto;
        left: 50%;
        transform: translateX(-50%);
    }

    .loading-overlay {
        max-width: 430px;
        margin: 0 auto;
        left: 0;
        right: 0;
    }
}


/* ===== 登录页授权条款弹窗 ===== */
.auth-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.auth-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 360px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.auth-modal-header {
    padding: 16px;
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}
.auth-modal-body {
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 14px;
    line-height: 1.7;
    color: #333;
    flex: 1;
}
.auth-modal-body p { margin-bottom: 12px; text-align: justify; }
.auth-modal-footer {
    padding: 12px 16px 16px;
    border-top: 1px solid #f0f0f0;
}
.auth-modal-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
    margin-bottom: 12px;
}
.auth-modal-check input {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: #07c160;
}
.auth-modal-check input:disabled + span { color: #999; }
.auth-modal-check input:checked + span { color: #07c160; }

.auth-modal-check, .auth-modal-check input { cursor: pointer; }

/* 授权弹窗勾选框最终样式（居中、无蓝色闪现、滚动自动勾选） */
.auth-modal-check {
    color: #ff6b6b;
    -webkit-tap-highlight-color: transparent;
}
.auth-modal-check input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #ff6b6b;
    border-radius: 4px;
    background: #fff;
    flex-shrink: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}
.auth-modal-check input:focus {
    outline: none;
    box-shadow: none;
}
.auth-modal-check input:checked {
    background: #ff6b6b url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23ffffff%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolyline%20points%3D%2220%206%209%2017%204%2012%22%2F%3E%3C%2Fsvg%3E") center center / 12px no-repeat;
    border-color: #ff6b6b;
}
.auth-modal-check, .auth-modal-check input { cursor: pointer; }


/* 条款文字样式：特别提示居中放大，段落首行缩进 */
.auth-modal-body p {
    text-indent: 2em;
}
.auth-modal-body p:first-child {
    text-indent: 0;
    text-align: center;
    margin-bottom: 16px;
}
.auth-modal-body p:first-child strong {
    font-size: 20px;
    font-weight: 600;
}

.auth-modal-body p.no-indent { text-indent: 0; }
