/* ==========================================================================
   EMS 企业管理系统 - 后台设计系统
   纯手写，零依赖，支持响应式(移动端抽屉侧边栏)
   ========================================================================== */

:root {
  --em-primary: #4e6cf0;
  --em-primary-2: #7a5cf5;
  --em-primary-soft: rgba(78, 108, 240, .1);
  --em-grad: linear-gradient(135deg, #4e6cf0 0%, #7a5cf5 100%);
  --em-grad-2: linear-gradient(135deg, #22d3ee 0%, #4e6cf0 100%);
  --em-success: #10b981;
  --em-warning: #f59e0b;
  --em-danger: #ef4444;
  --em-info: #38bdf8;

  --em-bg: #f4f6fb;
  --em-card: #ffffff;
  --em-text: #1f2740;
  --em-text-2: #5b657f;
  --em-text-3: #98a1b8;
  --em-border: #e8ecf4;
  --em-border-2: #dde3ef;

  --em-radius: 12px;
  --em-radius-sm: 10px;
  --em-shadow: 0 1px 2px rgba(31, 39, 64, .04), 0 8px 24px -12px rgba(31, 39, 64, .12);
  --em-shadow-lg: 0 12px 40px -12px rgba(31, 39, 64, .22);
  --em-sidebar-w: 232px;
  --em-topbar-h: 58px;
  --em-font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --em-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--em-font);
  font-size: 14px;
  color: var(--em-text);
  background: var(--em-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--em-primary); text-decoration: none; }
a:hover { color: var(--em-primary-2); }
h1, h2, h3, h4, p { margin: 0; }
img { max-width: 100%; }
button { font-family: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cdd5e4; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #b6c0d6; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 布局骨架 ============ */
.em-app { display: flex; min-height: 100vh; }

.em-sidebar {
  position: fixed; z-index: 60;
  top: 0; left: 0; bottom: 0;
  width: var(--em-sidebar-w);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #1c2242 0%, #151a30 60%, #12172b 100%);
  color: #aab3d0;
  transition: transform .32s cubic-bezier(.4, 0, .2, 1);
  will-change: transform;
}
.em-sidebar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(560px 200px at -10% -6%, rgba(94, 124, 255, .22), transparent 60%),
              radial-gradient(400px 220px at 110% 108%, rgba(122, 92, 245, .16), transparent 60%);
}
.em-sidebar__brand {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 10px;
  height: var(--em-topbar-h); padding: 0 18px;
  flex: none;
}
.em-sidebar__logo {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--em-grad);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 15px; letter-spacing: .5px;
  box-shadow: 0 6px 16px -6px rgba(94, 124, 255, .9);
}
.em-sidebar__name { color: #f2f5ff; font-size: 15px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.em-sidebar__ver { font-size: 10px; color: #5f6a92; margin-left: auto; flex: none; }

.em-sidebar__nav { position: relative; z-index: 1; flex: 1; overflow-y: auto; padding: 6px 10px 16px; }
.em-sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); }

