* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* 主色调 - 深蓝金融 */
    --primary: #1a56db;
    --primary-dark: #1e3a8a;
    --primary-light: #dbeafe;
    --primary-gradient: linear-gradient(135deg, #1a56db 0%, #3b82f6 50%, #60a5fa 100%);
    --primary-gradient-dark: linear-gradient(135deg, #1e3a8a 0%, #1a56db 100%);

    /* 背景 */
    --bg: #f0f2f5;
    --bg-gradient: linear-gradient(180deg, #f0f2f5 0%, #e8edf2 100%);
    --card: #ffffff;
    --card-hover: #fafbff;

    /* 文字 */
    --text: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;

    /* 边框 */
    --border: #e5e7eb;
    --border-light: #f3f4f6;

    /* 状态色 */
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --accent: #c83232;

    /* 圆角和阴影 */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.08), 0 4px 10px -3px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 40px -10px rgba(0,0,0,0.12), 0 8px 20px -6px rgba(0,0,0,0.06);
    --shadow-glow: 0 0 30px rgba(26,86,219,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-gradient);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.4s ease; }

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

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

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

/* ====== 登录页 ====== */
.login-container {
    max-width: 440px;
    margin: 0 auto;
    padding: 48px 24px 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.login-header {
    text-align: center;
    margin-bottom: 40px;
    animation: slideUp 0.6s ease;
}
.logo-icon {
    width: 72px; height: 72px;
    background: var(--primary-gradient);
    color: white;
    font-size: 32px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    border-radius: 20px;
    margin: 0 auto 20px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}
.login-header h1 {
    font-size: 24px; font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 6px;
}
.login-form {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.6s ease 0.1s both;
}
.input-group { margin-bottom: 20px; }
.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}
.input-group input, .input-group textarea, .input-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
    background: var(--card);
}
.input-group input:focus, .input-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}
.code-row { display: flex; gap: 10px; }
.code-row input { flex: 1; }
.btn-code {
    padding: 12px 18px;
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.btn-code:hover:not(:disabled) {
    background: var(--primary);
    color: white;
}
.btn-code:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px; font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow-md);
    letter-spacing: 0.5px;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}
.btn-primary:active {
    transform: translateY(0);
}
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ====== 顶栏 ====== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar-title {
    font-size: 18px;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.topbar-nav { display: flex; gap: 6px; align-items: center; }
.nav-link {
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.nav-link:hover {
    color: var(--primary);
    background: var(--primary-light);
}
.nav-link.active {
    color: white;
    background: var(--primary-gradient);
    box-shadow: var(--shadow-md);
}
.btn-icon {
    background: none;
    border: 1.5px solid var(--border);
    font-size: 13px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: all 0.2s;
}
.btn-icon:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: #fef2f2;
}

/* ====== 标签切换 ====== */
.tabs {
    display: flex;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tab {
    flex: 1;
    padding: 14px 16px;
    background: none;
    border: none;
    border-bottom: 2.5px solid transparent;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.tab:hover { color: var(--text); }
.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 700;
}

/* ====== 面板 ====== */
.panel { display: none; }
.panel.active { display: block; animation: fadeIn 0.3s ease; }
.panel-body {
    max-width: 760px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

/* ====== 卡片 ====== */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s, transform 0.3s;
    border: 1px solid var(--border-light);
}
.card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ====== 问答列表 ====== */
.qlist { display: flex; flex-direction: column; gap: 10px; }
.qa-item {
    background: var(--card);
    border-radius: var(--radius);
    padding: 18px 22px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.25s;
    border: 1px solid var(--border-light);
}
.qa-item:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--primary-light);
}
.qa-item .qa-company {
    font-size: 12px;
    color: var(--primary);
    margin-bottom: 6px;
    font-weight: 600;
}
.qa-item .qa-question {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 8px;
}
.qa-item .qa-answer {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}
.qa-item .qa-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 10px;
}

/* ====== 研报卡片 ====== */
.report-item {
    background: var(--card);
    border-radius: var(--radius);
    padding: 18px 22px;
    box-shadow: var(--shadow);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.25s;
    border: 1px solid var(--border-light);
}
.report-item:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--primary-light);
}
.report-item .report-topic {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.4;
}
.report-item .report-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.report-status {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}
.report-status.generating { background: #fef3c7; color: #92400e; }
.report-status.completed { background: #d1fae5; color: #065f46; }
.report-status.failed { background: #fee2e2; color: #991b1b; }

/* ====== 进度条 ====== */
.progress-container {
    background: var(--card);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
    margin: 14px 0;
}
.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 4px;
    transition: width 0.4s ease;
    width: 0%;
}
.progress-log {
    font-size: 13px;
    color: var(--text-secondary);
    max-height: 200px;
    overflow-y: auto;
}
.progress-log .log-item {
    padding: 6px 0;
    border-bottom: 1px solid var(--border-light);
}
.progress-log .log-item:last-child { border: none; }

/* ====== 工具类 ====== */
.empty-tip {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-tertiary);
    font-size: 14px;
}
.msg { font-size: 14px; margin-top: 12px; min-height: 20px; }
.msg.success { color: var(--success); }
.msg.error { color: var(--danger); }
.msg.warning { color: var(--warning); }
.loadmore {
    text-align: center;
    padding: 14px;
    color: var(--primary);
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
}
.loadmore:hover { text-decoration: underline; }
.char-count {
    font-size: 12px;
    color: var(--text-tertiary);
    text-align: right;
    margin-top: 6px;
}
.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}
.search-bar input, .search-bar select {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.search-bar input:focus, .search-bar select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}

/* ====== 配额显示 ====== */
.quota-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 14px;
    font-size: 12px;
    font-weight: 700;
}
.quota-badge .quota-num { font-size: 14px; }

/* ====== 研报内容展示 ====== */
.report-content {
    background: var(--card);
    border-radius: var(--radius);
    padding: 28px;
    font-size: 15px;
    line-height: 1.85;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: var(--shadow);
}

/* ====== 模态框 ====== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal-content {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 520px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
    position: relative;
}
.modal-close {
    position: absolute;
    top: 12px; right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: color 0.2s;
}
.modal-close:hover { color: var(--text); }

/* ====== 响应式 ====== */
@media (max-width: 640px) {
    .panel-body { padding: 16px 14px 32px; }
    .search-bar { flex-wrap: wrap; }
    .topbar { padding: 12px 16px; }
    .topbar-nav { gap: 2px; }
    .nav-link { padding: 6px 10px; font-size: 13px; }
    .topbar-title { font-size: 16px; }
    .card { padding: 18px; }
    .login-form { padding: 24px 20px; }
}
