/* ===== 全局重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
*:focus { outline: none; }

/* ===== CSS变量 ===== */
:root {
    --primary: #1e3a5f;
    --primary-light: #2a5288;
    --primary-dark: #152a44;
    --secondary: #2d8068;
    --accent: #d4a843;
    --danger: #c94c4c;
    --warning: #e8a838;
    --success: #52a878;
    --info: #4a90d9;
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text-1: #1a1a2e;
    --text-2: #555;
    --text-3: #888;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-sm: 6px;
    --sidebar-w: 230px;
    --topbar-h: 56px;
}

body {
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text-1);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== 登录页 ===== */
.login-page {
    position: fixed; inset: 0;
    background: linear-gradient(135deg, #1e3a5f 0%, #152a44 100%);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}
.login-box {
    width: 820px; height: 480px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-left {
    width: 400px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2a5288 100%);
    color: #fff;
    padding: 48px 40px;
    display: flex; flex-direction: column; justify-content: space-between;
}
.login-brand { text-align: center; }
.brand-logo {
    width: 64px; height: 64px;
    background: var(--accent);
    color: #fff;
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: bold;
    margin-bottom: 16px;
}
.brand-logo.small { width: 36px; height: 36px; font-size: 14px; border-radius: 8px; margin: 0; }
.brand-logo-img {
    display: inline-block;
    max-width: 280px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.2));
}
.brand-logo-img.small {
    max-width: 40px;
    margin-bottom: 0;
    filter: none;
}
.login-brand h1 { font-size: 28px; margin-bottom: 4px; }
.login-brand p { font-size: 15px; opacity: 0.8; }
.login-features { display: flex; flex-direction: column; gap: 16px; }
.feature-item {
    display: flex; align-items: center; gap: 12px;
    font-size: 15px; opacity: 0.9;
}
.feature-icon { font-size: 20px; }
.login-right {
    flex: 1; padding: 56px 48px;
    display: flex; align-items: center;
}
.login-form { width: 100%; }
.login-form h2 { font-size: 24px; color: var(--text-1); margin-bottom: 6px; }
.login-subtitle { color: var(--text-3); font-size: 14px; margin-bottom: 32px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.form-group input {
    width: 100%; height: 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 14px;
    font-size: 14px;
    transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--primary-light); }
.btn-login {
    width: 100%; height: 44px;
    background: var(--primary);
    color: #fff; border: none;
    border-radius: var(--radius-sm);
    font-size: 16px; cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}
.btn-login:hover { background: var(--primary-light); }
.login-hint { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 20px; }

/* ===== 主应用布局 ===== */
.app { display: flex; min-height: 100vh; }

/* ===== 侧边栏 ===== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--primary-dark);
    color: #fff;
    display: flex; flex-direction: column;
    position: fixed; top: 0; bottom: 0; left: 0;
    z-index: 100;
}
.sidebar-header {
    padding: 18px 20px;
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-text { overflow: hidden; }
.brand-title { font-size: 16px; font-weight: 600; }
.brand-sub { font-size: 11px; opacity: 0.6; }
.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 24px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.05); }
.nav-item.active { color: #fff; background: rgba(255,255,255,0.1); }
.nav-item.active::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px; background: var(--accent);
}
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: bold;
}
.user-name { font-size: 13px; }
.user-role { font-size: 11px; opacity: 0.6; }

/* ===== 主内容区 ===== */
.main-content {
    flex: 1; margin-left: var(--sidebar-w);
    display: flex; flex-direction: column;
}
.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 50;
}
.topbar-left h2 { font-size: 17px; font-weight: 600; }
.topbar-left { display: flex; align-items: center; gap: 8px; }
.btn-home {
    width: 32px; height: 32px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-2); transition: all 0.2s;
}
.btn-home:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.breadcrumb-home { color: var(--text-3); cursor: pointer; transition: color 0.2s; }
.breadcrumb-home:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--text-3); font-size: 12px; }
.breadcrumb-current { font-weight: 600; color: var(--text-1); }
.btn-logout {
    display: flex; align-items: center; gap: 6px;
    margin-top: 12px; padding: 8px 12px;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-sm); cursor: pointer;
    color: rgba(255,255,255,0.6); font-size: 12px;
    transition: all 0.2s; width: 100%;
}
.btn-logout:hover { background: rgba(255,255,255,0.15); color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 20px; }
.topbar-date { font-size: 13px; color: var(--text-3); }
.topbar-badge { position: relative; cursor: pointer; color: var(--text-2); }
.badge-dot {
    position: absolute; top: -2px; right: -2px;
    width: 8px; height: 8px;
    background: var(--danger); border-radius: 50%;
    border: 2px solid #fff;
}
.page-content { flex: 1; padding: 20px 24px; overflow-y: auto; }

