:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --border: #e6e9f0;
  --border-2: #d8dde8;
  --text: #1c2333;
  --text-2: #4b5568;
  --muted: #8a93a6;
  --primary: #2f7dcd;
  --primary-d: #2569ad;
  --primary-soft: #e8f1fb;
  --accent: #6b4fb0;
  --danger: #e05252;
  --danger-soft: #fdeeee;
  --ok: #2e9e5b;
  --ok-soft: #e7f6ee;
  --warn: #c77700;
  --warn-soft: #fff4e5;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(20, 30, 55, 0.05);
  --shadow-md: 0 6px 20px rgba(20, 30, 55, 0.08);
  --shadow-lg: 0 12px 40px rgba(20, 30, 55, 0.14);
  --ring: 0 0 0 3px rgba(47, 125, 205, 0.16);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #f6f8fc 0%, #eef1f7 100%);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.sm { font-size: 12px; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }
.tag-ok { display: inline-block; margin-left: 6px; padding: 1px 7px; font-size: 11px; line-height: 16px; color: #fff; background: var(--ok); border-radius: 10px; vertical-align: middle; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c9d0dd; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #aeb7c9; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 登录 ============ */
.login-mask { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #2f7dcd 0%, #5b5bd6 100%); z-index: 50; }
.login-card { background: var(--panel); padding: 36px 34px; border-radius: 16px; width: 340px; box-shadow: var(--shadow-lg); animation: pop .28s ease; }
.login-card .logo { width: 48px; height: 48px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), var(--accent)); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px; font-weight: 800; margin-bottom: 14px; }
.login-card h2 { margin: 0 0 2px; font-size: 20px; }
.login-card p { margin: 0 0 18px; }
.login-card input { width: 100%; padding: 11px 12px; margin: 0 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; transition: border-color .15s, box-shadow .15s; }
.login-card input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.login-card button { width: 100%; padding: 11px; border: 0; border-radius: var(--radius-sm); background: linear-gradient(135deg, var(--primary), var(--primary-d)); color: #fff; font-size: 15px; cursor: pointer; transition: filter .15s, transform .05s; }
.login-card button:hover { filter: brightness(1.08); }
.login-card button:active { transform: scale(.99); }

/* ============ 布局 ============ */
.app { display: flex; height: 100%; }
.sidebar { width: 208px; background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 16px 12px; }
.nav-toggle { display: none; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; font-size: 16px; line-height: 1; cursor: pointer; color: var(--text-2); }
.nav-toggle:hover { background: var(--border); color: var(--text); }
.sidebar-backdrop { display: none; }
.brand { font-weight: 800; font-size: 16px; padding: 6px 10px 16px; color: var(--primary); letter-spacing: .5px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none; font-size: 14px; transition: background .12s, color .12s; }
.sidebar nav a .ico { width: 18px; text-align: center; opacity: .75; }
.sidebar nav a:hover { background: var(--bg); color: var(--text); }
.sidebar nav a.active { background: linear-gradient(135deg, var(--primary), var(--primary-d)); color: #fff; box-shadow: var(--shadow-sm); }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.side-foot select { width: 100%; padding: 7px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.ghost { background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; cursor: pointer; color: var(--muted); width: 100%; transition: all .15s; }
.ghost:hover { color: var(--text); border-color: var(--border-2); }

.content { flex: 1; overflow: auto; display: flex; flex-direction: column; }
.topbar { padding: 18px 26px; background: rgba(255, 255, 255, .82); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar h1 { margin: 0; font-size: 19px; font-weight: 700; }
.view { width: 100%; max-width: 1500px; padding: 24px; margin: 0 auto; }
.app-foot { margin-top: auto; flex-shrink: 0; padding: 16px 26px; color: var(--muted); font-size: 12px; text-align: center; border-top: 1px solid var(--border); background: var(--panel); }
.login-copy { margin-top: 18px; font-size: 11px; color: var(--muted); text-align: center; }

/* ============ 卡片 / 统计 ============ */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card .num { font-size: 28px; font-weight: 800; line-height: 1.2; background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.card .label { color: var(--muted); font-size: 13px; margin-top: 3px; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); margin-bottom: 18px; overflow-x: auto; }
.panel h3 { margin: 0 0 14px; font-size: 15px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.panel h3::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: linear-gradient(180deg, var(--primary), var(--accent)); }

/* ============ 表格 ============ */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 13px; background: #fafbfd; white-space: nowrap; }
tbody tr { transition: background .1s; }
tbody tr:hover td { background: #f6f9fd; }
.avatar { width: 34px; height: 34px; border-radius: 50%; vertical-align: middle; margin-right: 8px; object-fit: cover; border: 1px solid var(--border); }
.avatar-ph { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-d); font-size: 14px; font-weight: 700; vertical-align: middle; margin-right: 8px; flex: none; }

/* ============ 表单 ============ */
input[type=text], input[type=password], input[type=number], input[type=datetime-local], textarea, select {
  padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; background: #fff; color: var(--text); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
textarea { resize: vertical; min-height: 64px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input, .toolbar select { min-width: 140px; }
.toolbar .btn { flex: none; }

/* ============ 按钮 ============ */
button.btn { background: linear-gradient(135deg, var(--primary), var(--primary-d)); color: #fff; border: 0; border-radius: var(--radius-sm); padding: 8px 16px; cursor: pointer; font-size: 14px; font-weight: 500; transition: filter .15s, transform .05s, box-shadow .15s; box-shadow: 0 1px 2px rgba(47, 125, 205, .25); }
button.btn:hover { filter: brightness(1.07); }
button.btn:active { transform: scale(.98); }
button.btn:disabled { opacity: .5; cursor: not-allowed; }
button.btn.danger { background: linear-gradient(135deg, #e76a5a, var(--danger)); box-shadow: 0 1px 2px rgba(224, 82, 82, .25); }
button.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); box-shadow: none; font-weight: 500; }
button.btn.ghost:hover { background: var(--primary-soft); filter: none; }
button.btn.ghost.danger { color: var(--danger); border-color: var(--danger); }
button.btn.ghost.danger:hover { background: var(--danger-soft); }
button.btn.sm { padding: 5px 11px; font-size: 13px; }

/* ============ 标签 / chip ============ */
.chip { display: inline-block; background: #eef1f6; color: var(--text-2); border-radius: 12px; padding: 2px 10px; font-size: 12px; margin: 2px; }
.chip.tag { background: #f0eefb; color: var(--accent); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.del { background: #f3f4f7; color: var(--muted); }
.pagination { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }

/* ============ 弹窗 ============ */
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, .42); backdrop-filter: blur(2px); z-index: 40; animation: fade .18s ease; }
.modal .box { background: var(--panel); border-radius: 14px; width: 560px; max-width: 92vw; max-height: 88vh; overflow: auto; padding: 24px; box-shadow: var(--shadow-lg); animation: pop .24s ease; }
.modal .box h3 { margin-top: 0; }
.modal .close { float: right; cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: background .12s; }
.modal .close:hover { background: var(--bg); color: var(--text); }
.row { display: flex; gap: 10px; margin-bottom: 10px; align-items: center; flex-wrap: wrap; }
.row label { width: 92px; color: var(--muted); font-size: 13px; flex: none; }
.row .val { flex: 1; min-width: 0; }

/* ============ 欢迎语配置 ============ */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.att-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-width: 640px; }
.att-list li { background: var(--panel-2, #f5f7fa); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 12px; display: flex; align-items: center; gap: 8px; word-break: break-all; }
.att-list li .btn { flex: none; }
.att-add { align-items: center; }
.att-add select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.att-add input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }

/* ============ 上传 / 素材 ============ */
label.uploadbtn { display: inline-block; background: linear-gradient(135deg, var(--primary), var(--primary-d)); color: #fff; border-radius: var(--radius-sm); padding: 8px 14px; cursor: pointer; font-size: 14px; font-weight: 500; box-shadow: 0 1px 2px rgba(47,125,205,.25); }
label.uploadbtn:hover { filter: brightness(1.07); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.media-cell { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; background: var(--panel); display: flex; flex-direction: column; gap: 6px; transition: box-shadow .15s, transform .15s; }
.media-cell:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.media-cell .thumb { height: 110px; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.media-cell .thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-cell .ph { color: var(--muted); font-size: 14px; font-weight: 600; text-transform: uppercase; }
.media-cell .nm { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-cell .meta { font-size: 12px; color: var(--muted); }
.media-cell .meta.url { word-break: break-all; }
.media-cell .actions { display: flex; gap: 6px; margin-top: 2px; }
.media-cell .actions .btn { flex: 1; }

/* ============ 图表 / toast ============ */
.chart { width: 100%; height: auto; }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #1c2333; color: #fff; padding: 10px 20px; border-radius: 10px; font-size: 14px; z-index: 60; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px; animation: slideUp .25s ease; }
.toast.success { background: var(--ok); }
.toast.error { background: var(--danger); }
.attach { border: 1px dashed var(--border-2); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 10px; background: #fafbfd; }
.attach .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

/* ============ 成员选择器 ============ */
.mp-toolbar { display: flex; gap: 8px; align-items: center; margin: 8px 0 6px; flex-wrap: wrap; }
.mp-box { max-height: 300px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; background: #fff; }
.mp-dept { margin-bottom: 6px; }
.mp-dept-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--bg); border-radius: 6px; font-weight: 600; font-size: 13px; cursor: pointer; }
.mp-dept-body { padding: 4px 0 4px 20px; }
label.mp-item { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 14px; }
label.mp-item:hover { background: var(--bg); }
.mp-item input[type=checkbox], .mp-item input[type=radio] { accent-color: var(--primary); }

/* ============ 概览扩展 ============ */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.dash-grid .panel { margin-bottom: 0; }
.rank-list { display: flex; flex-direction: column; gap: 6px; }
.rank-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.rank-name { width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: none; color: var(--text-2); }
.rank-bar { flex: 1; height: 12px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.rank-fill { height: 100%; border-radius: 6px; transition: width .6s ease; }
.rank-val { width: 44px; text-align: right; color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }

/* ============ 时间线 ============ */
.timeline { border-left: 2px solid var(--border); padding-left: 14px; margin-left: 4px; display: flex; flex-direction: column; gap: 8px; }
.tl-item { font-size: 13px; position: relative; }
.tl-item::before { content: ""; position: absolute; left: -19px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--primary); }

/* ============ 同步进度 ============ */
.sync-progress { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.sync-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .5s; }

/* ============ 动画 ============ */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ============ 移动端适配 ============ */
@media (max-width: 820px) {
  .app { height: auto; min-height: 100%; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 260px; max-width: 80vw; background: var(--panel); display: flex; flex-direction: column; padding: 16px 12px; overflow-y: auto; z-index: 50; transform: translateX(-100%); transition: transform .25s ease; box-shadow: 0 0 24px rgba(0,0,0,.18); border-right: 1px solid var(--border); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open { overflow: hidden; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 49; opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .brand { padding: 0 0 14px 0; font-size: 17px; white-space: nowrap; }
  .nav-toggle { display: block; }
  .sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0; background: transparent; border: 0; box-shadow: none; position: static; max-height: none; }
  .sidebar nav a { padding: 11px 12px; margin-bottom: 0; font-size: 14px; border-radius: 8px; white-space: normal; }
  .sidebar nav a .ico { display: inline-block; width: 22px; text-align: center; }
  .side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
  .side-foot select { width: 100%; padding: 7px 8px; }
  .topbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; }
  .topbar h1 { font-size: 16px; margin: 0; }
  .view { padding: 12px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card { padding: 12px 14px; min-width: 0; }
  .card .num { font-size: 22px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar input, .toolbar select { width: 100%; min-width: 0; }
  .toolbar .btn { width: 100%; }
  .panel { padding: 12px; overflow-x: auto; }
  .row { flex-direction: column; align-items: stretch; gap: 4px; }
  .row label { width: auto; }
  .row .val { width: 100%; }
  .modal .box { width: 94vw; max-height: 90vh; padding: 18px; }
  .dash-grid { grid-template-columns: 1fr; }
  .rank-name { width: 90px; }
  table { font-size: 13px; }
  th, td { padding: 8px 8px; white-space: nowrap; }
  .pagination { flex-wrap: wrap; }
  .mp-toolbar { flex-direction: column; align-items: stretch; }
  .mp-toolbar input { width: 100% !important; }
  .login-card { width: 88vw; }
}
@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .card .num { font-size: 20px; }
  .view { padding: 10px; }
}

/* ===================== 群发记录页 ===================== */
.gs-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.gs-filter label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted, #888); gap: 4px; }
.gs-filter select, .gs-filter input { padding: 5px 8px; border: 1px solid var(--border, #dde3ec); border-radius: 6px; background: var(--bg-card, #fff); color: var(--text, #222); }
.pager { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.pager button[disabled] { opacity: .45; cursor: not-allowed; }

/* 悬浮预览（消息卡片样式，模拟客户实际看到的推送） */
.pv-cell { position: relative; min-width: 220px; }
.pv-trigger { position: relative; cursor: default; }
.pv-main { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 320px; line-height: 1.5; }
.pv-chips { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-left: 4px; vertical-align: middle; }
.pv-pop {
  display: none; position: absolute; z-index: 50; left: 0; top: calc(100% + 6px);
  width: 300px; max-height: 380px; overflow: auto;
  background: #f2f3f5; border: 1px solid var(--border, #dde3ec);
  border-radius: 8px; box-shadow: 0 8px 28px rgba(0,0,0,.18);
  padding: 10px; font-size: 13px; line-height: 1.6; white-space: normal;
}
.pv-trigger:hover .pv-pop, .pv-trigger:focus-within .pv-pop { display: block; }
/* 消息卡片：白底圆角，像聊天窗口里的消息 */
.pv-msg {
  background: #fff; border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.08);
  padding: 10px; margin-bottom: 8px; overflow: hidden; word-break: break-all;
}
.pv-msg:last-child { margin-bottom: 0; }
.pv-text { white-space: pre-wrap; line-height: 1.6; }
.pv-raw { background: #fbf6e9; font-size: 12px; }
/* 图片 */
.pv-image img { display: block; max-width: 100%; max-height: 180px; border-radius: 4px; }
.pv-ph { color: #999; text-align: center; padding: 18px 0; font-size: 13px; }
/* 图文链接/小程序/视频/文件：统一卡片 */
.pv-card { padding: 0; }
.pv-card-img { display: block; width: 100%; max-height: 140px; object-fit: cover; }
.pv-card-body { padding: 9px 11px; }
.pv-card-title { font-weight: 600; font-size: 14px; line-height: 1.45; }
.pv-card-desc { color: #666; font-size: 12px; margin-top: 3px; line-height: 1.5; }
.pv-card-src { color: #9aa0a6; font-size: 11px; margin-top: 5px; display: flex; align-items: center; gap: 5px; }
.pv-badge { background: #e8f0fe; color: #1a66cc; border-radius: 3px; font-size: 10px; padding: 1px 5px; }
/* 小程序：左图右文 */
.pv-mini { display: flex; align-items: stretch; }
.pv-mini-img { width: 74px; min-height: 84px; object-fit: cover; flex-shrink: 0; }
.pv-mini-ph { display: flex; align-items: center; justify-content: center; background: #f5f6f8; font-size: 26px; }
/* 视频 */
.pv-video .pv-ph { background: #f5f6f8; }
/* 文件 */
.pv-file { display: flex; align-items: center; }
.pv-file-ic { font-size: 30px; margin-right: 10px; flex-shrink: 0; }

/* ===================== 优化新增：工具类 / 组件 ===================== */
/* 危险操作链接：统一走设计变量，替代硬编码 #d9534f */
.link-danger { color: var(--danger); cursor: pointer; }
.link-danger:hover { color: var(--danger); text-decoration: underline; }
.cp { cursor: pointer; }

/* 布局工具类（抽取自原先的内联 style） */
.w100 { width: 100%; } .w40 { width: 40%; } .w60 { width: 60%; }
.w120 { width: 120px; } .w150 { width: 150px; } .w160 { width: 160px; } .w180 { width: 180px; }
.w700 { width: 700px; max-width: 94vw; }
.mt4 { margin-top: 4px; } .mt6 { margin-top: 6px; } .mt18 { margin-top: 18px; }
.mb10 { margin-bottom: 10px; } .my4 { margin: 4px 0; }
.mr14 { margin-right: 14px; } .ml4 { margin-left: 4px; } .ml12 { margin-left: 12px; }
.mla { margin-left: auto; } .pad6 { padding: 6px; }

/* 空状态 */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 44px 20px; color: var(--muted); text-align: center; }
.empty .e-ico { font-size: 32px; opacity: .55; line-height: 1; }
.empty .e-tip { font-size: 13px; }
.empty .e-action { margin-top: 4px; }

/* 加载 / 骨架屏 */
.spinner { width: 26px; height: 26px; border: 3px solid var(--border-2); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--muted); font-size: 13px; }
.skeleton { background: linear-gradient(90deg, #eef1f6 25%, #e3e8f1 37%, #eef1f6 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ===================== P2 优化：视图淡入 / 表单错误态 / 暗色模式 ===================== */

/* 视图切换淡入：每次 #view 内容被替换，直接子节点播放一次淡入 */
.view > * { animation: fade .3s ease both; }

/* 表单错误态 */
.input-error { border-color: var(--danger) !important; box-shadow: 0 0 0 3px var(--danger-soft) !important; background: var(--danger-soft) !important; }
.input-error::placeholder { color: var(--danger); }

/* 渠道活码 */
.qr-thumb { width: 64px; height: 64px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; background: #fff; vertical-align: middle; }
.nowrap { white-space: nowrap; }

/* 暗色模式：跟随系统配色 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --panel: #171b22;
    --panel-2: #1c2129;
    --bg-card: #1c2129;
    --border: #262c36;
    --border-2: #313a47;
    --text: #e6e9ef;
    --text-2: #b3bccb;
    --muted: #7c8696;
    --primary: #4f9be0;
    --primary-d: #3d83c4;
    --primary-soft: #16314a;
    --accent: #9a7fd6;
    --danger: #f0736f;
    --danger-soft: #3a2326;
    --ok: #4cc07a;
    --ok-soft: #1a3326;
    --warn: #e0a23c;
    --warn-soft: #3a2f18;
    --ring: 0 0 0 3px rgba(79, 155, 224, .22);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, .5);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
  }
  body { background: linear-gradient(180deg, #0e1116 0%, #0b0e13 100%); }
  .sidebar { background: var(--panel); }
  .side-foot select { background: var(--panel-2); }
  .topbar { background: rgba(14, 17, 22, .82); }
  input[type=text], input[type=password], input[type=number], input[type=datetime-local], textarea, select { background: var(--panel-2); }
  .login-card input { background: var(--panel-2); }
  th { background: #161b22; }
  tbody tr:hover td { background: #1b212b; }
  .chip { background: #232a34; }
  .chip.tag { background: #241f33; }
  .chip.del { background: #1c222b; }
  .att-list li { background: var(--panel-2); }
  .att-add select { background: var(--panel-2); }
  .attach { background: #161b22; }
  .mp-box { background: var(--panel-2); }
  .tl-item::before { border-color: var(--panel); }
  .gs-filter select, .gs-filter input { background: var(--panel-2); }
  .skeleton { background: linear-gradient(90deg, #1c2129 25%, #262d38 37%, #1c2129 63%); }
  /* 消息预览卡片暗色化（微信风格深色气泡） */
  .pv-pop { background: #20262f; border-color: #2c333d; }
  .pv-msg { background: #2a313b; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
  .pv-card-desc { color: #9aa4b2; }
  .pv-card-src { color: #7c8696; }
  .pv-raw { background: #322c1f; }
  .pv-mini-ph, .pv-video .pv-ph { background: #232a34; }
  .pv-ph { color: #7c8696; }
}

/* 登录页签（管理员/员工） */
.login-tabs { display: flex; gap: 4px; margin-bottom: 14px; background: var(--bg); border-radius: 10px; padding: 3px; }
.login-tabs a { flex: 1; text-align: center; padding: 7px 0; border-radius: 8px; color: var(--muted); font-size: 13px; text-decoration: none; transition: all .15s; }
.login-tabs a.active { background: var(--panel); color: var(--primary); font-weight: 600; box-shadow: var(--shadow-sm); }

/* ===== 内容库 ===== */
.content-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.content-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--panel); box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s; display: flex; flex-direction: column; }
.content-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.content-card.pick { cursor: pointer; }
.content-card.pick:hover { border-color: var(--primary); }
.content-cover { height: 150px; background: var(--bg); display: flex; align-items: center; justify-content: center; overflow: hidden; border-bottom: 1px solid var(--border); position: relative; }
.content-cover img { width: 100%; height: 100%; object-fit: cover; }
.content-cover-ph { font-size: 42px; opacity: .45; }
/* 卡片封面：图数角标（多图橙色高亮，单图灰色） */
.cover-badge { position: absolute; top: 8px; right: 8px; background: rgba(60,60,60,.72); color: #fff; font-size: 12px; line-height: 1; padding: 4px 9px; border-radius: 999px; z-index: 2; pointer-events: none; }
.cover-badge.multi { background: #ff8f1f; font-weight: 600; }
.content-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.content-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.content-title .chip { font-weight: 400; font-size: 11px; }
.content-text { color: var(--text); font-size: 12.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2em; }
.content-meta { color: var(--muted); }
.content-tags { display: flex; flex-wrap: wrap; gap: 4px; min-height: 20px; }
.content-scenes { display: flex; flex-wrap: wrap; gap: 4px; }
.content-actions { margin-top: auto; padding-top: 8px; display: flex; gap: 8px; }
.content-asset-grid { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
/* 素材点选：选中蓝色边框 + ✓ 角标 + 序号角标 */
.content-pick { position: relative; border: 1px solid var(--border); }
.content-pick.is-sel { border: 2px solid var(--primary); }
.content-pick.is-sel::after { content: "✓"; position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.content-pick-badge { position: absolute; top: -7px; left: -7px; width: 18px; height: 18px; border-radius: 50%; background: #ff8f1f; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
/* 编辑弹框：已选图片预览墙 */
.content-preview-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; padding: 10px; background: var(--bg); border: 1px dashed var(--border); border-radius: 10px; }
.content-preview-empty { font-size: 12px; color: var(--muted); }
.content-preview-item { position: relative; width: 92px; }
.content-preview-item img { width: 92px; height: 92px; object-fit: cover; border-radius: 8px; display: block; border: 1px solid var(--border); }
.content-preview-th-ph { width: 92px; height: 92px; border-radius: 8px; background: var(--panel); display: flex; align-items: center; justify-content: center; font-size: 28px; border: 1px solid var(--border); }
.content-preview-idx { position: absolute; top: -6px; left: -6px; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.3); z-index: 2; }
.content-preview-ops { display: flex; justify-content: space-between; margin-top: 3px; font-size: 12px; }
.content-preview-ops a { color: var(--primary); text-decoration: none; padding: 0 4px; cursor: pointer; }
.content-preview-ops a.danger { color: #e34d59; }
