:root {
    /* 主色 */
    --primary: #014DB2;
    --primary-light: #2563EB;
    --primary-dark: #003B8E;
    --primary-bg: #EBF1FA;
    
    /* 中性色 */
    --text: #0A1628;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --bg: #F9F9F9;
    --bg-white: #FFFFFF;
    --border: #EAEAEA;
    --border-light: #F3F4F6;
    
    /* 语义色 */
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
    
    /* 圆角 */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    
    /* 阴影 */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 4px 24px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
    
    /* 字体 */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    
    /* 布局 */
    --header-h: 64px;
}

/* ========== Reset ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
input, button, textarea, select { font-family: inherit; font-size: inherit; }

/* ========== 布局 ========== */
.app-layout { display: flex; flex-direction: column; min-height: 100vh; }
.app-header { height: var(--header-h); background: var(--bg-white); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; position: sticky; top: 0; z-index: 100; }
.app-header .logo { font-size: 20px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; }
.app-header .logo svg { width: 32px; height: 32px; }
.app-header .nav { display: flex; gap: 8px; margin-left: 48px; }
.app-header .nav a { padding: 8px 16px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 14px; font-weight: 500; transition: all 0.2s; }
.app-header .nav a:hover, .app-header .nav a.active { background: var(--primary-bg); color: var(--primary); text-decoration: none; }
.app-header .header-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.app-header .user-menu { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 6px 12px; border-radius: var(--radius-sm); }
.app-header .user-menu:hover { background: var(--border-light); }
.app-header .user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-bg); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }
.app-main { flex: 1; padding: 32px 24px; width: 100%; }

/* ========== 按钮 ========== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 24px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; border: 1px solid transparent; cursor: pointer; transition: all 0.2s; text-decoration: none; line-height: 1.5; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: var(--bg-white); color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-bg); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--border-light); }
.btn-lg { padding: 14px 32px; font-size: 16px; border-radius: var(--radius); }
.btn-sm { padding: 6px 16px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-input { width: 100%; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; color: var(--text); background: var(--bg); transition: border-color 0.2s; }
.form-input:focus { outline: none; border-color: var(--primary); background: var(--bg-white); }
.form-input::placeholder { color: var(--text-muted); }
.form-inline { display: flex; gap: 12px; }
.form-error { color: var(--danger); font-size: 13px; margin-top: 4px; display: none; }

/* ========== 卡片 ========== */
.card { background: var(--bg-white); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); }
.card-sm { padding: 16px; border-radius: var(--radius); }
.card-header { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.card-header h3 { margin: 0; font-size: 16px; }
.card-body { }
.card-grid { display: grid; gap: 20px; }
.card-grid-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card-grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card-grid-4 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* ========== Badge / 标签 ========== */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-info { background: var(--primary-bg); color: var(--primary); }
.badge-muted { background: var(--border-light); color: var(--text-secondary); }

/* ========== 进度条 ========== */
.progress { height: 8px; background: var(--border-light); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 4px; transition: width 0.3s; }
.progress-bar.primary { background: var(--primary); }
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }

