/* =========================================================
   后台管理布局
   ========================================================= */
body.admin { background: #f2f5fa; }

.layout { display: flex; min-height: 100vh; }

/* ---------------- 侧边栏 ---------------- */
.side {
  width: 218px; flex: 0 0 218px;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 60;
}
.side-brand {
  padding: 19px 20px 17px;
  border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 10px;
}
.side-brand .logo {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto;
  background: linear-gradient(135deg, #4f8bf7, #2f6fed 60%, #1f57c9);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; box-shadow: 0 3px 9px rgba(47,111,237,.32);
}
.side-brand .txt { min-width: 0; }
.side-brand .t1 { font-size: 14.5px; font-weight: 700; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-brand .t2 { font-size: 11px; color: var(--muted); letter-spacing: .5px; }

.side-nav { flex: 1; overflow-y: auto; padding: 12px 11px 20px; }
.side-group { font-size: 11px; color: #a9b2c3; font-weight: 600; letter-spacing: .8px; padding: 12px 10px 6px; text-transform: uppercase; }
.side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9.5px 11px; margin-bottom: 2px;
  border-radius: 8px; color: var(--text-2); font-size: 13.8px; font-weight: 500;
  transition: all .14s; text-decoration: none; cursor: pointer;
}
.side-item:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.side-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.side-item .ico { width: 18px; text-align: center; font-size: 15px; flex: 0 0 auto; }
.side-item .cnt { margin-left: auto; font-size: 11px; background: #eef1f7; color: var(--muted); padding: 0 7px; border-radius: 9px; line-height: 17px; }
.side-item.active .cnt { background: rgba(47,111,237,.14); color: var(--primary); }

.side-foot { padding: 12px 14px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--muted); }
.side-user { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.side-user .av {
  width: 31px; height: 31px; border-radius: 50%; flex: 0 0 auto;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px;
}
.side-user .nm { font-size: 13px; color: var(--text); font-weight: 600; line-height: 1.3; }
.side-user .rl { font-size: 11px; color: var(--muted); }

/* ---------------- 主区 ---------------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; flex: 0 0 58px;
  background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px; position: sticky; top: 0; z-index: 50;
}
.topbar h1 { font-size: 16.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .crumb { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-left: 9px; }
.topbar .menu-btn { display: none; }

.content { padding: 22px; flex: 1; }
.content-narrow { max-width: 940px; }

/* 数据集切换 */
.ds-picker { position: relative; }
.ds-picker .btn { gap: 8px; }
.ds-menu {
  position: absolute; right: 0; top: calc(100% + 7px);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); min-width: 250px; padding: 6px; z-index: 200;
  max-height: 340px; overflow-y: auto;
}
.ds-menu a {
  display: flex; align-items: center; gap: 9px; padding: 8px 11px;
  border-radius: 7px; color: var(--text-2); font-size: 13.5px; text-decoration: none;
}
.ds-menu a:hover { background: var(--hover); text-decoration: none; }
.ds-menu a.on { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.ds-menu a .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-menu .sep { height: 1px; background: var(--line-2); margin: 5px 6px; }

/* ---------------- 统计卡 ---------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 17px 19px; box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 14px;
}
.stat .ic {
  width: 42px; height: 42px; border-radius: 11px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 19px;
  background: var(--primary-light); color: var(--primary);
}
.stat .ic.g { background: var(--suc-light); color: var(--suc); }
.stat .ic.o { background: var(--warn-light); color: var(--warn); }
.stat .ic.c { background: var(--info-light); color: var(--info); }
.stat .v { font-size: 22px; font-weight: 700; line-height: 1.2; letter-spacing: -.3px; }
.stat .k { font-size: 12.5px; color: var(--muted); }

/* ---------------- 筛选栏 ---------------- */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--line-2); background: #fcfdff;
}
.filter-bar .input, .filter-bar .select { width: auto; min-width: 148px; }
.filter-bar .search-input { min-width: 230px; flex: 1; max-width: 340px; }

/* ---------------- 统计卡组（带图标底色与悬停动效） ---------------- */
.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 15px 17px; box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 13px;
  transition: transform .18s cubic-bezier(.34,1.4,.64,1), box-shadow .18s, border-color .18s;
  position: relative; overflow: hidden;
}
.stat-card::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,.75) 50%, transparent 62%);
  transform: translateX(-120%); transition: transform .65s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #cfdcf5; }
