/* ===== 全局重置与基础 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; background: #F5F5F5; color: #333; }
#app { max-width: 430px; margin: 0 auto; height: 100vh; min-height: 0; position: relative; background: #F5F5F5; overflow: hidden; display: flex; flex-direction: column; }
@supports (height: 100dvh) {
  #app { height: 100dvh; }
}

/* ===== 页面基础 ===== */
.page { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.page.hidden { display: none !important; }
.page-container { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }
.sub-page { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 100; background: #F5F5F5; }
.sub-page .page-container { padding-bottom: 32px; }

/* ===== 导航栏 ===== */
.nav-bar { height: 48px; background: #1B4F72; display: flex; align-items: center; justify-content: center; position: relative; flex-shrink: 0; }
.nav-title { color: #fff; font-size: 17px; font-weight: 600; }
.nav-back { position: absolute; left: 12px; color: #fff; font-size: 15px; cursor: pointer; display: flex; align-items: center; }

/* ===== Toast ===== */
.toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,0.75); color: #fff; padding: 12px 24px; border-radius: 8px; font-size: 14px; z-index: 9999; opacity: 0; pointer-events: none; transition: opacity 0.3s; white-space: nowrap; }
.toast.show { opacity: 1; }

/* ===== TabBar (5个Tab) ===== */
.tabbar { height: calc(56px + env(safe-area-inset-bottom)); min-height: 56px; padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid #E5E5E5; display: flex; align-items: flex-start; flex: 0 0 auto; z-index: 50; }
.tab-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; height: 56px; }
.tab-icon { font-size: 20px; line-height: 24px; }
.tab-icon-image { width: 22px; height: 22px; object-fit: contain; }
.tab-text { font-size: 10px; color: #999; margin-top: 2px; }
.tab-item.active .tab-text { color: #1B4F72; font-weight: 600; }

/* ===== 按钮 ===== */
.btn-primary { width: 100%; height: 46px; background: #1B4F72; color: #fff; border: none; border-radius: 8px; font-size: 16px; font-weight: 500; cursor: pointer; margin-top: 16px; }
.btn-primary:active { background: #154360; }
.btn-outline { background: transparent; color: #1B4F72; border: 1px solid #1B4F72; height: 36px; border-radius: 6px; font-size: 13px; padding: 0 16px; cursor: pointer; margin-top: 8px; }
.btn-outline:active { background: #EBF5FB; }
.btn-submit { margin: 20px 16px 32px; width: calc(100% - 32px); }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; color: #333; margin-bottom: 6px; font-weight: 500; }
.form-input { width: 100%; height: 44px; border: 1px solid #ddd; border-radius: 8px; padding: 0 12px; font-size: 15px; background: #fff; outline: none; -webkit-appearance: none; }
.form-input:focus { border-color: #2980B9; }
.form-textarea { width: 100%; border: 1px solid #ddd; border-radius: 8px; padding: 12px; font-size: 15px; background: #fff; outline: none; resize: none; -webkit-appearance: none; font-family: inherit; }
.form-textarea:focus { border-color: #2980B9; }

/* ===== 卡片通用 ===== */
.card { background: #fff; border-radius: 8px; padding: 16px; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

/* ===== 首页 ===== */
.logo-area { background: #1B4F72; padding: 32px 20px 24px; text-align: center; flex-shrink: 0; position: relative; }
.home-region { position: absolute; top: 14px; left: 16px; color: rgba(255,255,255,0.9); font-size: 13px; line-height: 20px; }
.logo-icon { font-size: 48px; line-height: 1; }
.logo-text { color: #fff; font-size: 24px; font-weight: bold; margin-top: 8px; }
.logo-sub { color: rgba(255,255,255,0.8); font-size: 14px; margin-top: 4px; }
.search-box { margin: -18px 16px 0; background: #fff; border-radius: 24px; height: 44px; display: flex; align-items: center; padding: 0 16px; box-shadow: 0 2px 12px rgba(0,0,0,0.1); position: relative; z-index: 2; cursor: pointer; }
.search-icon { font-size: 16px; color: #999; margin-right: 8px; }
.search-placeholder { color: #999; font-size: 14px; }
.home-content { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }
.entry-card { display: flex; align-items: center; padding: 16px; cursor: pointer; margin-bottom: 12px; }
.entry-icon { font-size: 32px; margin-right: 12px; flex-shrink: 0; }
.entry-icon-image { width: 32px; height: 32px; object-fit: contain; }
.entry-info { flex: 1; }
.entry-title { font-size: 16px; font-weight: 600; color: #1B4F72; }
.entry-desc { font-size: 13px; color: #888; margin-top: 2px; }
.entry-arrow { font-size: 24px; color: #ccc; margin-left: 8px; }
.entry-row { display: flex; gap: 12px; }
.entry-row .entry-card.half { flex: 1; flex-direction: column; align-items: flex-start; }
.entry-row .entry-card.half .entry-icon { margin-right: 0; margin-bottom: 8px; }
.stats-bar { display: flex; justify-content: space-around; background: #fff; border-radius: 8px; padding: 16px; margin: 16px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.stat-item { text-align: center; }
.stat-num { font-size: 22px; font-weight: bold; color: #1B4F72; }
.stat-label { font-size: 12px; color: #888; margin-top: 2px; }

/* ===== 搜索栏 ===== */
.search-bar { display: flex; align-items: center; padding: 10px 16px; background: #fff; border-bottom: 1px solid #eee; flex-shrink: 0; }
.search-input { flex: 1; height: 36px; background: #f5f5f5; border-radius: 18px; padding: 0 16px; border: none; font-size: 14px; outline: none; -webkit-appearance: none; }

/* ===== 分类筛选栏 ===== */
.filter-bar { display: flex; flex-wrap: wrap; overflow-x: hidden; gap: 8px; padding: 12px 16px; background: #fff; border-bottom: 1px solid #eee; flex-shrink: 0; }
.filter-tag { max-width: 100%; white-space: normal; overflow-wrap: anywhere; padding: 6px 16px; border-radius: 16px; font-size: 13px; background: #f5f5f5; color: #666; border: 1px solid #e0e0e0; cursor: pointer; }
.filter-tag.active { background: #1B4F72; color: #fff; border-color: #1B4F72; }
.category-filter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; }
.category-filter-grid .filter-tag { display: flex; align-items: center; justify-content: center; width: 100%; min-width: 0; box-sizing: border-box; padding: 6px 8px; text-align: center; }
.category-filter-grid .filter-tag.is-locked { color: #888; background: #fafafa; border-style: dashed; }
.category-filter-grid .filter-lock { margin-left: 3px; font-size: 11px; }

/* ===== 资源卡片 ===== */
.resource-card { background: #fff; border-radius: 8px; padding: 16px; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.resource-header { display: flex; align-items: center; margin-bottom: 10px; }
.resource-type { font-size: 16px; font-weight: bold; color: #1B4F72; }
.membership-current { border-left: 4px solid #1B4F72; }
.membership-card h3 { color: #1B4F72; margin-bottom: 8px; }
.membership-card .btn-outline { margin-top: 12px; }
.membership-owned { display: inline-block; margin-top: 10px; padding: 4px 10px; border-radius: 12px; background: #EBF5FB; color: #1B4F72; font-size: 12px; }
.resource-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.resource-tag { background: #EBF5FB; color: #1B4F72; padding: 2px 10px; border-radius: 12px; font-size: 12px; }
.resource-section { margin: 10px 0; }
.resource-section-title { font-size: 13px; color: #666; margin-bottom: 4px; font-weight: 500; }
.resource-matches { list-style: none; padding: 0; margin: 0; }
.resource-matches li { color: #555; font-size: 13px; margin-bottom: 4px; padding-left: 12px; position: relative; }
.resource-matches li::before { content: ''; position: absolute; left: 0; top: 7px; width: 5px; height: 5px; background: #2980B9; border-radius: 50%; }
.resource-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px solid #f0f0f0; }
.resource-suit { font-size: 12px; color: #888; }
.success-rate { font-size: 12px; padding: 2px 8px; border-radius: 4px; font-weight: 500; }
.rate-high { background: #E8F5E9; color: #27AE60; }
.rate-medium { background: #FFF3E0; color: #F39C12; }
.rate-low { background: #FFEBEE; color: #E74C3C; }

/* ===== 项目卡片 ===== */
.project-card { background: #fff; border-radius: 8px; padding: 16px; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.project-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.project-cat-tag { font-size: 12px; padding: 2px 8px; border-radius: 4px; font-weight: 500; }
.cat-scenario { background: #1B4F72; color: #fff; }
.cat-gov { background: #27AE60; color: #fff; }
.cat-policy { background: #F39C12; color: #fff; }
.cat-invest { background: #7B68EE; color: #fff; }
.project-status { font-size: 12px; padding: 2px 8px; border-radius: 4px; background: #f0f0f0; color: #666; }
.project-status.collecting { background: #E3F2FD; color: #1976D2; }
.project-status.ongoing { background: #E8F5E9; color: #388E3C; }
.project-status.recruiting { background: #F3E5F5; color: #7B1FA2; }
.project-title { font-size: 16px; font-weight: bold; color: #333; margin-bottom: 4px; line-height: 1.4; }
.project-publisher { font-size: 13px; color: #888; margin-bottom: 8px; }
.project-content { font-size: 14px; color: #666; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 10px; }
.project-deadline { font-size: 12px; color: #F39C12; margin-bottom: 10px; font-weight: 500; }
.project-actions { display: flex; gap: 8px; }
.project-actions .btn-outline { flex: 1; margin-top: 0; text-align: center; display: flex; align-items: center; justify-content: center; }

/* ===== AI聊天 ===== */
.ai-header-btn { position: absolute; top: 0; bottom: 0; width: 48px; border: 0; background: transparent; color: #fff; font-size: 24px; cursor: pointer; }
.ai-history-toggle { left: 0; }
.ai-new-chat { right: 0; }
.ai-conversation-drawer { position: fixed; inset: 0; z-index: 1200; display: flex; }
.ai-conversation-drawer.hidden { display: none; }
.ai-drawer-backdrop { position: absolute; inset: 0; border: 0; background: rgba(0, 0, 0, 0.35); }
.ai-drawer-panel { position: relative; width: min(340px, 86vw); height: 100%; padding: 18px 14px; background: #fff; box-shadow: 6px 0 24px rgba(0,0,0,.15); overflow-y: auto; }
.ai-drawer-header { display: flex; align-items: center; justify-content: space-between; color: #1B4F72; font-size: 18px; }
.ai-drawer-header button { border: 0; background: transparent; color: #666; font-size: 26px; }
.ai-drawer-new { width: 100%; margin: 16px 0 10px; padding: 11px; border: 1px solid #1B4F72; border-radius: 10px; background: #fff; color: #1B4F72; font-size: 14px; }
.ai-conversation-item { display: flex; align-items: center; gap: 8px; padding: 11px 10px; border-radius: 9px; color: #444; cursor: pointer; }
.ai-conversation-item.active { background: #EBF5FB; color: #1B4F72; }
.ai-conversation-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-conversation-delete { border: 0; background: transparent; color: #999; font-size: 17px; }
.ai-conversation-empty { padding: 28px 8px; color: #999; text-align: center; font-size: 13px; }
.chat-area { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; background: #f8f9fa; }
.chat-welcome { text-align: center; padding: 40px 20px; }
.welcome-icon { font-size: 48px; }
.welcome-icon-image { width: 48px; height: 48px; margin: 0 auto; object-fit: contain; }
.welcome-text { font-size: 18px; font-weight: 600; color: #1B4F72; margin-top: 12px; }
.welcome-sub { font-size: 14px; color: #888; margin-top: 6px; }
.chat-bubble { max-width: 80%; padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.6; margin-bottom: 12px; word-break: break-word; }
.chat-bubble.user { background: #1B4F72; color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.chat-bubble.ai { background: #fff; color: #333; margin-right: auto; border-bottom-left-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.chat-bubble .bubble-time { font-size: 11px; opacity: 0.6; margin-top: 4px; text-align: right; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px; background: #fff; border-top: 1px solid #eee; flex-shrink: 0; }
.quick-btn { background: #EBF5FB; color: #1B4F72; border: 1px solid #D6EAF8; border-radius: 16px; padding: 6px 12px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.quick-btn:active { background: #D6EAF8; }
.input-area { display: flex; padding: 10px 16px; background: #fff; border-top: 1px solid #eee; gap: 8px; flex-shrink: 0; }
.chat-input { flex: 1; height: 40px; border: 1px solid #ddd; border-radius: 20px; padding: 0 14px; font-size: 14px; outline: none; -webkit-appearance: none; }
.send-btn { height: 40px; padding: 0 18px; background: #1B4F72; color: #fff; border: none; border-radius: 20px; font-size: 14px; cursor: pointer; }
.send-btn:active { background: #154360; }
.ai-resource-btn { display: inline-block; margin-top: 8px; padding: 6px 12px; background: #EBF5FB; color: #1B4F72; border-radius: 6px; font-size: 12px; cursor: pointer; border: 1px solid #D6EAF8; }

/* ===== 我的页面 ===== */
.profile-header { background: #1B4F72; padding: 40px 20px 32px; text-align: center; flex-shrink: 0; }
.profile-avatar { font-size: 56px; line-height: 1; }
.profile-avatar-image { width: 56px; height: 56px; object-fit: contain; }
.profile-name { color: #fff; font-size: 18px; font-weight: 600; margin-top: 8px; }
.profile-role { color: rgba(255,255,255,0.7); font-size: 13px; margin-top: 4px; }
.menu-list { background: #fff; margin-top: 12px; }
.menu-item { display: flex; align-items: center; padding: 16px; border-bottom: 1px solid #f5f5f5; cursor: pointer; background: #fff; }
.menu-icon { font-size: 20px; margin-right: 12px; width: 24px; text-align: center; }
.menu-icon-image { width: 20px; height: 20px; object-fit: contain; }
.menu-text { flex: 1; font-size: 15px; color: #333; }
.menu-arrow { font-size: 18px; color: #ccc; }
.brand-click-area { text-align: center; padding: 40px 0; }
.brand-text { font-size: 14px; color: #ccc; display: inline-block; cursor: pointer; user-select: none; }
#page-profile { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.native-icon { display: inline; }
.mobile-icon { display: none; }

@media (max-width: 430px) {
  .native-icon { display: none; }
  .mobile-icon { display: block; }
  .tab-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; font-size: 0; }
  .profile-avatar { height: 56px; display: flex; align-items: center; justify-content: center; font-size: 0; }
  .menu-icon { height: 24px; display: flex; align-items: center; justify-content: center; font-size: 0; }
}

/* ===== 需求/对接卡片 ===== */
.demand-card { background: #fff; border-radius: 8px; padding: 16px; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.demand-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.demand-desc { font-size: 15px; color: #333; font-weight: 500; line-height: 1.4; }
.demand-info { font-size: 13px; color: #888; margin-top: 6px; }
.status-tag { font-size: 12px; padding: 2px 8px; border-radius: 4px; font-weight: 500; }
.status-pending { background: #FFF3E0; color: #F39C12; }
.status-matched { background: #E8F5E9; color: #27AE60; }
.status-none { background: #FFEBEE; color: #E74C3C; }
.status-processing { background: #E3F2FD; color: #1E88E5; }
.status-cancelled { background: #F5F5F5; color: #999999; }

/* ===== 管理后台 ===== */
.admin-stats { display: flex; justify-content: space-around; background: #fff; border-radius: 8px; padding: 16px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.admin-stat-item { text-align: center; }
.admin-stat-num { font-size: 24px; font-weight: bold; color: #1B4F72; }
.admin-stat-label { font-size: 12px; color: #888; margin-top: 2px; }
.admin-item { background: #fff; border-radius: 8px; padding: 16px; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.admin-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; cursor: pointer; }
.admin-item-title { font-size: 15px; font-weight: 600; color: #333; }
.admin-item-arrow { font-size: 16px; color: #999; transition: transform 0.2s; }
.admin-item-arrow.open { transform: rotate(90deg); }
.admin-detail { display: none; padding-top: 10px; border-top: 1px solid #f0f0f0; margin-top: 10px; }
.admin-detail.open { display: block; }
.admin-detail p { font-size: 14px; color: #666; margin-bottom: 6px; }
.admin-actions { display: flex; gap: 8px; margin-top: 12px; }
.admin-actions select { flex: 1; height: 36px; border: 1px solid #ddd; border-radius: 6px; padding: 0 8px; font-size: 14px; }

/* ===== 项目详情弹窗 ===== */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 200; display: flex; align-items: flex-end; }
.modal.hidden { display: none !important; }
.modal-content { background: #fff; width: 100%; max-height: 85vh; border-radius: 16px 16px 0 0; display: flex; flex-direction: column; animation: slideUp 0.3s ease; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #eee; flex-shrink: 0; }
.modal-title { font-size: 18px; font-weight: 600; color: #333; }
.modal-close { font-size: 20px; color: #999; cursor: pointer; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
.modal-body { flex: 1; overflow-y: auto; padding: 20px; }
.modal-body .modal-section { margin-bottom: 16px; }
.modal-body .modal-section-title { font-size: 14px; color: #888; margin-bottom: 4px; }
.modal-body .modal-section-content { font-size: 15px; color: #333; line-height: 1.6; }
.modal-footer { padding: 12px 20px 24px; border-top: 1px solid #eee; flex-shrink: 0; }
.modal-footer .btn-primary { margin-top: 0; }

/* ===== 关于我们 ===== */
.about-content { text-align: center; padding-top: 40px; }
.about-logo { font-size: 28px; font-weight: bold; color: #1B4F72; margin-bottom: 20px; }
.about-text { font-size: 15px; color: #666; line-height: 1.8; margin-bottom: 16px; padding: 0 20px; }
.about-version { font-size: 13px; color: #aaa; margin-top: 40px; }

/* ===== 服务说明 ===== */
.card h3 { font-size: 16px; color: #1B4F72; margin-bottom: 12px; }
.card p { font-size: 14px; color: #555; line-height: 1.8; margin-bottom: 4px; }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 60px 20px; color: #999; }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 14px; }

/* ===== 联系平台弹窗 ===== */
.contact-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 200; display: flex; align-items: center; justify-content: center; }
.contact-modal.hidden { display: none !important; }
.contact-content { background: #fff; border-radius: 12px; padding: 24px; width: 80%; max-width: 300px; text-align: center; }
.contact-content h3 { margin-bottom: 12px; color: #1B4F72; }
.contact-content p { font-size: 14px; color: #666; margin-bottom: 8px; }
.contact-close { margin-top: 16px; padding: 8px 24px; background: #1B4F72; color: #fff; border: none; border-radius: 6px; cursor: pointer; }