.em-nav-group { margin-top: 2px; }
.em-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin: 2px 0;
  border-radius: var(--em-radius-sm);
  color: #aab3d0; font-size: 13.5px; cursor: pointer;
  transition: background .2s, color .2s, transform .2s;
  user-select: none; position: relative;
}
.em-nav-item:hover { background: rgba(255, 255, 255, .06); color: #e8ecff; }
.em-nav-item .em-icon { --em-icon-size: 17px; opacity: .9; }
.em-nav-item__arrow { margin-left: auto; width: 14px; height: 14px; opacity: .55; transition: transform .28s cubic-bezier(.4, 0, .2, 1); }
.em-nav-group.is-open > .em-nav-item .em-nav-item__arrow { transform: rotate(180deg); }

.em-nav-sub { overflow: hidden; max-height: 0; transition: max-height .34s cubic-bezier(.4, 0, .2, 1); }
.em-nav-sub__inner { padding: 2px 0 4px 0; }
.em-nav-sub a {
  display: block; position: relative;
  padding: 8px 12px 8px 42px; margin: 1px 0;
  font-size: 13px; color: #99a3c4; border-radius: 8px;
  transition: background .2s, color .2s;
}
.em-nav-sub a::before {
  content: ""; position: absolute; left: 27px; top: 50%;
  width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%;
  background: currentColor; opacity: .35; transition: opacity .2s, transform .2s;
}
.em-nav-sub a:hover { background: rgba(255, 255, 255, .05); color: #dfe5ff; }
.em-nav-sub a.is-active { color: #fff; background: rgba(94, 124, 255, .18); }
.em-nav-sub a.is-active::before { opacity: 1; background: #7f9bff; box-shadow: 0 0 8px #7f9bff; transform: scale(1.15); }

.em-nav-item.is-active {
  color: #fff; background: linear-gradient(135deg, rgba(78, 108, 240, .95), rgba(122, 92, 245, .9));
  box-shadow: 0 10px 22px -12px rgba(94, 124, 255, .95);
}
.em-nav-item.is-active::before {
  content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 3px; background: #9db2ff;
}

.em-sidebar__foot {
  position: relative; z-index: 1;
  padding: 12px 16px; flex: none;
  font-size: 11px; color: #5b6690;
  border-top: 1px solid rgba(255, 255, 255, .05);
  display: flex; align-items: center; justify-content: space-between;
}

.em-mask {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(15, 20, 40, .45); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s;
}
body.em-drawer-open .em-mask { opacity: 1; visibility: visible; }

.em-main {
  flex: 1; min-width: 0; margin-left: var(--em-sidebar-w);
  display: flex; flex-direction: column; min-height: 100vh;
}

/* ============ 顶栏 ============ */
.em-topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--em-topbar-h); flex: none;
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--em-border);
}
.em-burger {
  display: none; width: 36px; height: 36px; border: 1px solid var(--em-border);
  background: #fff; border-radius: 10px; color: var(--em-text-2);
  align-items: center; justify-content: center; cursor: pointer; transition: all .2s;
}
.em-burger:hover { color: var(--em-primary); border-color: #c9d4f8; }
.em-topbar__title { font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.em-topbar__sub { font-size: 12px; color: var(--em-text-3); margin-left: 2px; }
.em-topbar__spacer { flex: 1; }

.em-topbar__actions { display: flex; align-items: center; gap: 8px; }
.em-iconbtn {
  position: relative; width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--em-text-2);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .2s, color .2s, transform .2s;
}
.em-iconbtn:hover { background: var(--em-primary-soft); color: var(--em-primary); }
.em-iconbtn:active { transform: scale(.94); }
.em-iconbtn .em-badge {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--em-danger); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center; font-weight: 700;
  box-shadow: 0 0 0 2px #fff;
  animation: em-pop .4s cubic-bezier(.34, 1.56, .64, 1) both;
}

.em-usermenu { position: relative; }
.em-usermenu__trigger {
  display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px;
  border-radius: 999px; border: 1px solid var(--em-border); background: #fff;
  cursor: pointer; transition: box-shadow .2s, border-color .2s;
}
.em-usermenu__trigger:hover { border-color: #c9d4f8; box-shadow: var(--em-shadow); }
.em-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none; overflow: hidden;
  background: var(--em-grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.em-avatar--lg { width: 56px; height: 56px; font-size: 20px; }
.em-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.em-usermenu__name { font-size: 13px; font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.em-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 176px;
  background: #fff; border: 1px solid var(--em-border); border-radius: var(--em-radius);
  box-shadow: var(--em-shadow-lg); padding: 6px;
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.98);
  transform-origin: top right; transition: all .22s cubic-bezier(.4, 0, .2, 1); z-index: 70;
}
.em-dropdown.is-open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.em-dropdown a, .em-dropdown button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 10px; border: 0; background: none; border-radius: 8px;
  font-size: 13px; color: var(--em-text-2); cursor: pointer; text-align: left; transition: background .18s, color .18s;
}
.em-dropdown a:hover, .em-dropdown button:hover { background: var(--em-primary-soft); color: var(--em-primary); }
.em-dropdown .em-dropdown__divider { height: 1px; margin: 5px 4px; background: var(--em-border); }
.em-dropdown__meta { padding: 8px 10px 6px; font-size: 12px; color: var(--em-text-3); }

/* ============ 内容区 ============ */
.em-content { flex: 1; padding: 20px; animation: em-fade-up .45s ease both; }

.em-page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.em-page-head__title { font-size: 20px; font-weight: 800; letter-spacing: .2px; }
.em-page-head__sub { font-size: 12.5px; color: var(--em-text-3); margin-top: 3px; }
.em-page-head__btns { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ 卡片 ============ */
.em-card {
  background: var(--em-card); border: 1px solid var(--em-border);
  border-radius: var(--em-radius); box-shadow: var(--em-shadow);
  transition: box-shadow .3s, transform .3s, border-color .3s;
}
.em-card--hover:hover { transform: translateY(-3px); box-shadow: var(--em-shadow-lg); border-color: #dfe6fb; }
.em-card__head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--em-border);
}
.em-card__title { font-size: 14.5px; font-weight: 700; }
.em-card__title .em-icon { color: var(--em-primary); margin-right: 6px; }
.em-card__extra { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.em-card__body { padding: 18px; }
.em-card__body--flush { padding: 0; }

/* 统计卡片 */
.em-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.em-stat { padding: 18px; display: flex; gap: 14px; align-items: center; position: relative; overflow: hidden; }
.em-stat::after {
  content: ""; position: absolute; right: -26px; top: -26px; width: 96px; height: 96px;
  border-radius: 50%; background: var(--em-primary-soft); transition: transform .45s cubic-bezier(.4, 0, .2, 1);
}
.em-stat:hover::after { transform: scale(1.5); }
.em-stat__icon {
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  display: flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: 0 10px 20px -10px rgba(31, 39, 64, .5);
}
.em-stat__icon .em-icon { --em-icon-size: 22px; }
.em-stat__icon--a { background: var(--em-grad); }
.em-stat__icon--b { background: linear-gradient(135deg, #10b981, #34d399); }
.em-stat__icon--c { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.em-stat__icon--d { background: linear-gradient(135deg, #38bdf8, #22d3ee); }
.em-stat__num { font-size: 24px; font-weight: 800; letter-spacing: .3px; font-variant-numeric: tabular-nums; }
.em-stat__label { font-size: 12.5px; color: var(--em-text-3); margin-top: 2px; }
.em-stat__trend { font-size: 11.5px; margin-top: 4px; color: var(--em-text-2); }
.em-stat__trend em { font-style: normal; font-weight: 700; }
.em-stat__trend .up { color: var(--em-success); }
.em-stat__trend .down { color: var(--em-danger); }

.em-grid { display: grid; gap: 14px; margin-bottom: 16px; }
.em-grid--2 { grid-template-columns: 1fr 1fr; }
.em-grid--21 { grid-template-columns: 1.6fr 1fr; }
.em-grid--12 { grid-template-columns: 1fr 1.6fr; }
.em-grid--4 { grid-template-columns: repeat(4, 1fr); }
.em-grid--3 { grid-template-columns: repeat(3, 1fr); }

/* ============ 按钮 ============ */
.em-btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 15px; border-radius: 10px;
  border: 1px solid var(--em-border-2); background: #fff; color: var(--em-text-2);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .2s; white-space: nowrap; user-select: none;
}
.em-btn:hover { color: var(--em-primary); border-color: #c3cffa; background: #fbfcff; box-shadow: 0 4px 14px -8px rgba(78, 108, 240, .5); }
.em-btn:active { transform: translateY(1px); }
.em-btn .em-icon { --em-icon-size: 15px; }
.em-btn--primary { background: var(--em-grad); border-color: transparent; color: #fff; box-shadow: 0 8px 18px -8px rgba(78, 108, 240, .8); }
.em-btn--primary:hover { color: #fff; filter: brightness(1.06); box-shadow: 0 12px 24px -10px rgba(78, 108, 240, .9); }
.em-btn--danger { color: var(--em-danger); border-color: #fecaca; }
.em-btn--danger:hover { color: #fff; background: var(--em-danger); border-color: var(--em-danger); box-shadow: 0 8px 18px -8px rgba(239, 68, 68, .8); }
.em-btn--ghost { border-color: transparent; background: transparent; }
.em-btn--ghost:hover { background: var(--em-primary-soft); box-shadow: none; }
.em-btn--sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.em-btn--xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.em-btn--block { width: 100%; }
.em-btn--lg { height: 44px; padding: 0 22px; font-size: 14px; border-radius: 12px; }
.em-btn[disabled] { opacity: .55; cursor: not-allowed; pointer-events: none; }

/* ============ 表单 ============ */
.em-form-item { margin-bottom: 16px; }
.em-form-item__label { display: block; font-size: 13px; font-weight: 600; color: var(--em-text-2); margin-bottom: 7px; }
.em-form-item__label .em-req { color: var(--em-danger); margin-left: 2px; }
.em-input, .em-select, .em-textarea {
  width: 100%; min-height: 38px; padding: 8px 12px;
  border: 1px solid var(--em-border-2); border-radius: 10px;
  background: #fff; color: var(--em-text); font-size: 13.5px; font-family: inherit;
  transition: border-color .2s, box-shadow .2s, background .2s;
  outline: none;
}
.em-input::placeholder, .em-textarea::placeholder { color: #b3bbcf; }
.em-input:hover, .em-select:hover, .em-textarea:hover { border-color: #c3cffa; }
.em-input:focus, .em-select:focus, .em-textarea:focus {
  border-color: var(--em-primary);
  box-shadow: 0 0 0 3.5px rgba(78, 108, 240, .14);
  background: #fdfdff;
}
.em-textarea { min-height: 88px; resize: vertical; line-height: 1.6; }
.em-select { appearance: none; background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2398a1b8' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.em-input--error, .em-input--error:focus { border-color: var(--em-danger); box-shadow: 0 0 0 3.5px rgba(239, 68, 68, .12); }
.em-form-item__help { font-size: 12px; color: var(--em-text-3); margin-top: 6px; line-height: 1.6; }
.em-form-item__error { font-size: 12px; color: var(--em-danger); margin-top: 6px; display: none; }
.em-form-item.has-error .em-form-item__error { display: block; animation: em-fade-up .25s ease both; }

.em-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.em-form-grid--3 { grid-template-columns: 1fr 1fr 1fr; }
.em-form-grid .em-col-span-2 { grid-column: span 2; }

/* 开关 */
.em-switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.em-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.em-switch__track {
  width: 40px; height: 22px; border-radius: 999px; background: #d5dbe8; position: relative;
  transition: background .25s; flex: none;
}
.em-switch__track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(31, 39, 64, .3);
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}
.em-switch input:checked + .em-switch__track { background: var(--em-grad); }
.em-switch input:checked + .em-switch__track::after { transform: translateX(18px); }
.em-switch__text { font-size: 13px; color: var(--em-text-2); }

.em-check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--em-text-2); cursor: pointer; user-select: none; }
.em-check input { width: 16px; height: 16px; accent-color: var(--em-primary); cursor: pointer; }

/* 搜索工具栏 */
.em-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--em-border); }
.em-toolbar .em-input, .em-toolbar .em-select { width: auto; min-width: 150px; height: 34px; min-height: 34px; }
.em-toolbar__spacer { flex: 1; }
.em-search { position: relative; }
.em-search .em-input { padding-left: 34px; }
.em-search .em-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--em-text-3); --em-icon-size: 15px; }

/* ============ 表格 ============ */
.em-table-wrap { overflow-x: auto; border-radius: 0 0 var(--em-radius) var(--em-radius); }
.em-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; min-width: 720px; }
.em-table th {
  position: sticky; top: 0; z-index: 2;
  background: #f8fafd; color: var(--em-text-2);
  font-size: 12.5px; font-weight: 700; text-align: left;
  padding: 11px 14px; border-bottom: 1px solid var(--em-border); white-space: nowrap;
}
.em-table td { padding: 12px 14px; border-bottom: 1px solid var(--em-border); color: var(--em-text); vertical-align: middle; }
.em-table tbody tr { transition: background .16s; }
.em-table tbody tr:hover { background: #f8faff; }
.em-table tbody tr:last-child td { border-bottom: 0; }
.em-table .em-td-actions { white-space: nowrap; }
.em-table .em-td-actions .em-btn { margin-right: 4px; }
.em-table__main { font-weight: 600; }
.em-table__sub { font-size: 12px; color: var(--em-text-3); margin-top: 2px; }
.em-table td.em-num, .em-table th.em-num { font-variant-numeric: tabular-nums; }
.em-table .em-mono { font-family: var(--em-mono); font-size: 12.5px; color: var(--em-text-2); }

.em-empty { padding: 54px 20px; text-align: center; color: var(--em-text-3); }
.em-empty .em-icon { --em-icon-size: 40px; color: #d4dbeb; display: block; margin: 0 auto 12px; }
.em-empty__text { font-size: 13px; }

/* 分页 */
.em-pagination { padding: 14px 18px; display: flex; justify-content: flex-end; }
.pagination { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.pagination li a, .pagination li span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid var(--em-border-2); border-radius: 9px;
  background: #fff; color: var(--em-text-2); font-size: 13px;
  transition: all .18s; cursor: pointer;
}
.pagination li a:hover { border-color: #c3cffa; color: var(--em-primary); box-shadow: 0 4px 12px -6px rgba(78, 108, 240, .5); }
.pagination li.active span { background: var(--em-grad); border-color: transparent; color: #fff; box-shadow: 0 6px 14px -6px rgba(78, 108, 240, .8); }
.pagination li.disabled span { color: #c2c9da; cursor: not-allowed; }

/* ============ 徽标 / 标签 ============ */
.em-tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1;
  background: var(--em-primary-soft); color: var(--em-primary);
  white-space: nowrap;
}
.em-tag .em-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.em-tag--success { background: rgba(16, 185, 129, .12); color: #059669; }
.em-tag--warning { background: rgba(245, 158, 11, .14); color: #b45309; }
.em-tag--danger { background: rgba(239, 68, 68, .12); color: #dc2626; }
.em-tag--info { background: rgba(56, 189, 248, .14); color: #0284c7; }
.em-tag--muted { background: #eef1f8; color: var(--em-text-3); }
.em-tag--purple { background: rgba(122, 92, 245, .12); color: #6d4de0; }

/* ============ 模态框 ============ */
.em-modal-layer {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(15, 20, 40, .48); backdrop-filter: blur(3px);
  animation: em-fade .22s ease both;
}
.em-modal-layer.em-closing { animation: em-fade-out .2s ease both; }
.em-modal {
  width: 100%; max-width: 560px; max-height: calc(100vh - 60px);
  background: #fff; border-radius: 16px; display: flex; flex-direction: column;
  box-shadow: 0 24px 70px -20px rgba(15, 20, 40, .5);
  animation: em-modal-in .34s cubic-bezier(.34, 1.3, .64, 1) both;
}
.em-modal-layer.em-closing .em-modal { animation: em-modal-out .2s ease both; }
.em-modal--lg { max-width: 780px; }
.em-modal--xl { max-width: 1000px; }
.em-modal--sm { max-width: 420px; }
.em-modal__head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--em-border); flex: none;
}
.em-modal__title { font-size: 15px; font-weight: 700; }
.em-modal__close {
  margin-left: auto; width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: transparent; color: var(--em-text-3); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .2s;
}
.em-modal__close:hover { background: #fee2e2; color: var(--em-danger); }
.em-modal__body { padding: 20px; overflow-y: auto; flex: 1; }
.em-modal__foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--em-border); flex: none;
}

/* ============ 吐司 ============ */
#emToastRoot { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.em-toast {
  display: flex; align-items: center; gap: 9px;
  min-width: 220px; max-width: 360px; padding: 11px 15px;
  background: #fff; border: 1px solid var(--em-border); border-radius: 12px;
  box-shadow: var(--em-shadow-lg); font-size: 13.5px; color: var(--em-text);
  animation: em-toast-in .34s cubic-bezier(.34, 1.3, .64, 1) both;
  pointer-events: auto;
}
.em-toast.em-out { animation: em-toast-out .26s ease both; }
.em-toast__icon { --em-icon-size: 17px; flex: none; }
.em-toast--success .em-toast__icon { color: var(--em-success); }
.em-toast--error .em-toast__icon { color: var(--em-danger); }
.em-toast--info .em-toast__icon { color: var(--em-primary); }
.em-toast--warning .em-toast__icon { color: var(--em-warning); }

/* ============ 杂项 ============ */
.em-flex { display: flex; align-items: center; gap: 8px; }
.em-flex-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.em-text-2 { color: var(--em-text-2); }
.em-text-3 { color: var(--em-text-3); }
.em-text-sm { font-size: 12.5px; }
.em-text-xs { font-size: 12px; }
.em-text-danger { color: var(--em-danger); }
.em-text-success { color: var(--em-success); }
.em-text-warning { color: var(--em-warning); }
.em-text-primary { color: var(--em-primary); }
.em-bold { font-weight: 700; }
.em-mt-0 { margin-top: 0; } .em-mt-8 { margin-top: 8px; } .em-mt-12 { margin-top: 12px; } .em-mt-16 { margin-top: 16px; } .em-mt-20 { margin-top: 20px; }
.em-mb-0 { margin-bottom: 0; } .em-mb-8 { margin-bottom: 8px; } .em-mb-12 { margin-bottom: 12px; } .em-mb-16 { margin-bottom: 16px; }
.em-w-100 { width: 100%; }
.em-nowrap { white-space: nowrap; }
.em-hr { height: 1px; border: 0; background: var(--em-border); margin: 16px 0; }

.em-skeleton {
  border-radius: 8px; background: linear-gradient(90deg, #eef1f8 25%, #f6f8fd 48%, #eef1f8 62%);
  background-size: 400% 100%; animation: em-shimmer 1.3s ease infinite;
}

.em-spin { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; animation: em-rotate .7s linear infinite; }
.em-spin--dark { border-color: rgba(78,108,240,.25); border-top-color: var(--em-primary); }

/* 图表容器 */
.em-chart { position: relative; width: 100%; }
.em-chart canvas { display: block; width: 100%; }
.em-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 0 4px; }
.em-legend__item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--em-text-2); }
.em-legend__dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.em-legend__val { font-weight: 700; color: var(--em-text); font-variant-numeric: tabular-nums; }

/* 步进条(审批流展示) */
.em-steps { display: flex; flex-direction: column; gap: 0; }
.em-step { position: relative; display: flex; gap: 12px; padding-bottom: 18px; }
.em-step:last-child { padding-bottom: 0; }
.em-step::before {
  content: ""; position: absolute; left: 13px; top: 26px; bottom: 0; width: 2px;
  background: var(--em-border-2);
}
.em-step:last-child::before { display: none; }
.em-step__dot {
  width: 28px; height: 28px; border-radius: 50%; flex: none; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  background: #eef1f8; color: var(--em-text-3); font-size: 12px; font-weight: 700;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--em-border);
}
.em-step--done .em-step__dot { background: var(--em-grad); color: #fff; box-shadow: 0 6px 12px -6px rgba(78,108,240,.9); }
.em-step--active .em-step__dot { background: #fff; color: var(--em-primary); box-shadow: 0 0 0 2px var(--em-primary); animation: em-pulse 1.8s ease infinite; }
.em-step__title { font-size: 13.5px; font-weight: 600; }
.em-step__meta { font-size: 12px; color: var(--em-text-3); margin-top: 3px; line-height: 1.6; }

/* ============ 动画 ============ */
@keyframes em-fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes em-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes em-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes em-pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
@keyframes em-modal-in { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes em-modal-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes em-toast-in { from { opacity: 0; transform: translateX(40px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes em-toast-out { from { opacity: 1; } to { opacity: 0; transform: translateX(30px); } }
@keyframes em-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@keyframes em-rotate { to { transform: rotate(360deg); } }
@keyframes em-pulse { 0%, 100% { box-shadow: 0 0 0 2px rgba(78,108,240,.55); } 50% { box-shadow: 0 0 0 6px rgba(78,108,240,.16); } }
@keyframes em-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes em-blob { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(28px, -22px) scale(1.08); } 66% { transform: translate(-20px, 16px) scale(.95); } }

.em-delay-1 { animation-delay: .05s; } .em-delay-2 { animation-delay: .1s; } .em-delay-3 { animation-delay: .15s; } .em-delay-4 { animation-delay: .2s; }
.em-anim-up { animation: em-fade-up .5s ease both; }
.em-anim-pop { animation: em-pop .45s cubic-bezier(.34, 1.56, .64, 1) both; }

/* 数字滚动 */
.em-countup { font-variant-numeric: tabular-nums; }

/* ============ 响应式 ============ */
@media (max-width: 1200px) {
  .em-stats { grid-template-columns: repeat(2, 1fr); }
  .em-grid--21, .em-grid--12 { grid-template-columns: 1fr; }
  .em-grid--4 { grid-template-columns: repeat(2, 1fr); }
  .em-grid--3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 960px) {
  .em-sidebar { transform: translateX(-102%); box-shadow: none; }
  body.em-drawer-open .em-sidebar { transform: translateX(0); box-shadow: 30px 0 80px -30px rgba(15, 20, 40, .6); }
  .em-main { margin-left: 0; }
  .em-burger { display: flex; }
  .em-grid--2, .em-grid--3, .em-form-grid, .em-form-grid--3 { grid-template-columns: 1fr; }
  .em-form-grid .em-col-span-2 { grid-column: auto; }
  .em-content { padding: 14px; }
  .em-topbar { padding: 0 12px; }
  .em-topbar__sub { display: none; }
}
@media (max-width: 640px) {
  .em-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .em-stat { padding: 14px; gap: 10px; }
  .em-stat__icon { width: 38px; height: 38px; border-radius: 11px; }
  .em-stat__num { font-size: 19px; }
  .em-page-head__title { font-size: 17px; }
  .em-toolbar { padding: 12px; }
  .em-toolbar .em-input, .em-toolbar .em-select { flex: 1; min-width: 0; }
  .em-modal__body { padding: 16px; }
  #emToastRoot { left: 12px; right: 12px; top: 12px; }
  .em-toast { max-width: none; }
}