/* ===== 通用组件 ===== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}
.card-title {
    font-size: 15px; font-weight: 600;
    margin-bottom: 16px;
    display: flex; align-items: center; justify-content: space-between;
}
.card-title-extra { font-size: 13px; font-weight: normal; color: var(--text-3); cursor: pointer; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: 3fr 2fr; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-16 { gap: 16px; }

/* ===== KPI卡片 ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi-card {
    background: #fff; border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
    position: relative; overflow: hidden;
}
.kpi-card::after {
    content: ''; position: absolute; top: 0; right: 0;
    width: 60px; height: 60px;
    border-radius: 50%;
    transform: translate(20px, -20px);
    opacity: 0.08;
}
.kpi-card.blue::after { background: var(--info); }
.kpi-card.green::after { background: var(--success); }
.kpi-card.orange::after { background: var(--warning); }
.kpi-card.red::after { background: var(--danger); }
.kpi-label { font-size: 13px; color: var(--text-3); margin-bottom: 8px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--text-1); }
.kpi-value .unit { font-size: 14px; font-weight: 400; color: var(--text-3); margin-left: 2px; }
.kpi-trend { font-size: 12px; margin-top: 6px; }
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--danger); }

/* ===== 图表容器 ===== */
.chart-container { position: relative; height: 260px; }
.chart-container-sm { position: relative; height: 200px; }

