/* OA 办公系统 全局样式 */
* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f0f2f5;
  color: #303133;
}

#app { height: 100%; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 50%, #1a365d 100%);
  position: relative; overflow: hidden;
}
.login-wrap::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.08) 0, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,.06) 0, transparent 40%);
}
.login-card {
  position: relative; z-index: 2;
  width: 400px; padding: 40px 36px 32px;
  background: #fff; border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-card h1 {
  margin: 0 0 6px; font-size: 24px; font-weight: 600;
  color: #1e3a5f; text-align: center;
}
.login-card .sub {
  text-align: center; color: #909399; font-size: 13px; margin-bottom: 28px;
}
.login-card .el-form-item { margin-bottom: 22px; }
.login-card .el-button { width: 100%; height: 42px; font-size: 15px; }

/* ---------- 主布局 ---------- */
.layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 210px; flex-shrink: 0;
  background: #1e3a5f;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar .brand {
  height: 58px; flex-shrink: 0;
  display: flex; align-items: center; padding: 0 18px;
  color: #fff; font-size: 16px; font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,.1);
  letter-spacing: .5px;
}
.sidebar .menu { flex: 1; overflow-y: auto; padding: 10px 0; }
.sidebar .menu::-webkit-scrollbar { width: 4px; }
.sidebar .menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }

