:root {
  --primary: #5652ff;
  --primary-dark: #4642e0;
  --bg: #f5f6fa;
  --card: #fff;
  --line: #e8e9f1;
  --text: #23253a;
  --muted: #8a8fa8;
  --ok: #18a058;
  --warn: #e8a317;
  --err: #d93838;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* 登录 */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #eef0ff 0%, #f7f8fc 50%, #eef6ff 100%); }
.login-card { width: 400px; background: #fff; border-radius: 16px; padding: 36px 40px; box-shadow: 0 18px 50px rgba(45, 48, 90, .12); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand img { width: 109px; height: 30px; }
.login-brand span { font-size: 16px; font-weight: 700; color: var(--primary); border-left: 1px solid var(--line); padding-left: 12px; }
.login-card h1 { margin: 0 0 6px; font-size: 26px; }
.login-sub { margin: 0 0 24px; color: var(--muted); }
.login-card form label { display: block; margin: 14px 0 6px; color: #555a72; font-size: 13px; }
.login-card input { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; outline: none; background: #fafbff; }
.login-card input:focus { border-color: var(--primary); background: #fff; }
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row input { flex: 1; }
.captcha-row img { width: 110px; height: 38px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; background: #f2f3ff; }
.btn { border: 0; border-radius: 8px; padding: 9px 18px; font-size: 14px; transition: .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #f0f1ff; color: var(--primary); }
.btn-ghost:hover { background: #e4e6ff; }
.btn-danger { background: #fff0f0; color: #d93838; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; height: 42px; margin-top: 22px; }
.login-tip { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 12px; line-height: 1.8; }
.captcha-hint { margin-top: 8px; font-size: 12px; color: var(--primary); }

/* 布局 */
#appView { display: flex; min-height: 100vh; }
.sidebar { width: 218px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: fixed; height: 100vh; left: 0; top: 0; }
.side-brand { height: 72px; display: flex; align-items: center; gap: 10px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.side-brand img { width: 109px; height: 30px; }
.side-brand span { font-size: 15px; font-weight: 700; color: var(--primary); border-left: 1px solid var(--line); padding-left: 10px; }
.side-nav { padding: 18px 12px; flex: 1; }
.nav-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 12px 16px; border-radius: 8px; color: #5a5f78; margin-bottom: 4px; font-size: 14px; }
.nav-item:hover { background: #f5f6ff; color: var(--primary); }
.nav-item.is-active { background: #eeeefe; color: var(--primary); font-weight: 700; }
.side-foot { padding: 18px 22px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.link-btn { border: 0; background: transparent; color: var(--muted); text-align: left; padding: 0; }
.link-btn:hover { color: var(--primary); }
.main { margin-left: 218px; flex: 1; padding: 0 28px 40px; min-width: 0; }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); margin-bottom: 24px; background: #fff; margin-left: -28px; margin-right: -28px; padding: 0 28px; }
.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-user { display: flex; align-items: center; gap: 8px; color: #5a5f78; }
.role-tag { background: #eeeefe; color: var(--primary); border-radius: 20px; padding: 3px 10px; font-size: 12px; }

/* 面板与表格 */
.view { animation: fade .2s ease; }
@keyframes fade { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-head h2 { margin: 0; font-size: 16px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.toolbar input, .toolbar select { height: 36px; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px; background: #fafbff; outline: none; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--primary); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 11px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { background: #fafbff; color: #6b7089; font-weight: 600; }
.table tr:hover td { background: #fcfcff; }
.table td .btn { margin-right: 6px; }
.tag { display: inline-block; border-radius: 20px; padding: 2px 9px; font-size: 12px; }
.tag-active, .tag-published { background: #e8f8ef; color: var(--ok); }
.tag-pending { background: #fff5e2; color: var(--warn); }
.tag-failed, .tag-disabled { background: #ffecec; color: #d93838; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 16px; }
.pager button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 5px 11px; }
.pager button.is-on { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager span { color: var(--muted); margin-right: auto; font-size: 13px; }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card .value { font-size: 30px; font-weight: 700; margin-top: 8px; color: var(--primary); }

/* 设置 */
.settings-form { display: grid; gap: 14px; max-width: 560px; }
.settings-form label { color: #555a72; font-size: 13px; display: grid; gap: 6px; }
.settings-form input { height: 38px; border: 1px solid var(--line); border-radius: 7px; padding: 0 12px; outline: none; }
.settings-form input:focus { border-color: var(--primary); }
.settings-form .btn { justify-self: start; margin-top: 4px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 12px; }

/* 弹窗与提示 */
.modal-mask { position: fixed; inset: 0; background: rgba(20, 22, 40, .38); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { width: 460px; max-height: 86vh; overflow: auto; background: #fff; border-radius: 14px; padding: 24px; box-shadow: 0 20px 60px rgba(20, 22, 40, .2); }
.modal h3 { margin: 0 0 18px; font-size: 18px; }
.modal .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal label { display: grid; gap: 5px; color: #555a72; font-size: 13px; }
.modal label.full { grid-column: 1 / -1; }
.modal input, .modal select { height: 36px; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px; outline: none; }
.modal input:focus, .modal select:focus { border-color: var(--primary); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-12px); background: var(--primary); color: #fff; padding: 10px 20px; border-radius: 8px; opacity: 0; pointer-events: none; transition: .2s; z-index: 99; box-shadow: 0 10px 30px rgba(45,48,90,.2); }
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-error { background: #d93838; }

/* 渠道对接 · 通用 live 配置 */
.modal textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; font: 12px/1.5 Consolas, Monaco, monospace; outline: none; resize: vertical; }
.modal textarea:focus { border-color: var(--primary); }
.modal label.check { display: flex; align-items: center; gap: 8px; align-self: end; height: 36px; }
.modal label.check input { width: 16px; height: 16px; }
.form-section { margin: 20px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 13px; color: #33385a; }
.form-section:first-of-type { margin-top: 4px; }
.tpl-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px; }
.tpl-bar select { height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 0 8px; }
.tpl-bar .hint { margin: 0; }
.preview-box { margin-top: 16px; background: #f7f8ff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 12px; }
.preview-box b { color: #33385a; }
.preview-box pre { margin: 8px 0 0; white-space: pre-wrap; word-break: break-all; font: 12px/1.5 Consolas, Monaco, monospace; color: #444a68; }
.channel-notice { background: #fff8e8; border: 1px solid #f0dfae; color: #7a5b12; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin: 4px 0 14px; }
.guide { font-size: 13px; line-height: 1.8; color: #4a4f68; max-height: 62vh; overflow: auto; }
.guide h4 { margin: 16px 0 6px; color: #33385a; font-size: 14px; }
.guide ol { margin: 0; padding-left: 22px; }
.guide li { margin: 4px 0; }
.guide code { background: #f1f2fa; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: 180px; }
  .main { margin-left: 180px; }
}
