/* ============================================================
   废保保 ERP · 门户设计稿
   设计令牌 + 组件样式（单文件，供所有设计稿页面引用）
   ============================================================ */

:root {
  --brand: #2b5fd9;
  --brand-2: #3d7bf7;
  --brand-soft: #eaf0ff;
  --ink: #101828;
  --ink-2: #344054;
  --ink-3: #667085;
  --ink-4: #98a2b3;
  --line: #e4e7ec;
  --line-2: #f0f2f5;
  --bg: #f4f6fa;
  --card: #ffffff;
  --ok: #12b76a;
  --ok-soft: #e6f7ee;
  --warn: #f79009;
  --warn-soft: #fef4e6;
  --danger: #f04438;
  --danger-soft: #feecea;
  --info: #2e90fa;
  --info-soft: #e8f2fe;
  --side-1: #0f1b33;
  --side-2: #16233f;
  --r: 12px;
  --r-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Inter", -apple-system, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------------- 布局 ---------------- */
.layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: linear-gradient(180deg, var(--side-1) 0%, var(--side-2) 100%);
  color: #c7d2e4;
  display: flex;
  flex-direction: column;
  position: relative;
}

.brand {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: block;
  object-fit: cover;
  flex: 0 0 30px;
  box-shadow: 0 4px 10px rgba(61, 123, 247, .30);
}

.brand-name { color: #fff; font-size: 15px; font-weight: 600; letter-spacing: .5px; }
.brand-sub { font-size: 11px; color: #7d8aa3; margin-top: 1px; }

.menu { flex: 1; overflow: auto; padding: 12px 10px 24px; }
.menu-group { margin-top: 14px; }
.menu-group:first-child { margin-top: 4px; }
.menu-label {
  font-size: 11px; color: #5f6c85; letter-spacing: .8px;
  padding: 0 12px 6px; text-transform: uppercase;
}
.menu-item {
  display: flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 12px; border-radius: 8px;
  font-size: 13.5px; color: #c7d2e4; cursor: pointer;
  position: relative;
}
.menu-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.menu-item.active {
  background: linear-gradient(90deg, rgba(61, 123, 247, .28), rgba(61, 123, 247, .10));
  color: #fff; font-weight: 600;
}
.menu-item.active::before {
  content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-2);
}
.menu-item .ico { width: 18px; height: 18px; flex: 0 0 18px; opacity: .9; }
.menu-item .badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 11px; line-height: 1; padding: 3px 6px; border-radius: 9px;
}

.sidebar-foot {
  padding: 12px 16px 16px; border-top: 1px solid rgba(255, 255, 255, .07);
  font-size: 11.5px; color: #6b7891; display: flex; align-items: center; gap: 8px;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 60px; flex: 0 0 60px;
  background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
}

.crumb { font-size: 13px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.crumb b { color: var(--ink); font-weight: 600; font-size: 15px; }
.crumb .sep { color: var(--ink-4); }

.search {
  margin-left: 8px; width: 300px; height: 34px;
  background: var(--bg); border: 1px solid transparent; border-radius: 8px;
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  color: var(--ink-4); font-size: 13px;
}
.search:focus-within { border-color: var(--brand-2); background: #fff; }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; color: var(--ink-3);
  position: relative; cursor: pointer;
}
.icon-btn:hover { background: var(--bg); }
.icon-btn .dot-red {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--danger); border: 2px solid #fff;
}

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #6ea0ff, var(--brand));
  color: #fff; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.user-chip { display: flex; align-items: center; gap: 8px; padding: 3px 6px 3px 3px; border-radius: 20px; }
.user-chip:hover { background: var(--bg); }
.user-chip .nm { font-size: 13px; color: var(--ink-2); }
.user-chip .dp { font-size: 11px; color: var(--ink-4); }

.content { flex: 1; overflow: auto; padding: 20px 24px 28px; }

/* ---------------- 通用元素 ---------------- */
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 16px; }
.page-title { font-size: 20px; font-weight: 600; letter-spacing: .2px; }
.page-desc { font-size: 13px; color: var(--ink-3); margin-top: 5px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; }

.card {
  background: var(--card); border-radius: var(--r);
  box-shadow: var(--shadow); border: 1px solid rgba(16, 24, 40, .04);
}
.card-hd {
  display: flex; align-items: center; gap: 8px;
  padding: 16px 18px 0;
}
.card-title { font-size: 14.5px; font-weight: 600; }
.card-hd .more { margin-left: auto; font-size: 12.5px; color: var(--brand); cursor: pointer; }
.card-bd { padding: 14px 18px 18px; }

