/* ============================================================
   OPTICTIMES 集团数据分析 · 设计系统
   品牌：深蓝灰 #2C3E50 打底 + 品牌红 #E50113 点缀（对齐 optictimes.com）
   语义警示用独立深红 #D8232A，与品牌红区分，避免"强调"与"扣分"混淆
   ============================================================ */
:root {
  /* 品牌 */
  --brand:      #E50113;
  --brand-600:  #C8102E;
  --brand-050:  #FDECEE;
  /* 侧边栏深色基调 */
  --nav-bg:        #2C3E50;
  --nav-bg-2:      #26333F;
  --nav-hover:     #34455A;
  --nav-active-bg: #3A4C60;
  --nav-text:        #C2CBD4;   /* 普通菜单，对比度 ~7:1 */
  --nav-text-strong: #FFFFFF;
  --nav-text-dim:    #8A97A4;   /* 禁用/分组标题，对比度 ~3.3:1 可见但弱 */
  /* 内容区 */
  --bg:       #F3F5F8;
  --surface:  #FFFFFF;
  --ink:   #1F2A37;   /* 主文字/标题 */
  --ink-2: #4A5765;   /* 次要文字 */
  --ink-3: #8A94A0;   /* 弱文字/label */
  --border:   #E6EAEF;
  --border-2: #F0F2F5;
  /* 语义色 */
  --success: #12A867;
  --warning: #E8890C;
  --danger:  #D8232A;
  --info:    #3A78C9;
  /* 形状与层级 */
  --radius:    10px;
  --radius-sm: 7px;
  --shadow-1: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow-2: 0 6px 20px rgba(16,24,40,.10);
  --font: "Noto Sans SC","PingFang SC","Microsoft YaHei","Helvetica Neue",Arial,sans-serif;

  /* Element Plus 主题：品牌红作为主色（按钮/开关/单选/当前页等全站统一） */
  --el-color-primary: #E50113;
  --el-color-primary-dark-2:  #C8102E;
  --el-color-primary-light-3: #EC4655;
  --el-color-primary-light-5: #F28089;
  --el-color-primary-light-7: #F6B3B8;
  --el-color-primary-light-8: #F9CCCF;
  --el-color-primary-light-9: #FDECEE;
  --el-color-success: #12A867;
  --el-color-warning: #E8890C;
  --el-color-danger:  #D8232A;
  --el-border-radius-base: 8px;
  --el-font-family: var(--font);
}

html, body, #app { height: 100%; margin: 0; background: var(--bg);
  font-family: var(--font); color: var(--ink);
  -webkit-font-smoothing: antialiased; }

/* ---------- 登录页 ---------- */
.login-wrap { height: 100%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2C3E50 0%, #1F2C39 100%); }
.login-card { width: 380px; border-radius: 14px !important; border: none !important;
  box-shadow: 0 20px 60px rgba(0,0,0,.28) !important; }
.login-card h3 { display: flex; align-items: center; gap: 9px; color: var(--ink); font-size: 18px; }
.login-card h3::before { content: ""; width: 22px; height: 22px; border-radius: 5px;
  background: var(--brand); box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 6px var(--brand); }

/* ---------- 布局 ---------- */
.layout { height: 100%; }
.aside { background: var(--nav-bg); display: flex; flex-direction: column;
  box-shadow: 2px 0 12px rgba(16,24,40,.08); }
.aside .logo { display: flex; align-items: center; justify-content: center;
  padding: 8px 16px; background: #26333F; border-bottom: 1px solid #3A4B5C; }
.aside .brand-logo { display: block; width: 150px; height: auto; }

/* 菜单：深底 + 亮字，激活左侧品牌红条 */
.aside .el-menu { flex: 1; border-right: none; background: transparent; padding: 6px 0;
  overflow-y: auto; }
.aside .el-menu::-webkit-scrollbar { width: 6px; }
.aside .el-menu::-webkit-scrollbar-thumb { background: #46586b; border-radius: 3px; }
.aside .el-menu-item,
.aside .el-sub-menu__title { color: var(--nav-text) !important; height: 46px; line-height: 46px; }
.aside .el-menu-item:hover,
.aside .el-sub-menu__title:hover { background: var(--nav-hover) !important; color: #fff !important; }
.aside .el-sub-menu__title { font-weight: 600; }
.aside .el-menu-item.is-active {
  color: var(--nav-text-strong) !important; background: var(--nav-active-bg) !important;
  box-shadow: inset 3px 0 0 var(--brand); font-weight: 600; }
.aside .el-sub-menu.is-active > .el-sub-menu__title { color: #fff !important; }
.aside .el-sub-menu .el-menu-item { padding-left: 46px !important; font-size: 13px; height: 40px; line-height: 40px; }
.aside .el-menu-item.is-disabled { color: var(--nav-text-dim) !important; opacity: 1; }
.aside .el-menu-item-group__title { color: var(--nav-text-dim); font-size: 11px; padding: 8px 0 4px 20px; }
.aside .el-sub-menu__icon-arrow { color: var(--nav-text-dim); }
.aside .userbar { padding: 13px 20px; color: var(--nav-text); font-size: 13px;
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid #3a4b5c; background: var(--nav-bg-2); }

.main { padding: 18px 22px; overflow-y: auto; }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
  background: var(--surface); padding: 12px 16px; border-radius: var(--radius); box-shadow: var(--shadow-1); }
.toolbar .note { font-size: 12px; color: var(--ink-3); }

.data-status { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: -4px 0 12px; padding: 9px 12px; background: #F8FAFC;
  border: 1px solid var(--border); border-radius: var(--radius-sm); }
.data-status-main { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.data-status-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-right: 3px; }
.data-status-time { color: var(--ink-3); font-size: 12px; white-space: nowrap; }

/* ---------- KPI 卡 ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow-1); border: 1px solid var(--border-2);
  position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--brand); opacity: 0; transition: opacity .15s; }
.kpi:hover::before { opacity: 1; }
.kpi .label { font-size: 12px; color: var(--ink-3); margin-bottom: 8px; }
.kpi .value { font-size: 23px; font-weight: 700; color: var(--ink); line-height: 1.2; letter-spacing: -.3px; }
.kpi .sub { font-size: 12px; color: var(--ink-3); margin-top: 6px; line-height: 1.6; }
.kpi .bad { color: var(--danger); }

/* ---------- 卡片 ---------- */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); gap: 14px; margin-bottom: 16px; }
.card { background: var(--surface); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow-1); border: 1px solid var(--border-2); margin-bottom: 16px; }
.card:last-child { margin-bottom: 0; }
.card .title { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding-left: 11px; position: relative; }
.card .title::before { content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 3px;
  border-radius: 2px; background: var(--brand); }
.chart { height: 300px; }

.alert-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-2); font-size: 13px; }
.alert-item:last-child { border-bottom: none; }
.alert-title { font-weight: 600; color: var(--ink); }
.alert-detail { font-size: 12px; color: var(--ink-2); }
.formula { font-size: 13px; color: var(--ink-2); line-height: 2; }
.red { color: var(--danger); }

