/* ============================================================
 * 融资需求预测平台 - 全局样式
 * 设计参考：企查查、天眼查
 * ============================================================ */

:root {
  --primary: #1664ff;
  --primary-dark: #0c4dd9;
  --primary-light: #e8f0ff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f3f5f9;
  --panel-bg: #ffffff;
  --success: #16a34a;
  --warning: #ea8a00;
  --danger: #dc2626;
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 18px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  color: var(--primary-dark);
}

/* ============== 顶部导航栏 ============== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  font-weight: 700;
  font-size: 16px;
}
.brand:hover {
  color: var(--primary);
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #4f8bff);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

.nav-tabs-custom {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 8px;
}
.nav-tabs-custom a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  color: var(--text-muted);
  font-size: 14px;
  transition: 0.15s;
}
.nav-tabs-custom a:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.nav-tabs-custom a.active {
  background: var(--primary);
  color: #fff;
}

.global-search {
  margin-left: auto;
  flex: 0 0 360px;
  position: relative;
  background: var(--bg);
  border-radius: 22px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  height: 40px;
  border: 1px solid transparent;
  transition: 0.2s;
}
.global-search:focus-within {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 100, 255, 0.12);
}
.global-search i {
  color: var(--text-muted);
}
.global-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  margin-left: 8px;
  font-size: 14px;
}

/* ============== 主体容器 ============== */
.page-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.page-head h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
}

/* ============== Hero ============== */
.dashboard-hero {
  background: linear-gradient(135deg, #1664ff 0%, #4f8bff 100%);
  color: #fff;
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: center;
  box-shadow: var(--shadow-md);
}
.dashboard-hero h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px;
}
.dashboard-hero p {
  margin: 0;
  opacity: 0.9;
  font-size: 14px;
}
.hero-search form {
  background: rgba(255, 255, 255, 0.96);
  border-radius: 12px;
  padding: 4px 4px 4px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hero-search i {
  color: var(--text-muted);
}
.hero-search input {
  flex: 1;
  height: 40px;
  border: none;
  outline: none;
  font-size: 14px;
}
.hero-search button {
  height: 40px;
  border-radius: 8px;
  padding: 0 20px;
}
.quick-tags {
  margin-top: 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.95);
}
.quick-tags span {
  margin-right: 6px;
}
.quick-tags a {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  padding: 4px 10px;
  border-radius: 12px;
  margin-right: 8px;
}
.quick-tags a:hover {
  background: rgba(255, 255, 255, 0.32);
  color: #fff;
}

/* ============== KPI 卡片 ============== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.kpi-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.kpi-card::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -20px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  opacity: 0.08;
}
.kpi-blue::after  { background: var(--primary); }
.kpi-green::after { background: var(--success); }
.kpi-orange::after{ background: var(--warning); }
.kpi-purple::after{ background: #8a5cf6; }

.kpi-label {
  color: var(--text-muted);
  font-size: 13px;
}
.kpi-value {
  font-size: 30px;
  font-weight: 700;
  margin: 6px 0 4px;
  color: var(--text-main);
}
.kpi-foot {
  font-size: 12px;
  color: var(--text-muted);
}

/* ============== 面板 ============== */
.panel {
  background: var(--panel-bg);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel-head {
  padding: 16px 20px 8px;
  border-bottom: 1px solid var(--border);
}
.panel-head h5 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}
.panel-head small {
  font-size: 12px;
}
.panel-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #fafbfd;
}

.chart-canvas {
  width: 100%;
  height: 320px;
}
.chart-radar {
  height: 360px;
}