/* ========== 弹窗 ========== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal { background: var(--bg-white); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); max-width: 90vw; max-height: 85vh; overflow-y: auto; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); font-size: 18px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; }

/* ========== Toast ========== */
.toast-container { position: fixed; top: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: var(--radius-sm); font-size: 14px; color: #fff; box-shadow: var(--shadow-lg); animation: toastIn 0.3s ease; max-width: 360px; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); color: var(--text); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ========== 加载 ========== */
.spinner { width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.6s linear infinite; }
.spinner-lg { width: 40px; height: 40px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px; gap: 16px; color: var(--text-secondary); }

/* ========== 工具类 ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 13px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.hidden { display: none !important; }

/* ========== 写标书页 ========== */
.write-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.write-plan { background: #fff; border-radius: 16px; padding: 32px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.write-progress { background: #F0F0F0; border-radius: 8px; height: 8px; overflow: hidden; }
.write-progress-bar { background: #014DB2; height: 100%; border-radius: 8px; transition: width .5s ease; }
.write-group-label { font-weight: 600; font-size: 14px; margin-bottom: 8px; padding: 4px 0; }
.write-chapter-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border: 1px solid #EAEAEA; border-radius: 10px; margin-bottom: 8px; background: #FAFAFA; transition: all .15s; }
.write-chapter-row:hover { border-color: #014DB2; background: #F0F7FF; }
.write-chapter-left { display: flex; align-items: center; gap: 10px; }
.write-chapter-title { font-weight: 500; font-size: 14px; }
.write-chapter-weight { font-size: 12px; color: #9CA3AF; }
.write-chapter-right { display: flex; align-items: center; gap: 10px; }
.write-chapter-status { font-size: 13px; }
.write-chapter-method { font-size: 11px; padding: 2px 8px; border-radius: 4px; }
.write-chapter-method.template { background: #ECFDF5; color: #10B981; }
.write-chapter-method.ai { background: #F0F7FF; color: #014DB2; }
.write-editor-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.write-editor-panel { background: #fff; border-radius: 16px; width: 94%; max-width: 1100px; height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.15); }
.write-editor-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-bottom: 1px solid #EAEAEA; background: #fff; }
.write-editor-toolbar h3 { margin: 0; font-size: 16px; font-weight: 600; }
.write-editor-toolbar-actions { display: flex; align-items: center; gap: 8px; }
.write-editor-footer { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid #EAEAEA; background: #FAFAFA; flex-shrink: 0; }
#editor-container { background: #fff; }
#editor-container .w-e-text-container { background: #fff; }
#editor-container .w-e-scroll { overflow-y: auto; }

/* ========== 查标书页 ========== */
.page-check { }
.check-start { text-align: center; padding: 40px 0; }
.check-preview-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 32px 0; }
.check-preview-card { background: #fff; border-radius: 16px; padding: 24px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.check-preview-icon { font-size: 32px; margin-bottom: 12px; }
.check-preview-title { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.check-preview-desc { font-size: 13px; color: #6B7280; }
.check-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.check-card { padding: 24px; margin-bottom: 20px; }
.check-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.check-card-header h3 { margin: 0; font-size: 17px; }
.check-card-icon { font-size: 24px; }
.check-rate-bar { text-align: center; padding: 16px; border-radius: 12px; margin: 16px 0; }

/* ========== 套餐购买页 ========== */
.pricing-header { text-align: center; padding: 40px 0 32px; }
.pricing-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.pricing-card { background: #fff; border-radius: 16px; padding: 28px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; cursor: pointer; transition: all .2s; border: 2px solid transparent; box-shadow: 0 1px 3px rgba(0,0,0,.06); position: relative; overflow: hidden; }
.pricing-card:hover { border-color: #014DB2; transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,77,178,.15); }
.pricing-card.highlight { border-color: #014DB2; border-top-width: 4px; }
.pricing-badge { position: absolute; top: 12px; right: 12px; background: #014DB2; color: #fff; font-size: 12px; padding: 2px 12px; border-radius: 12px; font-weight: 500; }
.pricing-card-icon { font-size: 36px; margin-bottom: 12px; }
.pricing-card-name { font-weight: 600; font-size: 15px; margin-bottom: 8px; }
.pricing-card-price { font-size: 32px; font-weight: 700; color: #014DB2; margin-bottom: 8px; }
.pricing-card-desc { font-size: 13px; color: #6B7280; margin-bottom: 16px; line-height: 1.6; flex: 1; }

/* ========== 资料库页 ========== */
.profile-page .tabs { display: flex; gap: 4px; border-bottom: 2px solid #EAEAEA; margin-bottom: 0; }
.tab-item { padding: 10px 20px; border: none; background: none; font-size: 14px; color: #6B7280; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; }
.tab-item.active { color: #014DB2; border-bottom-color: #014DB2; font-weight: 600; }
.tab-item:hover { color: #014DB2; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 24px; }
.form-grid .form-group { margin-bottom: 0; }
.form-grid .span-2 { grid-column: span 2; }

/* 资料库列表 */
.profile-list { display: flex; flex-direction: column; gap: 12px; }
.profile-list-item { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; background: var(--bg); border-radius: var(--radius); border: 1px solid var(--border); transition: all .15s; }
.profile-list-item:hover { border-color: var(--primary-light); background: var(--primary-bg); }
.profile-list-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.profile-list-title { font-weight: 600; font-size: 15px; color: var(--text); }
.profile-list-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--text-secondary); }
.profile-list-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* 空状态 */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.6; }
.empty-state-title { font-size: 16px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state-desc { font-size: 13px; color: var(--text-muted); }

/* ========== 粘贴文本区（读懂标书页） ========== */
.paste-section { margin-top: 20px; transition: all 0.3s ease; }
.paste-divider { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 12px; }
.paste-divider span { background: var(--bg-white); padding: 0 16px; }
.paste-hint { font-size: 13px; color: var(--text-secondary); text-align: center; margin-bottom: 12px; line-height: 1.5; }
.paste-textarea { min-height: 180px; font-family: 'SF Mono', 'Consolas', 'Menlo', monospace; font-size: 13px; line-height: 1.7; resize: vertical; transition: all 0.3s ease; }
.paste-section-active .paste-textarea { min-height: 280px; border-color: var(--primary-light); border-width: 2px; box-shadow: 0 0 0 3px var(--primary-bg); }
.paste-section-active .paste-divider span { color: var(--primary); font-weight: 600; }
.paste-section-active .paste-hint { color: var(--primary); font-weight: 500; }

/* ========== 提取失败提示 ========== */
.extract-failed-notice { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; background: #FEF3C7; border: 1px solid #F59E0B; border-radius: var(--radius); color: #92400E; font-size: 14px; line-height: 1.5; }
.extract-failed-icon { font-size: 24px; flex-shrink: 0; line-height: 1.3; }

.list-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid #F0F0F0; }
.list-item:last-child { border-bottom: none; }
.list-item-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.list-item-actions { display: flex; gap: 8px; flex-shrink: 0; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-box { background: #fff; border-radius: 16px; padding: 24px; width: 90%; max-width: 500px; max-height: 85vh; overflow-y: auto; }
.modal-box h3 { margin: 0 0 16px; }

/* ========== 运营后台 ========== */
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.admin-header h2 { margin: 0; }
.admin-tabs { display: flex; gap: 4px; border-bottom: 2px solid #EAEAEA; }
.admin-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.admin-stat-card { background: #fff; border-radius: 12px; padding: 20px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.admin-stat-value { font-size: 28px; font-weight: 700; color: #014DB2; }
.admin-stat-label { font-size: 13px; color: #6B7280; margin-top: 4px; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 12px 16px; background: #FAFAFA; font-weight: 600; color: #6B7280; font-size: 13px; border-bottom: 1px solid #EAEAEA; }
.table td { padding: 12px 16px; border-bottom: 1px solid #F0F0F0; }
.table tr:last-child td { border-bottom: none; }
.text-error { color: #DC2626; }
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; }
.alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FCD34D; }
.alert-info { background: #F0F7FF; color: #1E40AF; border: 1px solid #93C5FD; }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .app-main { padding: 16px; }
    .app-header { padding: 0 16px; }
    .app-header .nav { display: none; }
    .card-grid-2, .card-grid-3, .card-grid-4 { grid-template-columns: 1fr; }
    .form-inline { flex-direction: column; }
    .pricing-cards { grid-template-columns: 1fr 1fr; }
    .check-preview-cards { grid-template-columns: 1fr; }
    .admin-stat-grid { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: span 1; }
    .write-editor-panel { width: 100%; height: 100vh; border-radius: 0; max-width: none; }
}

@media (max-width: 480px) {
    .pricing-cards { grid-template-columns: 1fr; }
    .admin-stat-grid { grid-template-columns: 1fr; }
}

/* ========== 项目进度步骤条 ========== */
.project-steps {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 12px 0;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    transition: all 0.2s;
}

.step-dot.step-done {
    background: #10B981;
    color: #fff;
}

.step-dot.step-current {
    background: var(--primary, #014DB2);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(1, 77, 178, 0.2);
    animation: stepPulse 2s infinite;
}

.step-dot.step-pending {
    background: #E5E7EB;
    color: #9CA3AF;
}

.step-label {
    font-size: 11px;
    color: #6B7280;
    white-space: nowrap;
    text-align: center;
}

.step-line {
    flex: 1 0 16px;
    height: 2px;
    background: #E5E7EB;
    margin: 0 2px;
    margin-bottom: 20px;
}

@keyframes stepPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(1, 77, 178, 0.2); }
    50% { box-shadow: 0 0 0 6px rgba(1, 77, 178, 0.1); }
}

/* ========== 项目卡片 ========== */
.project-card {
    transition: transform 0.15s, box-shadow 0.15s;
}

.project-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.project-actions {
    display: flex;
    gap: 4px;
    opacity: 0.4;
    transition: opacity 0.15s;
}

.project-card:hover .project-actions {
    opacity: 1;
}

/* ========== 已有文件列表 ========== */
.file-item {
    transition: background 0.15s;
}

.file-item:hover {
    background: var(--primary-bg, #f0f5ff) !important;
}

.project-list .card {
    margin-bottom: 12px;
}