.menu-item {
  display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 18px; margin: 2px 8px;
  color: rgba(255,255,255,.75); font-size: 14px;
  border-radius: 7px; cursor: pointer;
  transition: background .15s, color .15s;
  user-select: none;
}
.menu-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.menu-item.active { background: #2c5282; color: #fff; font-weight: 500; }
.menu-item .badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
  background: #f56c6c; color: #fff; font-size: 11px;
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
}

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: 58px; flex-shrink: 0;
  background: #fff; border-bottom: 1px solid #e4e7ed;
  display: flex; align-items: center; padding: 0 22px; gap: 16px;
}
.topbar .page-title { font-size: 16px; font-weight: 600; color: #303133; }
.topbar .spacer { flex: 1; }
.topbar .user-box {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 5px 10px; border-radius: 7px; transition: background .15s;
}
.topbar .user-box:hover { background: #f5f7fa; }
.topbar .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #2c5282; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.topbar .uname { font-size: 14px; color: #303133; }

.content { flex: 1; overflow-y: auto; padding: 18px 22px; }

/* ---------- 通用卡片 ---------- */
.panel {
  background: #fff; border-radius: 9px; padding: 18px 20px;
  border: 1px solid #ebeef5;
}
.panel + .panel { margin-top: 14px; }
.panel-title {
  font-size: 15px; font-weight: 600; color: #303133;
  margin: 0 0 14px; display: flex; align-items: center; gap: 8px;
}
.panel-title::before {
  content: ''; width: 3px; height: 15px; background: #2c5282; border-radius: 2px;
}

/* ---------- 工作台统计卡 ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px; margin-bottom: 14px;
}
.stat-card {
  background: #fff; border: 1px solid #ebeef5; border-radius: 9px;
  padding: 18px 20px; cursor: pointer;
  transition: box-shadow .18s, transform .18s, border-color .18s;
  position: relative; overflow: hidden;
}
.stat-card:hover {
  box-shadow: 0 4px 16px rgba(44,82,130,.13);
  transform: translateY(-2px); border-color: #b8cfe8;
}
.stat-card .label { font-size: 13px; color: #909399; margin-bottom: 10px; }
.stat-card .num {
  font-size: 30px; font-weight: 700; line-height: 1; color: #1e3a5f;
}
.stat-card .num.orange { color: #e6a23c; }
.stat-card .num.red { color: #f56c6c; }
.stat-card .num.green { color: #67c23a; }
.stat-card .unit { font-size: 13px; color: #909399; margin-left: 4px; font-weight: 400; }
.stat-card::after {
  content: ''; position: absolute; right: -20px; bottom: -20px;
  width: 76px; height: 76px; border-radius: 50%;
  background: rgba(44,82,130,.045);
}

/* ---------- 表格页 ---------- */
.table-toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  flex-wrap: wrap;
}
.table-toolbar .spacer { flex: 1; }

/* ---------- 详情页 ---------- */
.detail-head {
  background: #fff; border-radius: 9px; padding: 20px 22px;
  border: 1px solid #ebeef5; margin-bottom: 14px;
}
.detail-head h2 {
  margin: 0 0 8px; font-size: 18px; font-weight: 600; color: #303133;
}
.detail-head .meta {
  display: flex; gap: 20px; flex-wrap: wrap;
  font-size: 13px; color: #909399;
}
.detail-head .meta b { color: #606266; font-weight: 500; }

.status-tag {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 4px;
  font-size: 12px; font-weight: 500;
}
.st-running { background: #fdf6ec; color: #e6a23c; border: 1px solid #f5dab1; }
.st-approved { background: #f0f9eb; color: #67c23a; border: 1px solid #c2e7b0; }
.st-rejected { background: #fef0f0; color: #f56c6c; border: 1px solid #fbc4c4; }
.st-withdrawn { background: #f4f4f5; color: #909399; border: 1px solid #d3d4d6; }

/* ---------- 审批时间线 ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: #e4e7ed;
}
.tl-item { position: relative; padding-bottom: 20px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ''; position: absolute; left: -23px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: #c0c4cc; border: 2px solid #fff;
  box-shadow: 0 0 0 2px #e4e7ed;
}
.tl-item.done::before { background: #67c23a; box-shadow: 0 0 0 2px #c2e7b0; }
.tl-item.reject::before { background: #f56c6c; box-shadow: 0 0 0 2px #fbc4c4; }
.tl-item.wait::before { background: #e6a23c; box-shadow: 0 0 0 2px #f5dab1; }
.tl-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.tl-name { font-size: 14px; font-weight: 500; color: #303133; }
.tl-time { font-size: 12px; color: #a8abb2; }
.tl-body { font-size: 13px; color: #606266; line-height: 1.6; }

/* ---------- 表单数据展示 ---------- */
.form-data-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px 24px;
}
.fd-item { display: flex; gap: 8px; font-size: 13px; padding: 6px 0; }
.fd-label { color: #909399; flex-shrink: 0; min-width: 84px; }
.fd-value { color: #303133; word-break: break-all; flex: 1; }

/* ---------- 设计器 ---------- */
.designer-wrap { display: flex; gap: 14px; height: calc(100vh - 160px); }
.canvas-box {
  flex: 1; background: #fff; border: 1px solid #e4e7ed;
  border-radius: 9px; overflow: hidden; position: relative;
  min-height: 520px;
}
.canvas-box .bjs-powered-by { display: none !important; }
.prop-panel {
  width: 320px; flex-shrink: 0; background: #fff;
  border: 1px solid #e4e7ed; border-radius: 9px;
  padding: 16px; overflow-y: auto;
}

/* ---------- 空状态 ---------- */
.empty-box {
  padding: 50px 0; text-align: center; color: #a8abb2; font-size: 14px;
}

/* ---------- 表单设计器 字段列表 ---------- */
.field-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border: 1px solid #e4e7ed; border-radius: 6px;
  margin-bottom: 8px; background: #fafbfc; font-size: 13px;
}
.field-item .del { margin-left: auto; color: #f56c6c; cursor: pointer; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .sidebar { width: 62px; }
  .sidebar .brand { padding: 0; justify-content: center; font-size: 0; }
  .sidebar .brand::after { content: 'OA'; font-size: 16px; }
  .menu-item { padding: 0; justify-content: center; font-size: 0; }
  .menu-item .ico { font-size: 18px; }
  .topbar .uname { display: none; }
  .content { padding: 12px; }
  .designer-wrap { flex-direction: column; height: auto; }
  .prop-panel { width: 100%; }
  .login-card { width: calc(100% - 32px); padding: 30px 24px; }
}

/* ---------- 通知行 ---------- */
.notice-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 4px; border-bottom: 1px solid #f2f4f7;
  font-size: 13px; cursor: pointer;
}
.notice-row:last-child { border-bottom: none; }
.notice-row:hover { background: #fafbfc; }
.notice-row .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #dcdfe6; flex-shrink: 0;
}
.notice-row .dot.unread { background: #f56c6c; }
.notice-row .ntitle {
  flex: 1; color: #303133; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.notice-row .ntime { color: #a8abb2; font-size: 12px; flex-shrink: 0; }

/* ---------- 审批详情 ---------- */
.detail-head {
  background: #fff; border-radius: 10px; padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(16,24,40,.06); margin-bottom: 16px;
}
.detail-head h2 { margin: 0 0 12px; font-size: 19px; font-weight: 700; color: #1d2129; }
.detail-head .meta {
  display: flex; flex-wrap: wrap; gap: 8px 26px;
  font-size: 13px; color: #6b7280;
}
.detail-head .meta b { color: #1d2129; font-weight: 600; }

.form-data-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: #f0f2f5; border: 1px solid #f0f2f5; border-radius: 8px; overflow: hidden; }
.fd-item { background: #fff; padding: 12px 16px; display: flex; gap: 12px; font-size: 13px; }
.fd-label { color: #6b7280; min-width: 90px; flex-shrink: 0; }
.fd-value { color: #1d2129; flex: 1; word-break: break-all; white-space: pre-wrap; }

/* ---------- 时间线 ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px;
  width: 2px; background: #eef0f3;
}
.tl-item { position: relative; padding: 0 0 18px 0; }
.tl-item::before {
  content: ''; position: absolute; left: -22px; top: 5px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 2px solid #dcdfe6;
}
.tl-item.done::before { border-color: #67c23a; background: #67c23a; }
.tl-item.reject::before { border-color: #f56c6c; background: #f56c6c; }
.tl-head { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.tl-name { font-weight: 600; color: #1d2129; }
.tl-time { color: #a8abb2; font-size: 12px; }
.tl-body { font-size: 13px; color: #4b5563; margin-top: 3px; }
.tl-body b { color: #1d2129; }

/* ---------- 底部操作条 ---------- */
.op-bar {
  position: sticky; bottom: 0; background: #fff;
  padding: 12px 24px; margin-top: 16px;
  border-radius: 10px; box-shadow: 0 -2px 10px rgba(16,24,40,.08);
  display: flex; gap: 10px; justify-content: flex-end; z-index: 10;
}

/* ---------- 消息中心 ---------- */
.msg-item {
  padding: 13px 12px; border-bottom: 1px solid #f2f4f7;
  cursor: pointer; border-radius: 6px; transition: background .15s;
}
.msg-item:hover { background: #fafbfc; }
.msg-item.unread { background: #fbfdff; }
.msg-head { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.msg-head .dot { width: 7px; height: 7px; border-radius: 50%; background: #dcdfe6; }
.msg-head .dot.unread { background: #f56c6c; }
.mtitle { font-weight: 600; color: #1d2129; flex: 1; }
.mtime { color: #a8abb2; font-size: 12px; }
.mbody {
  font-size: 13px; color: #6b7280; margin-top: 4px; padding-left: 16px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 表单字段设计行 ---------- */
.field-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px; background: #fafbfc; border-radius: 6px; margin-bottom: 8px;
}

/* ---------- 流程设计器 ---------- */
.designer-root {
  background: #fff; border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  display: flex; flex-direction: column;
  height: calc(100vh - 132px);
}
.des-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid #e5e9f0; flex-shrink: 0;
}
.des-toolbar .spacer { flex: 1; }
.des-body { flex: 1; display: flex; min-height: 0; }

/* 左侧节点面板 */
.des-palette {
  width: 132px; flex-shrink: 0; padding: 12px 10px;
  border-right: 1px solid #e5e9f0; background: #fafbfc;
}
.pal-title {
  font-size: 12px; font-weight: 700; color: #94a3b8;
  letter-spacing: .5px; margin-bottom: 10px;
}
.pal-item {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 10px; margin-bottom: 8px;
  background: #fff; border: 1px solid #e5e9f0;
  border-left: 3px solid #94a3b8; border-radius: 6px;
  font-size: 13px; color: #334155; cursor: grab;
  user-select: none; transition: all .15s;
}
.pal-item:hover {
  border-color: #c7d2fe; box-shadow: 0 2px 6px rgba(37,99,235,.14);
  transform: translateY(-1px);
}
.pal-item:active { cursor: grabbing; }
.pal-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pal-tip {
  margin-top: 16px; font-size: 11px; color: #a8b3c4;
  line-height: 1.75; border-top: 1px dashed #e5e9f0; padding-top: 10px;
}

/* 画布 */
.des-canvas-wrap {
  flex: 1; overflow: auto; position: relative;
  background-color: #f8fafc;
  background-image: radial-gradient(#dde3ec 1px, transparent 1px);
  background-size: 18px 18px;
}
.des-svg { display: block; }
.des-empty {
  position: absolute; top: 46%; left: 50%; transform: translate(-50%,-50%);
  color: #a8b3c4; font-size: 14px; pointer-events: none;
}

/* 右侧属性面板 */
.des-props {
  width: 280px; flex-shrink: 0; padding: 12px 14px;
  border-left: 1px solid #e5e9f0; background: #fff; overflow-y: auto;
}
.prop-hint {
  font-size: 11.5px; color: #94a3b8; line-height: 1.7;
  background: #f8fafc; border-radius: 5px; padding: 8px 10px; margin-top: 6px;
}
.des-props .el-form-item { margin-bottom: 15px; }
.des-props .el-form-item__label {
  font-size: 12px; color: #64748b; font-weight: 600; padding-bottom: 3px;
}
