/* ==========================================================================
   客户门户 (borrower_portal / investor_portal) 共用样式
   设计目标: 亮色 / 卡片化 / 营销感 / 跟 Unfold admin 风格完全脱钩
   配色: 浅灰背景 + 白色卡片 + 主品牌蓝 (#3f59c5)
   ========================================================================== */

/* --- 基础 reset --- */
* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    background: #f5f7fa;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: #3f59c5; text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- 顶部 header --- */
.portal-header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 50;
}
.portal-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 32px;
}
.portal-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}
.portal-logo {
    background: linear-gradient(135deg, #3f59c5, #1e3a8a);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}
.portal-product { color: #1f2937; font-size: 15px; }
.portal-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}
.nav-link {
    color: #6b7280;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
}
.nav-link:hover { background: #f3f4f6; color: #1f2937; text-decoration: none; }
.nav-link.active { background: #eff3ff; color: #3f59c5; }
.portal-user {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #6b7280;
    font-size: 13px;
}
.logout-btn {
    color: #6b7280;
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 12px;
}
.logout-btn:hover { color: #1f2937; border-color: #9ca3af; text-decoration: none; }

/* --- 主体内容 --- */
.portal-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 80px;
    min-height: calc(100vh - 60px - 80px);
}

/* --- 页面 header --- */
.page-header { margin-bottom: 28px; }
.page-header h1 {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
}
.page-sub {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}
.back-link {
    color: #6b7280;
    font-size: 13px;
    margin-bottom: 12px;
    display: inline-block;
}

/* --- 概览卡片网格 (3 列) --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}
@media (max-width: 720px) {
    .card-grid { grid-template-columns: 1fr; }
}
.stat-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px 24px;
    transition: all 0.15s;
    color: inherit;
    text-decoration: none;
    display: block;
}
.stat-card:hover {
    border-color: #3f59c5;
    box-shadow: 0 4px 12px rgba(63, 89, 197, 0.08);
    text-decoration: none;
}
.stat-label {
    color: #6b7280;
    font-size: 13px;
    margin-bottom: 8px;
}
.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.1;
}
.stat-hint {
    color: #9ca3af;
    font-size: 12px;
    margin-top: 6px;
}

/* --- 区块 / 列表 --- */
.card-section {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 24px;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.section-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}
.section-link {
    color: #3f59c5;
    font-size: 13px;
}

.project-list, .match-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.project-row, .match-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafbfc;
    transition: all 0.15s;
    color: inherit;
    text-decoration: none;
}
.project-row:hover, .match-row:hover {
    background: #eff3ff;
    border-color: #3f59c5;
    text-decoration: none;
}
.project-title, .match-title {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
}
.project-meta, .match-meta {
    display: flex;
    gap: 8px;
}

/* --- 表格 --- */
.table-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    background: #f9fafb;
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
}
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfc; }
.data-table .num { font-variant-numeric: tabular-nums; text-align: right; }
.data-table .muted { color: #9ca3af; }
.link { color: #3f59c5; font-weight: 500; }
.btn-link {
    color: #3f59c5;
    font-size: 13px;
    padding: 4px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}
.btn-link:hover { border-color: #3f59c5; text-decoration: none; }

/* --- 徽章 --- */
.badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 12px;
    border-radius: 4px;
    font-weight: 500;
}
.badge-soft { background: #e0e7ff; color: #3f59c5; }
.badge-status { background: #f3f4f6; color: #4b5563; }
.badge-ok { background: #d1fae5; color: #065f46; }
.badge-warn { background: #fef3c7; color: #92400e; }

/* --- 详情页 --- */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}
@media (max-width: 720px) {
    .detail-grid { grid-template-columns: 1fr; }
}
.detail-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 16px;
}
.detail-card h3 {
    margin: 0 0 16px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.detail-list {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 12px 16px;
    margin: 0;
}
.detail-list dt { color: #6b7280; font-size: 13px; }
.detail-list dd { margin: 0; color: #1f2937; font-size: 14px; }

/* --- 状态显示 --- */
.status-display {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
}
.status-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #3f59c5;
    box-shadow: 0 0 0 4px rgba(63, 89, 197, 0.15);
}
.status-text {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.use-of-funds {
    line-height: 1.7;
    color: #4b5563;
    white-space: pre-wrap;
}
.small { font-size: 12px; }

/* --- 空状态 --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}
.empty-state p { margin: 4px 0; }
.empty-hint { font-size: 12px; color: #9ca3af; }

/* --- 消息提示 --- */
.portal-messages { margin-bottom: 20px; }
.msg {
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 13px;
}
.msg-success { background: #d1fae5; color: #065f46; }
.msg-error { background: #fee2e2; color: #991b1b; }
.msg-warning { background: #fef3c7; color: #92400e; }

/* --- footer --- */
.portal-footer {
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 24px;
    margin-top: 60px;
}
.portal-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    color: #9ca3af;
    font-size: 12px;
}
.footer-hint { color: #6b7280; }