.stat-card:hover::after { transform: translateX(120%); }
.stat-card .si {
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 19px;
  background: var(--primary-light); color: var(--primary);
  transition: transform .2s cubic-bezier(.34,1.5,.64,1);
}
.stat-card:hover .si { transform: scale(1.08) rotate(-4deg); }
.stat-card .si-blue   { background: #dbeafe; color: #2563eb; }
.stat-card .si-green  { background: #dcfce7; color: #16a34a; }
.stat-card .si-amber  { background: #fef3c7; color: #d97706; }
.stat-card .si-purple { background: #ede9fe; color: #7c3aed; }
.stat-card .si-cyan   { background: #cffafe; color: #0891b2; }
.stat-card .si-red    { background: #fee2e2; color: #dc2626; }
.stat-card b { display: block; font-size: 21px; font-weight: 700; line-height: 1.15; letter-spacing: -.3px; }
.stat-card span { font-size: 12.5px; color: var(--muted); }

/* ---------------- 筛选表单（新） ---------------- */
.filter-form {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  width: 100%; margin: 0;
}
.filter-form .fi {
  position: relative; display: flex; align-items: center;
  min-width: 150px;
}
.filter-form .fi-grow { flex: 1; min-width: 240px; max-width: 420px; }
.filter-form .fi-ico {
  position: absolute; left: 11px; font-size: 13px; opacity: .7; pointer-events: none;
}
.filter-form .fi input {
  width: 100%; height: 36px; padding: 0 12px 0 32px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff;
  font-size: 13.5px; color: var(--text); transition: border-color .16s, box-shadow .16s;
  font-family: inherit;
}
.filter-form .fi input:focus {
  outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring);
}
.filter-form .fi-sel {
  height: 36px; min-width: 132px; padding: 0 30px 0 11px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff;
  font-size: 13.2px; color: var(--text); cursor: pointer;
  font-family: inherit; 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 12 12'%3E%3Cpath fill='%236b7a90' d='M6 8.4 1.6 4h8.8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  transition: border-color .16s, box-shadow .16s;
}
.filter-form .fi-sel:focus {
  outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring);
}

/* ---------------- 分页器 ---------------- */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line-2);
  background: #fcfdff;
}
.pager-info { font-size: 12.8px; color: var(--muted); }
.pager-info b { color: var(--text); }
.pager-btns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pg {
  min-width: 33px; height: 33px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font-size: 13px; color: var(--text-2); text-decoration: none;
  transition: all .15s;
}
.pg:hover {
  border-color: var(--primary); color: var(--primary); text-decoration: none;
  background: var(--primary-soft); transform: translateY(-1px);
}
.pg.active {
  background: var(--brand-grad); border-color: transparent; color: #fff;
  box-shadow: 0 3px 9px rgba(37,99,235,.3); font-weight: 600;
}
.pg.disabled { opacity: .42; pointer-events: none; }

/* ---------------- 通知铃铛 ---------------- */
.bell {
  position: relative; width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
  font-size: 17px; text-decoration: none; transition: all .16s;
  border: 1px solid transparent;
}
.bell:hover { background: var(--primary-light); text-decoration: none; transform: translateY(-1px); }
.bell .dot {
  position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 9px; background: #ef4444; color: #fff;
  font-size: 10.5px; font-weight: 600; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
.bell .dot.blink { animation: dotBlink 1.8s ease-in-out infinite; }
@keyframes dotBlink {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 2px #fff; }
  50%      { transform: scale(1.16); box-shadow: 0 0 0 2px #fff, 0 0 0 6px rgba(239,68,68,.16); }
}

/* ---------------- 通知列表 ---------------- */
.nt-item {
  display: flex; gap: 13px; padding: 15px 20px;
  border-bottom: 1px solid var(--line-2); transition: background .15s;
  position: relative;
}
.nt-item:last-child { border-bottom: 0; }
.nt-item:hover { background: #fbfcff; }
.nt-item.unread { background: linear-gradient(90deg, #eff6ff 0%, #fbfdff 42%, #fff 100%); }
.nt-item.unread::before {
  content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand-grad);
}
.nt-ico {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  background: var(--primary-light); color: var(--primary);
}
.nt-body { flex: 1; min-width: 0; }
.nt-title { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.nt-title .t { font-size: 11.5px; font-weight: 500; color: var(--primary); background: var(--primary-soft); padding: 1px 7px; border-radius: 6px; margin-left: 7px; }
.nt-text { font-size: 13px; color: var(--text-2); line-height: 1.65; }
.nt-meta { font-size: 11.8px; color: var(--muted); margin-top: 5px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.nt-act { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }

/* ---------------- 拖拽排序 ---------------- */
.field-row.dragging { opacity: .42; }
.field-row.over { box-shadow: inset 0 2px 0 var(--primary); }
.drag-handle { cursor: grab; color: #c3cad8; font-size: 15px; user-select: none; }
.drag-handle:active { cursor: grabbing; }

/* ---------------- 导入 ---------------- */
.drop-zone {
  border: 2px dashed #ccd5e5; border-radius: var(--radius-lg);
  padding: 42px 22px; text-align: center; background: #fbfcfe;
  transition: all .18s; cursor: pointer;
}
.drop-zone:hover { border-color: var(--primary); background: var(--primary-soft); }
.drop-zone.over { border-color: var(--primary); background: var(--primary-light); transform: scale(1.005); }
.drop-zone .ic { font-size: 40px; margin-bottom: 10px; opacity: .8; }
.drop-zone .t { font-size: 15px; font-weight: 600; margin-bottom: 5px; }
.drop-zone .d { font-size: 12.8px; color: var(--muted); }

.preview-scroll { max-height: 380px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.preview-scroll table.tb thead th { position: sticky; top: 0; }
.hdr-ok { color: var(--suc); }
.hdr-bad { color: var(--err); }
.hdr-th { position: relative; }
.hdr-th .mk { font-size: 11px; margin-left: 5px; }
.hdr-th.bad { background: #fdf0f0 !important; color: var(--err) !important; }

.map-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line-2); }
.map-row:last-child { border-bottom: 0; }
.map-row .ex { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-row .ar { color: var(--muted); flex: 0 0 auto; }
.map-row .sel { flex: 1; min-width: 0; }

/* ---------------- 移动端 ---------------- */
.side-mask { display: none; }
@media (max-width: 860px) {
  .side {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .side { transform: none; }
  body.nav-open .side-mask {
    display: block; position: fixed; inset: 0; background: rgba(17,24,39,.42); z-index: 55;
  }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 15px; }
  .topbar { padding: 0 15px; }
}

/* ---------------- 登录页 ---------------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1000px 520px at 12% -8%, #e2ecff 0%, transparent 62%),
    radial-gradient(900px 480px at 92% 108%, #dff3ee 0%, transparent 60%),
    #f4f6fb;
}
.login-box { width: 100%; max-width: 396px; }
.login-box .brand { text-align: center; margin-bottom: 24px; }
.login-box .brand .logo {
  width: 54px; height: 54px; margin: 0 auto 13px; border-radius: 15px;
  background: linear-gradient(135deg, #4f8bf7, #2f6fed 60%, #1f57c9);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 25px; font-weight: 700; box-shadow: 0 8px 22px rgba(47,111,237,.32);
}
.login-box .brand h1 { font-size: 20px; margin-bottom: 4px; }
.login-box .brand p { margin: 0; font-size: 13px; color: var(--muted); }
.login-card { padding: 26px 26px 22px; }

/* =========================================================
   侧边栏角标：待处理意见反馈（与通知角标区分开）
   ========================================================= */
.side-item .cnt-warn { background: #fef3c7; color: #b45309; }

/* =========================================================
   企业微信提醒（系统设置页）
   ========================================================= */
.wecom-box {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px 18px; background: linear-gradient(160deg, #f8fbff, #ffffff 70%);
}
.wecom-events { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.wecom-ev {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 20px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; font-size: 12.8px; color: var(--text-2);
  transition: all .16s ease;
}
.wecom-ev:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.wecom-ev input { margin: 0; }
.wecom-ev.on { background: var(--primary-light); border-color: #bfdbfe; color: var(--primary-dark); font-weight: 600; }

/* 统计卡：琥珀色调（待处理反馈） */
.stat .ic.y { background: #fef3c7; color: #b45309; }

/* =========================================================
   登录验证码
   ========================================================= */
.cap-row { display: flex; align-items: center; gap: 12px; }
.cap-row .input { flex: 1; min-width: 0; }
.cap-img {
  height: 42px; width: 132px; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 9px;
  background: #f6faff; cursor: pointer; object-fit: contain;
  transition: transform .16s, box-shadow .16s;
}
.cap-img:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.cap-q {
  height: 42px; flex-shrink: 0; cursor: pointer;
  display: inline-flex; align-items: center; padding: 0 16px;
  border: 1px dashed #c7d8f3; border-radius: 9px;
  background: #f6faff; color: #2563eb;
  font-size: 15px; font-weight: 700; letter-spacing: 1px;
  font-family: var(--mono);
}
.cap-q:hover { border-color: var(--primary); }

/* =========================================================
   后台菜单图标动效（悬停放大 + 选中左侧色条 + 光带扫过）
   ========================================================= */
.side-item {
  position: relative; transition: background .16s, color .16s, transform .14s;
}
.side-item:active { transform: scale(.985); }
.side-item .ico,
.side-item > span:first-child { transition: transform .2s cubic-bezier(.34, 1.5, .64, 1); }
.side-item:hover > span:first-child { transform: scale(1.16) rotate(-5deg); }
.side-item.on::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: linear-gradient(180deg, #2563eb, #0ea5e9);
}
.side-item.on { background: linear-gradient(90deg, #eef4ff, #f7faff 70%); }
/* 选中项扫光 */
.side-item.on::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(37, 99, 235, .1), transparent 70%);
  animation: sideSheen .6s ease;
}
@keyframes sideSheen {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

/* 主按钮点击时的轻微反馈（与小程序端一致的观感） */
.btn-primary, .btn-danger { transition: transform .12s, box-shadow .16s, background .16s; }
.btn-primary:active, .btn-danger:active { transform: scale(.985); }

/* 表格行悬停时把首列文字微微提亮，长表格更好定位 */
table.tb tbody tr:hover td:first-child { color: var(--primary-dark); }

/* =========================================================
   订阅消息：每个事件一行（后台系统设置页）
   ========================================================= */
.sub-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 12px;
  background: linear-gradient(160deg, #f8fbff, #ffffff 70%);
}
.sub-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.sub-row-head .js-test-sub { margin-left: auto; }