.btn {
  height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 13px; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
}
.btn:hover { border-color: #c9d2e0; }
.btn-primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 1px 2px rgba(43, 95, 217, .3);
}
.btn-primary:hover { background: #2452c4; border-color: #2452c4; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; line-height: 1; white-space: nowrap;
}
.tag-ok { background: var(--ok-soft); color: #067647; }
.tag-warn { background: var(--warn-soft); color: #b54708; }
.tag-danger { background: var(--danger-soft); color: #b42318; }
.tag-info { background: var(--info-soft); color: #175cd3; }
.tag-gray { background: #f2f4f7; color: var(--ink-3); }
.tag-brand { background: var(--brand-soft); color: var(--brand); }

/* 表格 */
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th {
  text-align: left; font-weight: 600; color: var(--ink-3);
  background: #fafbfc; padding: 10px 12px; border-bottom: 1px solid var(--line);
  font-size: 12.5px; white-space: nowrap;
}
table.tb td {
  padding: 12px; border-bottom: 1px solid var(--line-2); color: var(--ink-2);
  vertical-align: middle;
}
table.tb tr:last-child td { border-bottom: none; }
table.tb tbody tr:hover td { background: #fafbff; }

.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user .nm { color: var(--ink); font-weight: 500; }
.cell-user .sub { font-size: 11.5px; color: var(--ink-4); margin-top: 1px; }

/* 工具条 */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.input {
  height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  padding: 0 12px; font-size: 13px; color: var(--ink-2); min-width: 200px;
  display: flex; align-items: center; gap: 8px;
}
.select {
  height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  padding: 0 30px 0 12px; font-size: 13px; color: var(--ink-2);
  display: inline-flex; align-items: center; position: relative;
}
.select::after {
  content: ""; position: absolute; right: 12px; top: 14px;
  border: 4px solid transparent; border-top-color: var(--ink-4);
}

/* 统计卡 */
.stat {
  background: #fff; border-radius: var(--r); padding: 16px 18px;
  box-shadow: var(--shadow); border: 1px solid rgba(16, 24, 40, .04);
  display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden;
}
.stat .k { font-size: 12.5px; color: var(--ink-3); }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.stat .d { font-size: 12px; color: var(--ink-4); }
.stat .delta-up { color: var(--ok); font-weight: 600; }
.stat .delta-down { color: var(--danger); font-weight: 600; }
.stat .glow {
  position: absolute; right: -30px; top: -30px; width: 90px; height: 90px;
  border-radius: 50%; background: var(--brand-soft); opacity: .7;
}

/* 待办行 */
.todo-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px dashed var(--line);
}
.todo-item:last-child { border-bottom: none; }
.todo-ico {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 34px;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.todo-main { flex: 1; min-width: 0; }
.todo-title { font-size: 13.5px; color: var(--ink); font-weight: 500; }
.todo-meta { font-size: 11.5px; color: var(--ink-4); margin-top: 3px; display: flex; gap: 8px; }

/* 应用卡片 */
.app-card {
  background: #fff; border-radius: var(--r); padding: 16px;
  border: 1px solid rgba(16, 24, 40, .05); box-shadow: var(--shadow);
  display: flex; gap: 12px; position: relative; cursor: pointer;
}
.app-card:hover { border-color: #c7d7ff; box-shadow: 0 6px 18px rgba(43, 95, 217, .10); }
.app-ico {
  width: 42px; height: 42px; border-radius: 11px; flex: 0 0 42px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; color: #fff;
}
.app-name { font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.app-desc { font-size: 12px; color: var(--ink-4); margin-top: 4px; line-height: 1.5; }
.app-foot { margin-top: 10px; display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-4); }
.app-badge {
  position: absolute; top: 12px; right: 12px;
  background: var(--danger); color: #fff; font-size: 11px;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.app-card.disabled { opacity: .55; cursor: not-allowed; }

/* 侧栏树 */
.tree { font-size: 13px; }
.tree-item {
  display: flex; align-items: center; gap: 8px; height: 34px;
  padding: 0 10px; border-radius: 7px; color: var(--ink-2); cursor: pointer;
}
.tree-item:hover { background: #f7f9fc; }
.tree-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.tree-item .cnt { margin-left: auto; font-size: 11.5px; color: var(--ink-4); }

/* 分隔与说明 */
.notice {
  display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px;
  background: var(--info-soft); color: #175cd3; font-size: 12.5px; line-height: 1.6;
  border: 1px solid #d3e6ff;
}
.notice b { color: #0b4bc4; }

.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* 进度条 */
.bar { height: 6px; border-radius: 3px; background: #eef1f6; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--brand-2), var(--brand)); }

/* 空状态 */
.empty { text-align: center; padding: 40px 0; color: var(--ink-4); font-size: 13px; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d5dbe6; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