/* ---------- 取数说明折叠 ---------- */
.doc-collapse { background: var(--surface); border-radius: var(--radius); padding: 0 16px;
  box-shadow: var(--shadow-1); border: 1px solid var(--border-2); }
.doc-collapse .el-collapse-item__header { border-bottom: none; background: transparent; }
.doc-collapse .el-collapse-item__wrap { border-bottom: none; }
.doc-sec { margin-bottom: 12px; }
.doc-h { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.doc-ul { margin: 0; padding-left: 20px; }
.doc-ul li { font-size: 13px; color: var(--ink-2); line-height: 1.9; }

.est-field { display: flex; flex-direction: column; gap: 4px; }
.est-label { font-size: 12px; color: var(--ink-3); }

/* ---------- 紧凑表格 ---------- */
.compact-table .el-table__cell { padding: 4px 0; }
.compact-table .cell { padding: 0 8px; font-size: 12px; line-height: 1.4; }
.cell-main { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-sub { color: var(--ink-3); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-reason { color: var(--ink-2); font-size: 11px; line-height: 1.45; margin-top: 3px; }
.el-table th.el-table__cell { background: #FAFBFC !important; color: var(--ink-2); font-weight: 600; }
.el-table { --el-table-border-color: var(--border-2); --el-table-header-text-color: var(--ink-2); }

/* ---------- 经营总览八角度卡 ---------- */
.ov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(268px, 1fr)); gap: 16px; }
.ov-card { background: var(--surface); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-1); border: 1px solid var(--border-2); cursor: pointer;
  transition: box-shadow .16s, transform .16s, border-color .16s; }
.ov-card:hover { box-shadow: var(--shadow-2); transform: translateY(-3px); border-color: var(--brand); }
.ov-head { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 600;
  color: var(--ink); margin-bottom: 12px; }
.ov-num { width: 24px; height: 24px; border-radius: 7px; background: var(--nav-bg); color: #fff;
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.ov-head .dot { width: 10px; height: 10px; border-radius: 50%; margin-left: auto; box-shadow: 0 0 0 3px rgba(0,0,0,.04); }
.ov-metric { font-size: 16px; color: var(--ink-2); margin-bottom: 6px; }
.ov-metric b { font-size: 21px; color: var(--ink); font-weight: 700; letter-spacing: -.3px; }
.ov-muted { color: var(--ink-3); font-size: 15px; }
.ov-sub { font-size: 12px; color: var(--ink-2); line-height: 1.85; }
.ov-trend { margin-top: 10px; min-height: 24px; display: flex; align-items: center; }
.ov-click { margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--border);
  color: var(--info); font-size: 12px; font-weight: 600; }

/* ---------- 分页/标签微调 ---------- */
.el-pagination { --el-pagination-font-size: 12px; }
.el-tag { border-radius: 5px; }

/* DDP 按进口单展开：外层保留批次，内层展示产品成本链与费用审计 */
.ddp-import-detail { padding: 10px 14px 16px 46px; background: #fbfcfe; }
.ddp-import-summary { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 10px;
  color: #44546a; font-size: 12px; }
.ddp-product-table { margin-bottom: 12px; }
.ddp-expense-title { font-size: 13px; font-weight: 650; color: #27364b; margin: 14px 0 8px; }
.ddp-money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ddp-source { color: #8b96a8; font-size: 11px; line-height: 1.35; margin-top: 2px; }
.ddp-import-table .el-table__expanded-cell { padding: 0 !important; }
.ddp-product-table .el-table__header th { background: #f4f7fb !important; }
.ddp-expense-table .el-table__header th { background: #f8fafc !important; }
