/* 荣缘外贸 ERP Demo 样式：整体走简洁后台风格，无外部依赖 */

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

body {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #2b2b2b;
  background: #f4f6f8;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  height: 56px;
  background: #1f3a5f;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.logo { font-size: 18px; font-weight: 600; }
.logo-sub { font-size: 12px; font-weight: 400; opacity: .7; margin-left: 6px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-right .hint { font-size: 13px; opacity: .85; }
#roleSelect {
  height: 32px; border: none; border-radius: 4px;
  padding: 0 8px; font-size: 14px; background: #fff; color: #1f3a5f;
}
.badge {
  background: #ffd766; color: #1f3a5f; border-radius: 12px;
  padding: 3px 12px; font-size: 13px; font-weight: 600;
}

/* ---------- 布局 ---------- */
/* 左右各自独立滚动：整屏高度扣掉顶栏后分给两栏，
   菜单/内容超长时只滚自己那一栏，互不影响 */
.layout { display: flex; height: calc(100vh - 56px); }
.sidebar {
  width: 210px; background: #fff; border-right: 1px solid #e3e8ee;
  padding: 12px 0; flex-shrink: 0; overflow-y: auto;
}
.sidebar .group-title {
  font-size: 12px; color: #8a94a6; padding: 10px 18px 4px;
}
.sidebar a {
  display: block; padding: 9px 18px; color: #34495e;
  text-decoration: none; border-left: 3px solid transparent;
}
.sidebar a:hover { background: #f0f4fa; }
.sidebar a.active { border-left-color: #1f3a5f; background: #eef3fb; color: #1f3a5f; font-weight: 600; }
.main { flex: 1; padding: 20px 24px; min-width: 0; overflow-y: auto; }
/* 两栏滚动条细化，避免粗滚动条破坏后台观感（WebKit 内核生效） */
.sidebar::-webkit-scrollbar, .main::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb, .main::-webkit-scrollbar-thumb { background: #d3dae4; border-radius: 3px; }

/* ---------- 通用组件 ---------- */
.page-title { font-size: 20px; margin-bottom: 4px; }
.page-desc { color: #7a8494; margin-bottom: 16px; font-size: 13px; }

.card {
  background: #fff; border: 1px solid #e3e8ee; border-radius: 8px;
  padding: 16px; margin-bottom: 16px;
}
.card h3 { font-size: 15px; margin-bottom: 10px; color: #1f3a5f; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

table.grid { width: 100%; border-collapse: collapse; background: #fff; }
table.grid th, table.grid td {
  border: 1px solid #e3e8ee; padding: 8px 10px; text-align: left; font-size: 13px;
}
table.grid th { background: #f0f4fa; color: #1f3a5f; white-space: nowrap; }
table.grid tr:hover td { background: #fafcff; }

.btn {
  display: inline-block; border: 1px solid #1f3a5f; background: #1f3a5f; color: #fff;
  border-radius: 4px; padding: 5px 12px; font-size: 13px; cursor: pointer;
}
.btn:hover { opacity: .88; }
.btn-plain { background: #fff; color: #1f3a5f; }
.btn-green { background: #2e8b57; border-color: #2e8b57; }
.btn-red { background: #c0392b; border-color: #c0392b; }
.btn-orange { background: #d87b1f; border-color: #d87b1f; }
.btn-sm { padding: 2px 8px; font-size: 12px; }
/* 顶栏 PPT 入口用 a.btn：去掉链接下划线，与普通按钮观感一致 */
a.btn { text-decoration: none; display: inline-block; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }

.tag {
  display: inline-block; border-radius: 3px; padding: 1px 8px; font-size: 12px;
  border: 1px solid transparent;
}
.tag-gray   { background: #eef1f5; color: #5b6779; }
.tag-blue   { background: #e3ecfa; color: #1f5bb5; }
.tag-orange { background: #fdf0dd; color: #b56a10; }
.tag-green  { background: #e2f4e8; color: #2e8b57; }
.tag-red    { background: #fbe5e2; color: #c0392b; }
.tag-purple { background: #efe7f7; color: #6a3fa8; }

/* 阶段进度条 */
.stages { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.stage-node {
  border: 1px solid #cfd8e3; border-radius: 4px; padding: 4px 10px;
  font-size: 12px; background: #fff; color: #5b6779;
}
.stage-node.done { background: #e2f4e8; border-color: #9fd4b4; color: #2e8b57; }
.stage-node.current { background: #1f3a5f; border-color: #1f3a5f; color: #fff; }
.stage-node.skipped { color: #b0b8c4; text-decoration: line-through; }
.stage-arrow { align-self: center; color: #b0b8c4; }

/* 表单 */
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 13px; color: #5b6779; margin-bottom: 4px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; border: 1px solid #cfd8e3; border-radius: 4px;
  padding: 7px 9px; font-size: 14px; font-family: inherit;
}
.form-tip { font-size: 12px; color: #98a2b3; margin-top: 3px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 30, 45, .45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: #fff; border-radius: 8px; width: 560px; max-width: 92vw;
  max-height: 84vh; display: flex; flex-direction: column;
}
.modal-head {
  padding: 14px 18px; border-bottom: 1px solid #e3e8ee;
  font-size: 16px; font-weight: 600; display: flex; justify-content: space-between;
}
.modal-close { border: none; background: none; font-size: 20px; cursor: pointer; color: #8a94a6; }
.modal-body { padding: 18px; overflow-y: auto; }

/* 提示条 */
.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  background: #1f3a5f; color: #fff; padding: 9px 22px; border-radius: 6px;
  font-size: 14px; z-index: 200; box-shadow: 0 4px 14px rgba(0,0,0,.2);
}

/* 时间线（任务操作历史） */
.timeline { list-style: none; }
.timeline li {
  position: relative; padding: 0 0 14px 18px; border-left: 2px solid #e3e8ee;
  font-size: 13px; margin-left: 6px;
}
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 3px;
  width: 10px; height: 10px; border-radius: 50%; background: #1f3a5f;
}
.timeline .t-time { color: #98a2b3; font-size: 12px; margin-left: 8px; }

/* 统计卡片行 */
.stat-row { display: flex; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.stat {
  flex: 1; min-width: 130px; background: #fff; border: 1px solid #e3e8ee;
  border-radius: 8px; padding: 14px; text-align: center;
}
.stat .num { font-size: 26px; font-weight: 700; color: #1f3a5f; }
.stat .lbl { font-size: 12px; color: #7a8494; margin-top: 4px; }

/* ---------- 组织架构图（纯 CSS 架构图：li 顶部伪元素画兄弟间横线与下落竖线，ul::before 画父到子行连线） ---------- */
.org-tree { overflow-x: auto; }
.org-tree ul { list-style: none; display: flex; justify-content: center; position: relative; padding-top: 20px; }
.org-tree > ul { padding-top: 0; }
.org-tree > ul::before { display: none; }
.org-tree ul::before {
  content: ''; position: absolute; top: 0; left: 50%;
  border-left: 1px solid #cfd8e3; height: 20px;
}
.org-tree li {
  position: relative; padding: 20px 6px 0;
  display: flex; flex-direction: column; align-items: center;
}
.org-tree li::before, .org-tree li::after {
  content: ''; position: absolute; top: 0; right: 50%;
  border-top: 1px solid #cfd8e3; width: 50%; height: 20px;
}
.org-tree li::after { right: auto; left: 50%; border-left: 1px solid #cfd8e3; }
.org-tree li:only-child::before, .org-tree li:only-child::after { display: none; }
.org-tree li:only-child { padding-top: 0; }
.org-tree li:first-child::before, .org-tree li:last-child::after { border: 0 none; }
.org-tree li:last-child::before { border-right: 1px solid #cfd8e3; border-radius: 6px 0 0 0; }
.org-tree li:first-child::after { border-radius: 0 6px 0 0; }
/* 折叠：隐藏 li 的直接子 ul；角标变橙色提示“已折叠，可点开” */
.org-tree li.folded > ul { display: none; }
.org-node {
  display: inline-block; border: 1px solid #cfd8e3; border-radius: 4px;
  padding: 2px 10px; font-size: 13px; background: #fff; white-space: nowrap;
}
.org-node[onclick] { cursor: pointer; }
.org-node[onclick]:hover { border-color: #1f3a5f; }
.org-node .org-cnt {
  font-style: normal; background: #1f3a5f; color: #fff;
  border-radius: 8px; padding: 0 6px; font-size: 11px; margin-left: 5px;
}
li.folded > .org-node .org-cnt { background: #d9822b; }
.org-node.center { background: #fdf6e3; border-color: #e0c980; font-weight: 600; }
.org-node.dept { background: #eef3fb; border-color: #a9c3e0; }

/* ---------- 流程图（流程说明页：复现原图每列四层结构，纯 CSS 无依赖） ---------- */
.flow-wrap { overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.flow-lanes { display: flex; align-items: flex-start; min-width: max-content; }
.flow-col { width: 126px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; }
.flink { margin-top: 8px; color: #1f3a5f; font-size: 18px; padding: 0 1px; }
.fstage {
  width: 100%; background: #1f3a5f; color: #fff; border-radius: 6px;
  text-align: center; padding: 7px 0; font-weight: 600; font-size: 13px;
}
.farr { color: #98a2b3; font-size: 13px; line-height: 18px; }
.fbox {
  width: 100%; background: #fff; border: 1px solid #c9d4e3; border-radius: 6px;
  text-align: center; font-size: 12px; padding: 6px 4px;
}
.fbox .lay, .fdia .lay { display: block; font-size: 11px; color: #8a94a6; }
.fbox.fnone { color: #b6c0cd; }
/* 评审会签：六边形裁切复现原图菱形决策框（文字保持水平不旋转） */
.fdia {
  width: 100%; background: #fdf0d0; text-align: center; font-size: 12px; padding: 10px 14px;
  clip-path: polygon(7% 0, 93% 0, 100% 50%, 93% 100%, 7% 100%, 0 50%);
}
.fdia .lay { color: #a3742c; }
.fback { color: #c0392b; font-size: 11px; margin-top: 4px; }
.flow-legend { font-size: 12px; color: #7a8494; margin-top: 6px; }

.empty { color: #98a2b3; text-align: center; padding: 26px 0; }

/* ---------- 登录页 ---------- */
.login-mask {
  position: fixed; inset: 0; z-index: 50;
  background: linear-gradient(135deg, #1f3a5f 0%, #2e5e8f 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 380px; background: #fff; border-radius: 10px; padding: 36px 40px;
  box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.login-logo { font-size: 26px; font-weight: 700; color: #1f3a5f; text-align: center; }
.login-sub { font-size: 13px; color: #7a8494; text-align: center; margin: 8px 0 28px; }
.login-btn { width: 100%; padding: 10px; font-size: 15px; margin-top: 6px; }

/* ---------- 看板条形图（纯 CSS，不引入图表库） ---------- */
.bar-row { display: flex; align-items: center; margin: 7px 0; font-size: 13px; }
.bar-lbl { width: 64px; color: #5b6779; flex: none; }
.bar-track { flex: 1; height: 14px; background: #eef1f6; border-radius: 3px; overflow: hidden; }
.bar { height: 100%; background: linear-gradient(90deg, #2e5e8f, #4a8ac2); border-radius: 3px; }
.bar-num { width: 30px; text-align: right; color: #5b6779; flex: none; }

/* ---------- 单据打印 ----------
 * #printArea 平时隐藏；打印时整页独占，其余内容用 visibility 隐藏
 *（不能用 display:none，否则部分浏览器不渲染打印分页） */
#printArea { display: none; }
@media print {
  body * { visibility: hidden; }
  #printArea, #printArea * { visibility: visible; }
  #printArea {
    display: block !important; position: fixed; left: 0; top: 0; width: 100%;
    padding: 40px 56px; background: #fff; color: #000;
  }
  .bill-print h1 { text-align: center; font-size: 24px; letter-spacing: 6px; margin: 0 0 6px; }
  .bill-print .sub { text-align: center; font-size: 15px; margin-bottom: 22px; }
  .bill-print table { width: 100%; border-collapse: collapse; margin: 14px 0; }
  .bill-print td, .bill-print th { border: 1px solid #333; padding: 9px 12px; font-size: 14px; text-align: left; }
  .bill-print th { background: #f2f2f2; width: 110px; }
  .bill-print .sign { display: flex; justify-content: space-between; margin-top: 56px; font-size: 14px; }
}