/* ============== 表格 ============== */
.table {
  margin: 0;
}
.table > thead > tr > th {
  background: #f7f9fc;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  white-space: nowrap;
}
.table > tbody > tr > td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table > tbody > tr:hover {
  background: #f9fbff;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 4px 10px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 13px;
  background: var(--primary-light);
  color: var(--primary);
}
.score-pill.high { background: #fff1e6; color: #c2410c; }
.score-pill.mid  { background: #e8f0ff; color: var(--primary); }
.score-pill.low  { background: #f3f4f6; color: #6b7280; }

.level-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
}
.level-A { background: #fde7d3; color: #c2410c; }
.level-B { background: #e6f4ec; color: #15803d; }
.level-C { background: #e8f0ff; color: #1d4ed8; }
.level-D { background: #f3f4f6; color: #4b5563; }

.company-link {
  font-weight: 600;
  color: var(--text-main);
}
.company-link:hover {
  color: var(--primary);
}

/* ============== 分页 ============== */
.pagination .page-link {
  color: var(--text-muted);
  border-color: var(--border);
}
.pagination .active .page-link {
  background: var(--primary);
  border-color: var(--primary);
}

/* ============== 企业详情 ============== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-size: 13px;
}
.back-link:hover {
  color: var(--primary);
}

.company-header {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ch-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}
.ch-name h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text-main);
}
.ch-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.ch-tag {
  background: var(--primary-light);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
}
.ch-score {
  text-align: right;
}
.ch-score .num {
  font-size: 48px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.ch-score .total {
  color: var(--text-muted);
  font-size: 14px;
}
.ch-score .level-badge {
  margin-top: 4px;
  font-size: 13px;
  padding: 4px 12px;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 8px 0;
}
.kv-item {
  padding: 14px 20px;
  border-right: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
}
.kv-item:nth-child(4n) { border-right: none; }
.kv-key {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.kv-val {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.score-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px dashed var(--border);
}
.score-bar-row:first-child { border-top: none; }
.score-bar-label {
  width: 120px;
  font-size: 13px;
  color: var(--text-muted);
}
.score-bar-track {
  flex: 1;
  height: 8px;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #4f8bff);
  border-radius: 4px;
}
.score-bar-value {
  width: 60px;
  text-align: right;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
}

.advice-box {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 14px 16px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-main);
}

.advice-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
}
.advice-meta div b { color: var(--text-main); }

.policy-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
}
.policy-tag.on  { background: #fef3c7; color: #b45309; }
.policy-tag.off { background: #f3f4f6; color: #9ca3af; }

/* ============== 通用 ============== */
.page-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 24px;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-hero { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: repeat(2, 1fr); }
  .kv-item:nth-child(4n) { border-right: 1px dashed var(--border); }
  .kv-item:nth-child(2n) { border-right: none; }
}
@media (max-width: 700px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 12px; gap: 12px; }
  .global-search { flex: 1 1 100%; }
  .nav-tabs-custom { flex: 1 1 100%; overflow-x: auto; }
  .kpi-grid { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: 1fr; }
  .kv-item { border-right: none !important; }
}

/* ============== 数据管理页 ============== */
.data-list {
  padding: 8px 0;
}
.data-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.data-row:last-child { border-bottom: none; }
.data-row .icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex: 0 0 40px;
}
.data-row .info { flex: 1; min-width: 0; }
.data-row .info .name {
  font-weight: 600;
  color: var(--text-main);
  font-size: 14px;
}
.data-row .info .meta {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 4px;
}
.data-row .actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.data-row .badge-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  margin-right: 6px;
}
.badge-status.ok      { background: #e6f4ec; color: #15803d; }
.badge-status.missing { background: #fee2e2; color: #b91c1c; }

.run-panel {
  padding: 20px;
}
.run-status {
  margin-top: 14px;
  font-size: 13px;
  padding: 12px 14px;
  border-radius: 8px;
  display: none;
}
.run-status.show { display: block; }
.run-status.info    { background: var(--primary-light); color: var(--primary-dark); }
.run-status.success { background: #e6f4ec; color: #15803d; }
.run-status.error   { background: #fee2e2; color: #b91c1c; }

.train-panel { padding: 20px; }
.train-step { background: #f8fafc; border: 1px solid #eef2f6; border-radius: 8px; padding: 14px 16px; }
.step-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; color: #1f2937; }
.step-no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary, #1664ff); color: #fff; font-size: 12px;
  margin-right: 6px;
}
.train-metrics .metrics-summary {
  display: flex; flex-wrap: wrap; gap: 14px;
  background: #f8fafc; border-radius: 8px; padding: 12px 16px;
}
.train-metrics .metrics-summary > div { min-width: 110px; }
.train-metrics .metrics-summary .lbl { display:block; font-size: 12px; color: #6b7280; }
.train-metrics .metrics-summary .val { font-weight: 600; font-size: 16px; color: #111827; }
.train-metrics .metrics-table th { background: #f3f4f6; }

/* 隐藏的 file input */
.upload-hidden { display: none; }

/* ============================================================
 * 认证：登录 / 注册页
 * ============================================================ */
.auth-wrap {
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel-bg);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 32px 32px 28px;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.auth-brand .brand-mark {
  width: 46px; height: 46px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 20px;
}
.auth-brand h2 {
  font-size: 18px; margin: 0 0 4px 0;
}
.auth-brand p {
  margin: 0; font-size: 13px; color: var(--text-muted);
}
.auth-card form label {
  display: block;
  margin-bottom: 14px;
}
.auth-card form label span {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.auth-card form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.auth-card form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 100, 255, 0.12);
}
.btn-primary-block {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
.btn-primary-block:hover { background: var(--primary-dark); }
.auth-error {
  background: #fee2e2;
  color: #b91c1c;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 14px;
}
.auth-success {
  background: #e6f4ec;
  color: #15803d;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 14px;
}
.auth-footer {
  margin-top: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.auth-footer a { color: var(--primary); text-decoration: none; }
.auth-footer .tip { display: block; font-size: 12px; margin-top: 4px; color: #9ca3af; }

/* 顶栏用户徽章 */
.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
}
.user-badge .user-name {
  font-size: 13px;
  color: var(--text-main);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.role-tag {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.role-admin              { background: #fef3c7; color: #b45309; }
.role-user               { background: #e0e7ff; color: #4338ca; }
.role-enterprise_master  { background: #dcfce7; color: #15803d; }
.role-enterprise_sub     { background: #f3e8ff; color: #6b21a8; }
.btn-logout {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
}
.btn-logout:hover { color: var(--danger); }

