/* ===== 基础样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "PingFang SC", sans-serif;
    background: #f5f6fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== 顶部导航 ===== */
.header {
    background: linear-gradient(135deg, #1a3a5c 0%, #2d6a9f 100%);
    color: #fff;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo {
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.header h1 { font-size: 16px; font-weight: 600; }

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-user {
    display: none;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.15);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.2s;
}

.header-user:hover { background: rgba(255,255,255,0.25); }

.header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    background: rgba(255,255,255,0.15);
    padding: 4px 10px;
    border-radius: 12px;
}

.status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.ok { background: #52c41a; box-shadow: 0 0 4px #52c41a; }
.status-dot.warn { background: #faad14; box-shadow: 0 0 4px #faad14; }
.status-dot.error { background: #ff4d4f; box-shadow: 0 0 4px #ff4d4f; }

/* ===== 主体容器 ===== */
.container {
    padding: 20px 16px;
    max-width: 600px;
    margin: 0 auto;
}

@media (min-width: 768px) { .container { max-width: 900px; padding: 24px 20px; } }

/* ===== 步骤指示器 ===== */
.step-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 0 4px;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.step-circle {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    background: #e8e8e8;
    color: #999;
    border: 2px solid #e8e8e8;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.step-circle.active {
    background: #2d6a9f;
    color: #fff;
    border-color: #2d6a9f;
    box-shadow: 0 0 0 3px rgba(45,106,159,0.2);
}

.step-circle.done {
    background: #52c41a;
    color: #fff;
    border-color: #52c41a;
}

.step-label {
    font-size: 10px;
    color: #999;
    text-align: center;
    white-space: nowrap;
    transition: color 0.3s;
}

.step-label.active { color: #2d6a9f; font-weight: 600; }
.step-label.done { color: #52c41a; }

.step-line {
    flex: 1;
    height: 2px;
    background: #e8e8e8;
    margin: 0 4px;
    margin-bottom: 20px;
    transition: background 0.3s;
}

.step-line.done { background: #52c41a; }

/* ===== 步骤页面 ===== */
.step-page { display: none; }

.step-page.active {
    display: block;
    animation: fadeIn 0.35s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1a3a5c;
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-subtitle {
    font-size: 13px;
    color: #888;
    margin-bottom: 16px;
    margin-top: -12px;
}

/* ===== 卡片 ===== */
.card {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}

.card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #1a3a5c;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== 贷款类型选择 ===== */
.loan-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.loan-type-card {
    background: #fff;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.loan-type-card:hover {
    border-color: #2d6a9f;
    box-shadow: 0 2px 12px rgba(45,106,159,0.12);
    transform: translateY(-1px);
}

.loan-type-card.selected {
    border-color: #2d6a9f;
    background: #e6f0fa;
}

.loan-type-card .icon { font-size: 28px; margin-bottom: 8px; }
.loan-type-card .name { font-size: 16px; font-weight: 600; color: #1a3a5c; }
.loan-type-card .desc { font-size: 12px; color: #666; margin-top: 4px; line-height: 1.4; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 4px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
    background: #fff;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #2d6a9f;
    box-shadow: 0 0 0 3px rgba(45,106,159,0.1);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (min-width: 768px) {
    .form-row { grid-template-columns: 1fr 1fr 1fr; }
}

/* ===== 按钮 ===== */
.btn {
    display: block;
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 100px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: #2d6a9f;
    color: #fff;
}

.btn-primary:hover {
    background: #1a3a5c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45,106,159,0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-success {
    background: #52c41a;
    color: #fff;
}

.btn-success:hover {
    background: #389e0d;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(82,196,26,0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid #2d6a9f;
    color: #2d6a9f;
}

.btn-outline:hover {
    background: #e6f0fa;
    transform: translateY(-1px);
}

.nav-bar { display: none; margin-top: 20px; }

/* ===== 搜索区域 ===== */
.search-area {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.search-area input {
    flex: 1;
    padding: 10px 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.25s;
}

.search-area input:focus { border-color: #2d6a9f; }

.search-btn {
    background: #2d6a9f;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.25s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    background: #1a3a5c;
    box-shadow: 0 2px 8px rgba(45,106,159,0.3);
}

/* ===== 补充尽调 ===== */
.q-item {
    border: 1.5px solid #e8e8e8;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.q-item:hover { border-color: #d0d0d0; }

.q-item.uploaded {
    border-color: #b7eb8f;
    background: #f6ffed;
}

.q-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.q-item-header .label { font-size: 13px; font-weight: 600; color: #333; }

.upload-btn {
    background: #f5f5f5;
    border: 1px dashed #ccc;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-btn:hover {
    border-color: #2d6a9f;
    color: #2d6a9f;
    background: #e6f0fa;
}

.upload-status { font-size: 12px; color: #999; display: none; }

.upload-badge {
    display: inline-block;
    background: #f6ffed;
    color: #52c41a;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    border: 1px solid #b7eb8f;
    font-weight: 600;
}

/* ===== Toast 提示 ===== */
.toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
    align-items: center;
    gap: 8px;
    max-width: 90%;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.toast.show { display: flex; }

/* ===== 加载状态 ===== */
.loading-overlay {
    display: none;
    text-align: center;
    padding: 20px;
}

.loading-overlay.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
}

.spinner {
    width: 28px; height: 28px;
    border: 3px solid #e8e8e8;
    border-top-color: #2d6a9f;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
    font-size: 13px;
    color: #666;
    margin-top: 10px;
}

/* ===== 报告区域 ===== */
#reportEditor {
    width: 100%;
    min-height: 300px;
    padding: 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.7;
    resize: vertical;
    font-family: inherit;
    outline: none;
    transition: border-color 0.25s;
}

#reportEditor:focus {
    border-color: #2d6a9f;
    box-shadow: 0 0 0 3px rgba(45,106,159,0.1);
}

/* ===== 弹窗/覆盖层 ===== */
.overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.overlay.active { display: flex; }

.overlay-content {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

/* ===== 移动端适配 ===== */
@media (max-width: 480px) {
    body { font-size: 14px; }
    .header { padding: 12px; }
    .header h1 { font-size: 14px; }
    .header-status { font-size: 10px; padding: 3px 8px; }
    .header-logo { width: 32px; height: 32px; font-size: 16px; }
    .container { padding: 12px; }
    .page-title { font-size: 16px; margin-bottom: 12px; }
    .card { padding: 12px; border-radius: 6px; margin-bottom: 12px; }
    .card-title { font-size: 14px; }
    .loan-type-card { padding: 12px; }
    .loan-type-card .name { font-size: 15px; }
    .step-circle { width: 30px; height: 30px; font-size: 12px; }
    .step-label { font-size: 9px; }
    .form-group label { font-size: 12px; }
    .form-group input, .form-group textarea, .form-group select {
        padding: 8px 10px; font-size: 15px;
    }
    .form-row { grid-template-columns: 1fr; gap: 8px; }
    .search-area { flex-direction: column; gap: 8px; }
    .search-btn { width: 100%; }
    .btn { padding: 10px; font-size: 14px; }
    .q-item { padding: 10px; }
    .toast { 
        top: auto; bottom: 16px; left: 16px; right: 16px; 
        transform: none; max-width: 100%; font-size: 13px;
        border-radius: 10px;
    }
    .loan-grid { gap: 8px; }
    .overlay-content { padding: 16px; }
}

@media (min-width: 1200px) {
    .container { max-width: 1000px; }
}

/* ===== 安全区域适配 ===== */
@supports (padding: env(safe-area-inset-top)) {
    .header { 
        padding-left: calc(16px + env(safe-area-inset-left));
        padding-right: calc(16px + env(safe-area-inset-right));
        padding-top: calc(14px + env(safe-area-inset-top));
    }
    .container {
        padding-left: calc(16px + env(safe-area-inset-left));
        padding-right: calc(16px + env(safe-area-inset-right));
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
}


/* ===== 用户面板美化 ===== */
.user-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.user-panel-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2d6a9f, #1a3a5c);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
}

.user-panel-name {
    font-size: 16px;
    font-weight: 600;
    color: #1a3a5c;
}

.user-panel-sub {
    font-size: 12px;
    color: #999;
}

.user-panel-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.user-panel-stat-card {
    background: #f8f9fb;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.user-panel-stat-card .number {
    font-size: 22px;
    font-weight: 700;
    color: #2d6a9f;
}

.user-panel-stat-card .label {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

.plan-card {
    text-align: center;
    padding: 16px 12px;
    cursor: pointer;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    transition: all 0.25s ease;
}

.plan-card:hover {
    border-color: #2d6a9f;
    box-shadow: 0 2px 12px rgba(45,106,159,0.12);
    transform: translateY(-1px);
}

.plan-card .icon { font-size: 24px; margin-bottom: 6px; }
.plan-card .plan-name { font-size: 15px; font-weight: 600; color: #1a3a5c; }
.plan-card .price { font-size: 20px; font-weight: 700; color: #2d6a9f; margin: 4px 0; }
.plan-card .desc { font-size: 12px; color: #888; }
.plan-card .badge {
    position: absolute; top: -6px; right: 8px;
    background: #ff4d4f; color: #fff;
    font-size: 10px; padding: 2px 8px;
    border-radius: 8px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.history-item:last-child { border-bottom: none; }
.history-item .name { color: #333; }
.history-item .date { color: #999; font-size: 11px; }

/* ===== 报告预览区美化 ===== */
.report-toolbar {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.report-toolbar .btn { flex: 1; }

.editor-hint {
    font-size: 11px;
    color: #aaa;
    text-align: right;
    margin-top: 6px;
}

/* ===== 文件上传区域美化 ===== */
.upload-zone {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1.5px dashed #d0d0d0;
    border-radius: 8px;
    background: #fafafa;
    transition: all 0.2s;
}

.upload-zone:hover {
    border-color: #2d6a9f;
    background: #f0f6ff;
}

.upload-zone.has-files {
    border-style: solid;
    border-color: #b7eb8f;
    background: #f6ffed;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #333;
    padding: 4px 8px;
    background: #f5f5f5;
    border-radius: 4px;
    margin-top: 6px;
}

.file-item .file-icon { color: #2d6a9f; font-size: 14px; }
.file-item .file-name { flex: 1; }
.file-item .file-status { color: #52c41a; font-size: 11px; }

/* ===== 空状态和错误状态 ===== */
.empty-state {
    text-align: center;
    padding: 30px 20px;
    color: #bbb;
}

.empty-state .icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state .text {
    font-size: 14px;
    color: #999;
    margin-bottom: 8px;
}

.empty-state .sub-text {
    font-size: 12px;
    color: #ccc;
}

.error-state {
    text-align: center;
    padding: 20px;
    color: #ff4d4f;
    background: #fff2f0;
    border-radius: 8px;
    font-size: 13px;
}
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 6px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
    background: #fff;
}
.form-control:focus {
    border-color: #2d6a9f;
    box-shadow: 0 0 0 3px rgba(45,106,159,0.1);
}

.header-right {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}
.header-user-btn {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px 8px;
    border-radius: 12px;
    background: rgba(255,255,255,0.15);
    font-size: 14px;
    transition: background 0.2s;
}
.header-user-btn:hover {
    background: rgba(255,255,255,0.25);
}
.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    z-index: 200;
    padding: 8px 0;
    margin-top: 6px;
}
.dropdown-item {
    padding: 10px 16px;
    font-size: 13px;
    color: #333;
}
.dropdown-item.clickable {
    cursor: pointer;
    transition: background 0.15s;
}
.dropdown-item.clickable:hover {
    background: #f5f5f5;
}
.dropdown-divider {
    height: 1px;
    background: #eee;
    margin: 4px 0;
}
.credit-num {
    color: #52c41a;
    font-weight: 600;
}

/* Report history page */
.report-item {
    padding: 12px 16px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: border-color 0.2s;
}
.report-item:hover {
    border-color: #1890ff;
    background: #fafafa;
}
.report-item-title {
    font-weight: 600;
    font-size: 14px;
    color: #1a3a5c;
    margin-bottom: 4px;
}
.report-item-meta {
    font-size: 12px;
    color: #999;
}
.report-item-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}
.report-item-actions button {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid #1890ff;
    background: #fff;
    color: #1890ff;
    cursor: pointer;
    transition: all 0.2s;
}
.report-item-actions button:hover {
    background: #e6f7ff;
}
.empty-state {
    text-align: center;
    color: #999;
    padding: 60px 20px;
    font-size: 14px;
}