/* ===== 表格 ===== */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
    background: #f7f8fa;
    color: var(--text-3);
    font-weight: 600;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td { padding: 11px 12px; border-bottom: 1px solid #f2f3f5; }
tbody tr:hover { background: #f9fafb; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

/* ===== 状态标签 ===== */
.tag { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.tag-blue { background: #e8f0fe; color: #1967d2; }
.tag-green { background: #e6f4ea; color: #137333; }
.tag-orange { background: #fef7e0; color: #b06000; }
.tag-red { background: #fce8e6; color: #c5221f; }
.tag-gray { background: #f1f3f4; color: #5f6368; }
.tag-purple { background: #f3e8fd; color: #8430ce; }

/* ===== 按钮 ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: var(--radius-sm); font-size: 14px; cursor: pointer; border: none; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--text-2); }
.btn-outline:hover { border-color: var(--primary-light); color: var(--primary); }
.btn-sm { padding: 5px 14px; font-size: 13px; border-radius: 4px; border: none; cursor: pointer; }
.btn-link { background: none; border: none; color: var(--info); cursor: pointer; font-size: 13px; padding: 0; }
.btn-link:hover { text-decoration: underline; }
.btn-danger { background: var(--danger); color: #fff; }

/* ===== 搜索框 ===== */
.search-box {
    display: flex; gap: 12px; margin-bottom: 20px; align-items: center; flex-wrap: wrap;
}
.search-input {
    flex: 1; min-width: 280px; height: 40px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 0 16px; font-size: 14px;
    transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--primary-light); }

/* ===== 风筛评分 ===== */
.risk-score-section { display: flex; gap: 24px; align-items: center; margin-bottom: 24px; }
.score-circle {
    width: 140px; height: 140px;
    position: relative; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.score-circle svg { transform: rotate(-90deg); }
.score-circle .score-bg { stroke: #e5e7eb; }
.score-circle .score-fg { stroke-linecap: round; transition: stroke-dashoffset 0.8s ease; }
.score-value { position: absolute; text-align: center; }
.score-value .num { font-size: 36px; font-weight: 700; }
.score-value .label { font-size: 12px; color: var(--text-3); }
.score-info { flex: 1; }
.score-info h3 { font-size: 18px; margin-bottom: 8px; }
.score-info .company-meta { font-size: 13px; color: var(--text-3); margin-bottom: 12px; }

/* ===== 检查项列表 ===== */
.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    background: #f9fafb;
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.check-icon { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.check-pass { background: #e6f4ea; color: #137333; }
.check-warn { background: #fef7e0; color: #b06000; }
.check-fail { background: #fce8e6; color: #c5221f; }
.check-name { flex: 1; }
.check-result { font-weight: 600; }

/* ===== Tab ===== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab {
    padding: 10px 24px; cursor: pointer;
    font-size: 14px; color: var(--text-3);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab:hover { color: var(--text-1); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== 信息行 ===== */
.info-row { display: flex; padding: 10px 0; border-bottom: 1px solid #f5f6f7; }
.info-label { width: 140px; color: var(--text-3); font-size: 13px; flex-shrink: 0; }
.info-value { flex: 1; font-size: 13px; }

/* ===== 风险预警列表 ===== */
.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border-left: 3px solid;
    background: #f9fafb;
    cursor: pointer;
    transition: background 0.2s;
}
.alert-item:hover { background: #f0f2f5; }
.alert-item.high { border-left-color: var(--danger); }
.alert-item.medium { border-left-color: var(--warning); }
.alert-item.low { border-left-color: var(--info); }
.alert-level { font-size: 11px; padding: 1px 8px; border-radius: 3px; flex-shrink: 0; }
.alert-level.high { background: #fce8e6; color: #c5221f; }
.alert-level.medium { background: #fef7e0; color: #b06000; }
.alert-level.low { background: #e8f0fe; color: #1967d2; }
.alert-content { flex: 1; }
.alert-title { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.alert-desc { font-size: 12px; color: var(--text-3); }
.alert-time { font-size: 12px; color: var(--text-3); flex-shrink: 0; }

/* ===== 报告模板卡片 ===== */
.report-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.report-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
    text-align: center;
}
.report-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--primary-light); }
.report-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; margin: 0 auto 14px;
}
.report-card h4 { font-size: 15px; margin-bottom: 6px; }
.report-card p { font-size: 12px; color: var(--text-3); line-height: 1.5; }
.report-card .report-tag { margin-top: 10px; }

/* ===== 进度条 ===== */
.progress-bar { height: 8px; background: #f0f2f5; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.progress-fill.green { background: var(--success); }
.progress-fill.blue { background: var(--info); }
.progress-fill.orange { background: var(--warning); }
.progress-fill.red { background: var(--danger); }

/* ===== 五级分类 ===== */
.classification-bar { display: flex; height: 32px; border-radius: 6px; overflow: hidden; margin-bottom: 16px; }
.classification-segment {
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: #fff; font-weight: 500;
    transition: flex 0.5s;
}

/* ===== 弹窗 ===== */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.modal-container {
    position: relative; z-index: 1;
    background: #fff; border-radius: 12px;
    max-height: 90vh; width: 560px;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-large { width: 900px; }
.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.modal-header h3 { font-size: 16px; }
.modal-header-actions { display: flex; align-items: center; gap: 10px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-3); padding: 0 4px; }
.modal-close:hover { color: var(--text-1); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }

/* ===== 报告文档样式 ===== */
.report-doc { padding: 20px 40px; font-size: 14px; line-height: 1.8; }
.report-doc h1 { text-align: center; font-size: 22px; margin: 20px 0 8px; }
.report-doc .report-subtitle { text-align: center; color: var(--text-3); font-size: 13px; margin-bottom: 24px; }
.report-doc h2 { font-size: 16px; margin: 20px 0 10px; padding-left: 10px; border-left: 3px solid var(--primary); }
.report-doc h3 { font-size: 14px; margin: 14px 0 8px; }
.report-doc table { margin: 10px 0; }
.report-doc .report-meta { display: flex; justify-content: space-between; color: var(--text-3); font-size: 12px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.report-doc .seal { text-align: right; margin-top: 40px; }
.report-doc .seal-text { display: inline-block; border: 2px solid var(--danger); color: var(--danger); padding: 8px 16px; border-radius: 4px; font-size: 13px; transform: rotate(-5deg); }

/* ===== Toast ===== */
.toast {
    position: fixed; top: 80px; left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(30,58,95,0.95); color: #fff;
    padding: 10px 24px; border-radius: var(--radius-sm);
    font-size: 14px; z-index: 9999;
    opacity: 0; pointer-events: none;
    transition: all 0.3s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 待办列表 ===== */
.todo-list { display: flex; flex-direction: column; gap: 6px; }
.todo-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: var(--radius-sm);
    transition: background 0.2s; cursor: pointer;
}
.todo-item:hover { background: #f0f2f5; }
.todo-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.todo-text { flex: 1; font-size: 13px; }
.todo-time { font-size: 12px; color: var(--text-3); }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }

/* ===== 动画 ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.page-content > * { animation: fadeIn 0.3s ease; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #d0d3d8; border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }