/* ============================================================
   分系统框架样式（CRM / PSI）—— 渐变风格
   仅作用于 body.subsys，不影响 admin 后台
   ============================================================ */
.admin.subsys {
  --brand-1: #0ea5e9;
  --brand-2: #14b8a6;
  --brand-3: #6366f1;
  --ss-side-1: #0f2a44;
  --ss-side-2: #134e6f;
  --ss-side-3: #0e7490;
  --ink: #0f2a44;
  --muted: #5b7187;
  display: flex;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(20,184,166,.10), transparent 60%),
    radial-gradient(1000px 500px at -10% 110%, rgba(14,165,233,.12), transparent 55%),
    linear-gradient(135deg, #eef4ff 0%, #f6fbff 45%, #eafaf6 100%);
  color: var(--ink);
}

/* ---------- 侧边栏 ---------- */
.ss-side {
  width: 246px;
  flex: 0 0 246px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, var(--ss-side-1) 0%, var(--ss-side-2) 55%, var(--ss-side-3) 100%);
  color: #dbeafe;
  box-shadow: 6px 0 28px rgba(15,42,68,.22);
  z-index: 30;
}
.ss-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px;
  color: #fff; text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.ss-brand-ic {
  display: inline-flex; width: 40px; height: 40px; flex: 0 0 40px;
  align-items: center; justify-content: center; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  color: #fff; box-shadow: 0 6px 16px rgba(14,165,233,.35);
}
.ss-brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.ss-brand-text b { font-size: 16px; font-weight: 700; }
.ss-brand-text small { font-size: 11px; color: #93c5d9; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ss-nav { flex: 1; padding: 14px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.ss-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px;
  color: #cfe3f3; text-decoration: none; font-size: 14px; font-weight: 500;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.ss-nav-item:hover { background: rgba(255,255,255,.10); color: #fff; transform: translateX(2px); }
.ss-nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(14,165,233,.95), rgba(20,184,166,.95));
  box-shadow: 0 8px 18px rgba(14,165,233,.35);
}
.ss-ic { display: inline-flex; width: 22px; height: 22px; flex: 0 0 22px; align-items: center; justify-content: center; }
.ss-label { white-space: nowrap; }

.ss-side-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.10); }
.ss-foot-link { display: flex; align-items: center; gap: 8px; color: #93c5d9; text-decoration: none; font-size: 13px; }
.ss-foot-link:hover { color: #fff; }

/* ---------- 主体 ---------- */
.ss-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ss-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 24px;
  background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(240,248,255,.92));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(15,42,68,.08);
  box-shadow: 0 4px 18px rgba(15,42,68,.06);
}
.ss-top-left { display: flex; align-items: center; gap: 12px; }
.ss-crumb { font-weight: 700; font-size: 15px; color: var(--ink); }
.menu-toggle { display: none; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid rgba(15,42,68,.12); border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; }
.ss-user { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ss-user-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.ss-avatar { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 50%; background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); color: #fff; }

/* ---------- 内容区 ---------- */
.ss-content { padding: 26px 28px 40px; }
body.subsys .page-head h1 { font-size: 22px; margin: 0 0 4px; }
body.subsys .page-head .sub { color: var(--muted); margin: 0 0 18px; }

/* 统计卡 */
body.subsys .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 22px; }
body.subsys .stat-card {
  position: relative; overflow: hidden;
  padding: 20px 22px; border-radius: 16px; background: #fff;
  border: 1px solid rgba(15,42,68,.07);
  box-shadow: 0 10px 26px rgba(15,42,68,.07);
}
body.subsys .stat-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: linear-gradient(180deg, var(--brand-1), var(--brand-2));
}
body.subsys .stat-card .stat-num { font-size: 28px; font-weight: 800; background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
body.subsys .stat-card .stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* 快捷入口 */
body.subsys .quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
body.subsys .qa-card {
  display: flex; flex-direction: column; gap: 2px; text-decoration: none;
  padding: 16px 18px; border-radius: 14px; background: #fff;
  border: 1px solid rgba(15,42,68,.07);
  box-shadow: 0 8px 20px rgba(15,42,68,.06);
  transition: transform .18s ease, box-shadow .18s ease;
}
body.subsys .qa-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(14,165,233,.18); }
body.subsys .qa-ico { font-size: 20px; }
body.subsys .qa-t { font-weight: 700; color: var(--ink); }
body.subsys .qa-d { font-size: 12px; color: var(--muted); }

/* 面板 */
body.subsys .panel {
  background: #fff; border-radius: 16px; padding: 18px 20px; margin-bottom: 20px;
  border: 1px solid rgba(15,42,68,.07); box-shadow: 0 10px 26px rgba(15,42,68,.07);
}
body.subsys .panel h3 { margin: 0 0 12px; font-size: 16px; }
body.subsys .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { body.subsys .two-col { grid-template-columns: 1fr; } }

/* ============ 渐变表格（行 / 列） ============ */
body.subsys .tbl {
  width: 100%; border-collapse: separate; border-spacing: 0;
  border: 0; border-radius: 14px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(15,42,68,.10);
  /* 列渐变：整表左→右的轻微底色过渡 */
  background: linear-gradient(100deg, #eef6ff 0%, #ffffff 45%, #ecfbf6 100%);
}
body.subsys .tbl thead th {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  color: #fff; font-weight: 600; text-align: left; padding: 12px 14px;
  border: 0; white-space: nowrap;
}
body.subsys .tbl tbody td { padding: 11px 14px; border-top: 1px solid rgba(15,42,68,.06); color: var(--ink); }
/* 行渐变：斑马行 + 悬停行 */
body.subsys .tbl tbody tr:nth-child(odd) td { background: linear-gradient(90deg, rgba(14,165,233,.07), rgba(20,184,166,.03)); }
body.subsys .tbl tbody tr:nth-child(even) td { background: rgba(255,255,255,.55); }
body.subsys .tbl tbody tr:hover td { background: linear-gradient(90deg, rgba(14,165,233,.18), rgba(20,184,166,.10)); }
body.subsys .tbl tbody tr:first-child td { border-top: 0; }

/* ---------- 按钮 / 徽标 / 提示 ---------- */
body.subsys .btn-soft {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 10px; font-size: 13px; font-weight: 600;
  text-decoration: none; color: var(--ink);
  background: #fff; border: 1px solid rgba(15,42,68,.12);
  transition: background .15s ease, transform .15s ease;
}
body.subsys .btn-soft:hover { background: linear-gradient(135deg, rgba(14,165,233,.12), rgba(20,184,166,.12)); transform: translateY(-1px); }
body.subsys .btn-soft.btn-sm { padding: 6px 10px; font-size: 12px; }
body.subsys .btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); color: #fff;
  text-decoration: none; font-weight: 600; border: 0; cursor: pointer;
  box-shadow: 0 8px 18px rgba(14,165,233,.28);
}
body.subsys .btn:hover { filter: brightness(1.05); }
body.subsys .btn-sm { padding: 6px 11px; font-size: 12px; }
body.subsys .btn-ok {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px;
  background: linear-gradient(135deg, #10b981, #14b8a6); color: #fff; font-weight: 600; border: 0; cursor: pointer;
  box-shadow: 0 8px 18px rgba(16,185,129,.28);
}
body.subsys .btn-ok:hover { filter: brightness(1.05); }
body.subsys .row-actions a { color: var(--brand-1); text-decoration: none; font-weight: 600; margin-right: 10px; }

/* 看板图标 + 报表卡片主体 */
body.subsys .stat-ic { width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(14,165,233,.16), rgba(20,184,166,.12)); color: var(--brand-1); margin-bottom: 8px; }
body.subsys .stat-main { display: flex; flex-direction: column; }
body.subsys .stat-main .stat-num { font-size: 20px; font-weight: 800; color: var(--ink); margin: 2px 0; }
body.subsys .stat-sub { color: var(--muted); font-size: 13px; }
body.subsys .stat-card { text-decoration: none; color: inherit; }

/* 状态小标签配色 */
body.subsys .tag-mini.tag-gray { background: rgba(100,116,139,.16); color: #475569; }
body.subsys .tag-mini.tag-amber { background: rgba(245,158,11,.16); color: #b45309; }
body.subsys .tag-mini.tag-green { background: rgba(16,185,129,.16); color: #047857; }
body.subsys .tag-mini.tag-red   { background: rgba(239,68,68,.16); color: #b91c1c; }

.role-badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.role-super_admin, .role-admin { background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); color: #fff; }
.role-user, .role-none { background: rgba(15,42,68,.08); color: var(--muted); }

body.subsys .alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; }
body.subsys .alert-ok { background: linear-gradient(135deg, rgba(16,185,129,.15), rgba(20,184,166,.12)); color: #047857; }
body.subsys .alert-err { background: linear-gradient(135deg, rgba(239,68,68,.15), rgba(244,114,114,.12)); color: #b91c1c; }
body.subsys .muted { color: var(--muted); }

/* ---------- 响应式：侧栏抽屉 ---------- */
@media (max-width: 900px) {
  .admin.subsys { display: block; }
  .ss-side { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s ease; }
  body.nav-open .ss-side { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .ss-body { display: block; }
  .ss-content { padding: 18px 16px 36px; }
}

/* ---------- 用户管理页面 ---------- */
body.subsys .panel-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
body.subsys .panel-bar h3 { margin: 0; }
body.subsys .table-wrap { overflow-x: auto; }
body.subsys .tbl .perm-cell { line-height: 1.9; }
body.subsys .perm-chip {
  display: inline-block; margin: 0 4px 2px 0; padding: 2px 9px; border-radius: 999px; font-size: 12px;
  background: rgba(14,165,233,.12); color: #0e7490; border: 1px solid rgba(14,165,233,.20);
}
body.subsys .st { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
body.subsys .st-on { background: rgba(16,185,129,.14); color: #047857; }
body.subsys .st-off { background: rgba(100,116,139,.14); color: #475569; }
body.subsys .inline-form { display: inline; }
body.subsys .link-danger { background: none; border: 0; padding: 0; color: #dc2626; font-weight: 600; cursor: pointer; font-size: 14px; }
body.subsys .link-danger:hover { text-decoration: underline; }
body.subsys .link-ok { background: none; border: 0; padding: 0; color: #047857; font-weight: 600; cursor: pointer; font-size: 14px; }
body.subsys .link-ok:hover { text-decoration: underline; }
body.subsys .btn-ghost { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px; border: 1px solid rgba(15,42,68,.16); background: #fff; color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; }
body.subsys .btn-ghost:hover { border-color: rgba(15,42,68,.32); }

/* ---------- 表单 ---------- */
body.subsys .form-card { max-width: 760px; }
body.subsys .form-row { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
body.subsys .form-row > label { font-weight: 600; font-size: 13px; color: var(--ink); }
body.subsys .form-row input[type="text"],
body.subsys .form-row input[type="password"],
body.subsys .form-row select,
body.subsys .form-row textarea {
  padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(15,42,68,.14); background: #fff; color: var(--ink); font-size: 14px;
}
body.subsys .form-row input[readonly] { background: #f1f5f9; color: var(--muted); }
body.subsys .form-row small { color: var(--muted); font-size: 12px; }
body.subsys .req { color: #dc2626; }
body.subsys .radio-row { display: flex; flex-wrap: wrap; gap: 18px; }
body.subsys .radio, body.subsys .check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); cursor: pointer; }
body.subsys .perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 14px; padding: 10px 12px; border-radius: 10px; background: rgba(15,42,68,.04); border: 1px solid rgba(15,42,68,.08); }
body.subsys .perm-grid .check { font-weight: 500; }
body.subsys .form-actions { display: flex; gap: 12px; align-items: center; margin-top: 6px; }

/* ---------- 顶栏铃铛 + 未读徽标 ---------- */
body.subsys .ss-bell {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; text-decoration: none; font-size: 18px;
  background: rgba(15,42,68,.05); color: var(--ink); margin-left: 10px;
}
body.subsys .ss-bell:hover { background: rgba(14,165,233,.14); }
body.subsys .ss-badge {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 2px 6px rgba(220,38,38,.45);
}

/* ---------- 页面头 ---------- */
body.subsys .page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
body.subsys .page-head h2 { margin: 0; font-size: 20px; }
body.subsys .page-head .muted { margin: 4px 0 0; font-size: 13px; }
body.subsys .head-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
body.subsys .btn-primary { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); color: #fff; text-decoration: none; font-weight: 600; border: 0; cursor: pointer;
  box-shadow: 0 8px 18px rgba(14,165,233,.28); }
body.subsys .btn-primary:hover { filter: brightness(1.05); }
body.subsys .empty-box { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed rgba(15,42,68,.18); border-radius: 14px; background: rgba(15,42,68,.03); }

/* ---------- 紧急事件列表 ---------- */
body.subsys .ev-list { display: flex; flex-direction: column; gap: 12px; }
body.subsys .ev-card { display: flex; gap: 14px; background: #fff; border: 1px solid rgba(15,42,68,.08); border-radius: 14px; padding: 14px 16px;
  box-shadow: 0 8px 22px rgba(15,42,68,.06); border-left: 4px solid #ef4444; }
body.subsys .ev-card.read { border-left-color: rgba(15,42,68,.12); opacity: .72; }
body.subsys .ev-left { flex-shrink: 0; padding-top: 4px; }
body.subsys .ev-dot { display: block; width: 10px; height: 10px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 4px rgba(239,68,68,.18); }
body.subsys .ev-card.read .ev-dot { background: #94a3b8; box-shadow: none; }
body.subsys .ev-main { flex: 1; min-width: 0; }
body.subsys .ev-top { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
body.subsys .ev-tag { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: rgba(239,68,68,.14); color: #b91c1c; }
body.subsys .ev-new { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #ef4444; color: #fff; }
body.subsys .ev-time { font-size: 12px; color: var(--muted); margin-left: auto; }
body.subsys .ev-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
body.subsys .ev-body { font-size: 13px; color: #334155; white-space: pre-wrap; line-height: 1.7; }
body.subsys .ev-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
body.subsys .ev-channels { display: flex; gap: 6px; }
body.subsys .ch { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
body.subsys .ch-inapp { background: rgba(14,165,233,.14); color: #0e7490; }
body.subsys .ch-email { background: rgba(16,185,129,.14); color: #047857; }
body.subsys .ch-wechat { background: rgba(245,158,11,.16); color: #b45309; }
body.subsys .ev-ops { display: flex; align-items: center; gap: 12px; }

/* ---------- 通知设置表单 ---------- */
body.subsys .notify-form .form-section { border: 1px solid rgba(15,42,68,.08); border-radius: 14px; padding: 16px 18px; margin-bottom: 16px; background: rgba(15,42,68,.02); }
body.subsys .notify-form fieldset.form-section { border: 1px solid rgba(15,42,68,.12); }
body.subsys .notify-form legend { font-weight: 700; color: var(--ink); padding: 0 8px; font-size: 14px; }
body.subsys .notify-form .form-section > small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
body.subsys .notify-form .check { margin-bottom: 8px; }
