/* 轻量级采购系统 - 全局样式 */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0891b2;
  --bg: #f1f5f9;
  --sidebar-w: 230px;
  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #2563eb;
  --border: #e2e8f0;
  --radius: 8px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  font-size: 14px;
  color: #1e293b;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* 登录页 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #0891b2 100%);
}
.login-card {
  width: min(380px, 92vw);
  background: #fff;
  border-radius: 12px;
  padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-card h3 { margin: 0 0 6px; text-align: center; color: #1e293b; font-weight: 600; }
.login-card .sub { text-align: center; color: #64748b; margin-bottom: 24px; font-size: 13px; }

/* 主布局 */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform .25s;
}
.sidebar .logo {
  padding: 18px 20px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 8px;
}
.sidebar .logo i { color: #38bdf8; font-size: 20px; }
.menu-group-title {
  padding: 12px 20px 6px;
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .15s;
  font-size: 14px;
}
.menu-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.menu-item.active {
  background: rgba(37,99,235,.18);
  border-left-color: var(--sidebar-active);
  color: #fff;
}
.menu-item i { width: 18px; text-align: center; font-size: 16px; }
.menu-item .sub-arrow { margin-left: auto; font-size: 10px; }
.menu-children .menu-item { padding-left: 48px; font-size: 13px; }

.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 50;
}
.topbar .page-title { font-size: 16px; font-weight: 600; }
.topbar .user-area { display: flex; align-items: center; gap: 12px; }
.topbar .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.content { padding: 20px; flex: 1; }

/* 卡片（横向可滚动：窄屏下表格超宽时在卡片内滑动，避免撑破页面） */
.card-box {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.card-box .card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600;
}
.card-body { padding: 18px; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 16px 18px;
  border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.stat-card .stat-label { color: #64748b; font-size: 13px; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; margin-top: 6px; color: #1e293b; }
.stat-card .stat-icon {
  float: right; width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.stat-card.blue .stat-icon { background: #dbeafe; color: #2563eb; }
.stat-card.green .stat-icon { background: #dcfce7; color: #16a34a; }
.stat-card.orange .stat-icon { background: #fed7aa; color: #d97706; }
.stat-card.red .stat-icon { background: #fee2e2; color: #dc2626; }
.stat-card.purple .stat-icon { background: #ede9fe; color: #7c3aed; }

/* 状态标签 */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.tag-gray { background: #e2e8f0; color: #475569; }
.tag-blue { background: #dbeafe; color: #1d4ed8; }
.tag-green { background: #dcfce7; color: #15803d; }
.tag-orange { background: #fed7aa; color: #c2410c; }
.tag-red { background: #fee2e2; color: #b91c1c; }
.tag-purple { background: #ede9fe; color: #6d28d9; }
.tag-cyan { background: #cffafe; color: #0e7490; }

/* 工具栏 */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar .spacer { flex: 1; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.table th { background: #f8fafc; font-weight: 600; color: #475569; white-space: nowrap; }
.table tbody tr:hover { background: #f8fafc; }
.table .actions a { margin-right: 8px; cursor: pointer; }

/* 分页 */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: flex-end; margin-top: 14px; }
.pagination button {
  border: 1px solid var(--border); background: #fff; padding: 5px 12px;
  border-radius: 4px; cursor: pointer; font-size: 13px;
}
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: .5; cursor: not-allowed; }

/* 表单 */
.form-label { font-weight: 500; margin-bottom: 4px; color: #334155; }
.form-text { font-size: 12px; color: #64748b; }
.form-control, .form-select {
  width: 100%; padding: 7px 10px; border: 1px solid #cbd5e1;
  border-radius: 6px; font-size: 14px; outline: none; transition: border .15s;
}
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea.form-control { resize: vertical; }

/* 按钮 */
.btn { padding: 7px 16px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; font-size: 14px; transition: all .15s; display: inline-flex; align-items: center; gap: 5px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: #e2e8f0; color: #475569; }
.btn-outline { background: #fff; border-color: #cbd5e1; color: #334155; }
.btn-outline:hover { background: #f1f5f9; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ===== 模糊搜索组合框 SearchCombo（2026-11-25）=====
 * 下拉面板 position:fixed 按输入框坐标定位，在可滚动弹窗(.modal-body overflow)内不被裁剪。 */
.search-combo { position: relative; display: inline-block; }
.search-combo .combo-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); cursor: pointer; color: #94a3b8; font-size: 16px; line-height: 1; z-index: 5; }
.search-combo .combo-clear:hover { color: #475569; }
.search-combo .combo-list { position: fixed; background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.14); max-height: 260px; overflow-y: auto; z-index: 2050; }
.search-combo .combo-item { padding: 7px 10px; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-combo .combo-item:hover { background: #f1f5f9; }
.search-combo .combo-empty { padding: 10px; font-size: 12px; color: #94a3b8; text-align: center; }

/* 模态框 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 1000; padding: 40px 16px; overflow-y: auto;
}
.modal-box {
  background: #fff; border-radius: 10px; width: 100%; max-width: 640px;
  box-shadow: 0 25px 70px rgba(0,0,0,.3);
}
.modal-box.lg { max-width: 900px; }
.modal-box.xl { max-width: 1200px; }  /* 2026-11-24: 宽表单弹窗（新建采购申请等，明细多列不被挤压） */
.modal-head { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 15px; }
.modal-body { padding: 20px; max-height: 65vh; overflow-y: auto; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.modal-close { cursor: pointer; color: #94a3b8; font-size: 20px; background: none; border: none; }

/* 时间线(审批记录) */
.timeline { padding-left: 18px; border-left: 2px solid #e2e8f0; }
.timeline-item { position: relative; padding: 0 0 18px 14px; }
.timeline-item::before { content: ""; position: absolute; left: -22px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; }
.timeline-item .tl-time { font-size: 12px; color: #94a3b8; }

/* 空状态 */
.empty { text-align: center; padding: 40px; color: #94a3b8; }
.empty i { font-size: 40px; }

/* 警告横幅 */
.alert-banner { background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; padding: 10px 16px; border-radius: 8px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.alert-danger-banner { background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; }

/* ===== 响应式适配（平板 / 手机） ===== */
/* 汉堡按钮与抽屉遮罩：桌面端隐藏，<=992px 由媒体查询显示 */
.menu-toggle { display: none; }
.sidebar-backdrop { display: none; }

/* 平板及以下（<=992px）：侧边栏改为抽屉模式，表格改为横向滚动 */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .main-area { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .sidebar-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(15,23,42,.45);
    z-index: 99; /* 位于侧边栏(100)之下、内容之上 */
  }
  .content { padding: 14px; }
  /* 单元格不换行，配合 .card-box 横向滚动，避免列被挤压错行 */
  .table th, .table td { white-space: nowrap; }
}

/* 手机端（<=768px）：表单堆叠、控件撑满、弹窗近全屏 */
@media (max-width: 768px) {
  .content { padding: 10px; }
  .topbar { padding: 0 10px; }
  .topbar .user-area { gap: 8px; }
  .topbar .page-title { font-size: 15px; }
  .user-name { display: none; } /* 顶栏只保留角色徽章 + 头像，节省宽度 */
  /* 弹窗内表单字段单列堆叠（桌面端 .row 多列并排） */
  .row { gap: 0; }
  .row > .col, .row > .col-2 { flex: 1 1 100%; }
  .table th, .table td { padding: 8px; font-size: 12px; }
  /* 覆盖模板中的内联固定宽度，筛选控件自适应铺满 */
  .toolbar .form-control { width: auto !important; flex: 1 1 140px; }
  .toolbar .btn { flex: 1 1 auto; }
  .modal-mask { padding: 10px; }
  .modal-box { max-width: none !important; border-radius: 8px; }
  .modal-body { max-height: 70vh; padding: 14px; }
  .modal-head { padding: 12px 14px; }
  .modal-foot { padding: 10px 14px; }
  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .stat-card { padding: 12px 14px; }
  .stat-card .stat-value { font-size: 20px; }
  .pagination { flex-wrap: wrap; justify-content: center; gap: 6px; }
  .pagination button { padding: 5px 10px; }
  .login-card { padding: 26px 20px; }
}
.row { display: flex; gap: 14px; flex-wrap: wrap; }
/* overflow-wrap: 长单号(如 PR202611190001)等无空格长文本在窄列内换行，避免溢出遮挡相邻列(2026-11-19) */
.col { flex: 1; min-width: 0; overflow-wrap: break-word; }
.col-2 { flex: 2; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 14px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 14px; }
.text-right { text-align: right; }

/* ===== 工作台业务流程闭环 ===== */
.flow-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 14px; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; }
.flow-node { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 92px; padding: 10px 8px; background: #fff; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: all .15s; position: relative; }
.flow-node:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(37,99,235,.12); transform: translateY(-1px); }
.flow-node i { font-size: 20px; color: var(--primary); margin-bottom: 4px; }
.flow-name { font-size: 12px; color: #475569; white-space: nowrap; }
.flow-badge { display: inline-block; margin-top: 4px; min-width: 18px; padding: 1px 6px; background: #2563eb; color: #fff; border-radius: 10px; font-size: 11px; font-weight: 600; text-align: center; }
.flow-badge-warn { background: #d97706; }
.flow-node.flow-warn { border-color: #fbbf24; background: #fffbeb; }
.flow-node.flow-warn i { color: #d97706; }
.flow-node.flow-danger { border-color: #fca5a5; background: #fef2f2; }
.flow-node.flow-danger i { color: #dc2626; }
.flow-node.flow-danger .flow-badge { background: #dc2626; }
.flow-arrow { color: #94a3b8; font-size: 16px; }
/* 超期/超时提示行 */
.flow-alert { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; padding: 8px 14px; background: #fef2f2; border: 1px solid #fca5a5; border-radius: 8px; color: #991b1b; font-size: 13px; }
.flow-alert i { color: #dc2626; }
.flow-alert-item { margin-left: 4px; }
.flow-alert-item strong { color: #dc2626; }
.flow-alert-link { margin-left: auto; color: #2563eb; cursor: pointer; text-decoration: underline; }
@media (max-width: 768px) { .flow-node { min-width: 76px; padding: 8px 4px; } .flow-arrow { display: none; } }

/* ===== 工作台"我的待办"（按登录账号角色计算，点击跳转对应页面，2026-11-19） ===== */
.todo-grid { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 0; }
.todo-item { display: flex; align-items: center; gap: 10px; flex: 1 1 240px; max-width: 100%; padding: 10px 14px; background: #fff; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: all .15s; }
.todo-item:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(37,99,235,.12); transform: translateY(-1px); }
.todo-icon { flex: none; width: 34px; height: 34px; border-radius: 8px; background: #dbeafe; color: #2563eb; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.todo-label { flex: 1; min-width: 0; font-size: 13px; color: #1e293b; overflow-wrap: break-word; }
.todo-count { flex: none; min-width: 28px; padding: 2px 9px; background: #dc2626; color: #fff; border-radius: 12px; font-size: 13px; font-weight: 600; text-align: center; }
.todo-empty { padding: 18px 0; text-align: center; color: #64748b; font-size: 13px; }
@media (max-width: 768px) { .todo-item { flex: 1 1 100%; } }

/* ===== 角色权限管理 ===== */
.role-layout { display: flex; gap: 16px; align-items: stretch; }
.role-list { width: 220px; display: flex; flex-direction: column; gap: 6px; }
.role-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: all .15s; }
.role-card:hover { border-color: var(--primary); background: #eff6ff; }
.role-card.active { background: #2563eb; border-color: #2563eb; color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.25); }
.role-card > i.bi-person-fill { font-size: 18px; color: var(--primary); }
.role-card.active > i.bi-person-fill { color: #fff; }
.role-card-info { flex: 1; min-width: 0; }
.role-card-name { font-size: 14px; font-weight: 600; }
.role-card-code { font-size: 11px; opacity: .7; }
.role-card-arrow { font-size: 12px; }
.role-perm { flex: 1; min-width: 0; }
.role-perm-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.role-perm-title { font-weight: 600; font-size: 14px; color: #1e293b; }
.role-perm-head .btn { margin-left: 6px; }
.perm-tree { border: 1px solid var(--border); border-radius: 8px; padding: 12px; max-height: 520px; overflow-y: auto; background: #fff; }
.perm-group { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px dashed var(--border); }
.perm-group:last-child { border-bottom: none; }
.perm-parent { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; color: #1e293b; cursor: pointer; margin: 6px 0; }
.perm-parent i { color: var(--primary); font-size: 15px; }
.perm-parent input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }
.perm-children { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-left: 24px; }
.perm-child { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #475569; cursor: pointer; }
.perm-child input[type=checkbox] { width: 14px; height: 14px; cursor: pointer; }
.perm-child:hover { color: var(--primary); }
.perm-single { margin: 6px 0; }
.perm-child.perm-func { color: var(--primary); background: #eff6ff; border-radius: 6px; padding: 3px 10px; border: 1px dashed #bfdbfe; }
.role-perm-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #94a3b8; font-size: 14px; gap: 8px; min-height: 300px; }
.role-perm-empty i { font-size: 28px; }
@media (max-width: 768px) { .role-layout { flex-direction: column; } .role-list { width: 100%; flex-direction: row; flex-wrap: wrap; } .role-card { flex: 1; min-width: 140px; } }

/* 关联数据概览等表格的可点击行 */
.link-row { cursor: pointer; transition: background .12s; }
.link-row:hover { background: #eff6ff; }
.link-row:hover td { color: #1d4ed8; }
.link-row td:last-child { color: #94a3b8; }
.link-row:hover td:last-child { color: #2563eb; }
.text-muted { color: #94a3b8; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.fw-bold { font-weight: 600; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }

/* ===== 新增样式（项目核心版） ===== */
.section-title { font-weight: 600; font-size: 15px; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px solid var(--border); }
.section-title i { color: var(--primary); margin-right: 4px; }
.tag-purple { background: #ede9fe; color: #7c3aed; }
.upload-area { border: 2px dashed var(--border); border-radius: 8px; padding: 30px; text-align: center; cursor: pointer; transition: border-color .2s; }
.upload-area:hover { border-color: var(--primary); }

/* v-cloak：Vue 挂载前隐藏 #app 整体，防止脚本加载失败时裸模板/弹窗结构暴露给用户(2026-11-26) */
[v-cloak] { display: none !important; }
