:root {
  --bg: #f4f5f9;
  --panel: #ffffff;
  --line: #e5e7eb;
  --text: #1f2430;
  --muted: #7a8194;
  --primary: #4f46e5;
  --primary-weak: #eef2ff;
  --ok: #16a34a;
  --ok-weak: #e8f7ee;
  --warn: #d97706;
  --warn-weak: #fef4e5;
  --err: #dc2626;
  --err-weak: #fdeaea;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
}
* { 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: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
button { font: inherit; cursor: pointer; }

.layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 208px; flex: 0 0 208px; background: #1c2033; color: #cdd2e3;
  display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { color: #fff; font-weight: 700; font-size: 17px; padding: 4px 10px 16px; letter-spacing: .2px; }
.brand-logo { width: 44px; height: 44px; border-radius: 12px; display: block; margin: 0 0 8px -4px; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.brand small { display: block; color: #7f86a0; font-weight: 400; font-size: 11px; margin-top: 3px; }
.nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: 0; color: #cdd2e3; padding: 9px 12px; border-radius: 8px; font-size: 13.5px;
}
.nav button:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav button.active { background: var(--primary); color: #fff; }
.nav .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; flex: 0 0 auto; }
.side-foot { font-size: 11px; color: #6a7190; padding: 8px 12px 0; border-top: 1px solid rgba(255,255,255,.08); margin-top: 12px; }

.main { flex: 1; overflow-y: auto; }
.topbar {
  position: sticky; top: 0; z-index: 5; background: rgba(244,245,249,.9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); padding: 12px 28px; display: flex; align-items: center; gap: 14px;
}
.topbar h1 { font-size: 18px; margin: 0; }
.topbar .sub { color: var(--muted); font-size: 12.5px; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
/* 自适应内容区：跟随窗口铺满（参考 TDesign/AntD 后台流式布局），仅超宽屏限 1760px 并居中 */
.content { padding: 20px 28px 64px; width: 100%; max-width: 1760px; margin: 0 auto; }
@media (max-width: 900px) { .content { padding: 14px 14px 48px; } .topbar { padding: 10px 14px; } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.panel-head h3 { margin: 0; font-size: 15px; }
.panel-head .hint { color: var(--muted); font-size: 12px; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 16px 18px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--text); padding: 7px 14px; border-radius: 8px; font-size: 13px;
}
.btn:hover { background: #f8f9fc; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #4338ca; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--err); border-color: #f3c1c1; }
.btn.sm { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

input, select, textarea {
  font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
label.f { display: block; margin-bottom: 4px; font-size: 12.5px; color: var(--muted); }
.field { margin-bottom: 14px; }
.field .row { display: flex; gap: 10px; flex-wrap: wrap; }
.field .row > * { flex: 1; min-width: 150px; }
textarea { width: 100%; resize: vertical; }
input[type=text], input[type=password], select { width: 100%; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12px; }
.stat .n.ok { color: var(--ok); } .stat .n.warn { color: var(--warn); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.card h4 { margin: 0 0 4px; font-size: 15px; }
.card .meta { color: var(--muted); font-size: 12px; }
.card .desc { margin: 8px 0; font-size: 13px; color: #3c4252; }
.chip {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; border: 1px solid var(--line); background: #f6f7f9; color: var(--muted);
}
.chip.ok { background: var(--ok-weak); color: var(--ok); border-color: #cdeeda; }
.chip.warn { background: var(--warn-weak); color: var(--warn); border-color: #f3ddb8; }
.chip.err { background: var(--err-weak); color: var(--err); border-color: #f2c9c9; }
.chip.primary { background: var(--primary-weak); color: var(--primary); border-color: #d5d9f8; }

.tag { display: inline-block; margin: 2px 4px 2px 0; padding: 1px 8px; background: #f0f1f5; border-radius: 6px; font-size: 12px; color: #4a5165; }

.muted { color: var(--muted); } .small { font-size: 12px; }
.mt { margin-top: 12px; } .mb { margin-bottom: 12px; }
.flex { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flex .spacer { flex: 1; }
.space-between { justify-content: space-between; }

table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th, table.t td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #eef0f4; vertical-align: top; }
table.t th { color: var(--muted); font-weight: 500; font-size: 12px; background: #fafbfc; }
table.t tr:last-child td { border-bottom: 0; }
.truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.article-body { font-size: 15px; line-height: 1.9; color: #2a2f3a; }
.article-body h2 { font-size: 19px; margin: 22px 0 8px; }
.article-body h3 { font-size: 16px; margin: 18px 0 6px; }
.article-body blockquote { border-left: 3px solid var(--primary); margin: 10px 0; padding: 2px 14px; color: #566; background: #f8f9fd; border-radius: 0 8px 8px 0; }
.article-body ul, .article-body ol { padding-left: 22px; }
.article-body code { background: #f2f3f7; padding: 1px 6px; border-radius: 5px; font-size: 13px; }
.article-body hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.overlay {
  position: fixed; inset: 0; background: rgba(20, 24, 40, .45); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal { background: #fff; border-radius: 14px; width: 640px; max-width: 100%; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.lg { width: 860px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

.kv { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.alert { padding: 9px 12px; border-radius: 9px; font-size: 13px; margin: 8px 0; }
.alert.err { background: var(--err-weak); color: #9c1c1c; border: 1px solid #f2c9c9; }
.alert.ok { background: var(--ok-weak); color: #14673a; border: 1px solid #cdeeda; }
.alert.warn { background: var(--warn-weak); color: #8a5306; border: 1px solid #f3ddb8; }
.alert.info { background: #eef2ff; color: #3d46b5; border: 1px solid #d5d9f8; }

.samples-box { border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; background: #fafbfc; }
.samples-box .s-head { display: flex; align-items: center; margin-bottom: 6px; }

/* 发布面板：内容形态 Tab（动态/文章/短视频/播客） */
.ptabs { display: flex; gap: 4px; background: #eef0f4; border-radius: 10px; padding: 4px; margin-bottom: 12px; }
.ptabs button {
  flex: 1; border: 0; background: transparent; padding: 7px 10px; border-radius: 8px;
  font-size: 13px; color: var(--muted); transition: all .15s ease;
}
.ptabs button:hover { color: var(--text); }
.ptabs button.on { background: #fff; color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.ptabs button .n { font-size: 11px; color: var(--muted); margin-left: 5px; font-weight: 400; }
.ptabs button.on .n { color: var(--primary); }
/* 发布勾选：TDesign 式勾选卡片，单行排列、超长省略，不产生徽章换行 */
.pcheck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 6px; }
.pcheck {
  display: flex; align-items: center; gap: 7px; min-width: 0; cursor: pointer;
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  transition: border-color .15s ease, background .15s ease;
}
.pcheck:hover { border-color: #c9d2e8; background: #f8f9fd; }
.pcheck:has(input:checked) { border-color: var(--primary); background: var(--primary-weak); }
.pcheck input[type=checkbox] { width: auto; flex: 0 0 auto; margin: 0; }
.pcheck .pf-logo { flex: 0 0 auto; }
.pcheck b { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.pcheck .acc-h { flex: 0 0 auto; font-size: 11px; white-space: nowrap; }
.pcheck .chip { flex: 0 0 auto; padding: 0 6px; font-size: 10.5px; }
.pcheck .acc-h:not([class*="chip"]) { display: none; }
.ptab-pane { min-height: 60px; }

/* 平台 logo 图标（favicon + 品牌色首字回退） */
.pf-logo {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 7px; overflow: hidden; flex: 0 0 auto; vertical-align: middle;
}
.pf-logo.sm { width: 18px; height: 18px; border-radius: 5px; }
.pf-logo i {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-style: normal; color: #fff; font-weight: 700; font-size: 12px;
}
.pf-logo.sm i { font-size: 9px; }
.pf-logo img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; background: #fff; }

/* 渠道管理页：平台 logo（平铺账号行内使用） */
.ch-tile {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; transition: box-shadow .15s ease;
}
.ch-tile:hover { box-shadow: var(--shadow); }
.ch-tile.off { opacity: .55; }
.ch-tile .ti { min-width: 0; flex: 1; }
.ch-tile .ti b { display: block; font-size: 13.5px; white-space: normal; overflow-wrap: break-word; line-height: 1.35; }
.ch-tile .ti .sub { font-size: 11px; color: var(--muted); white-space: normal; line-height: 1.4; margin-top: 2px; }
.ch-tile .acts { display: flex; gap: 3px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }
.ch-tile .acts .btn { padding: 2px 5px; font-size: 11px; border-radius: 6px; }
.ch-tile .en { display: flex; align-items: center; flex: 0 0 auto; }
.ch-tile .en input { width: auto; }

/* 多账号管理：平铺布局（按内容形态分区，账号卡片自适应铺满宽度，参考 TDesign/AntD 列表栅格） */
.ch-sec-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text); margin: 18px 0 10px; }
.ch-sec-title::before { content: ''; width: 4px; height: 14px; border-radius: 2px; background: var(--primary); flex: 0 0 auto; }
.ch-sec:first-child .ch-sec-title { margin-top: 2px; }
.ch-sec-title .n { font-weight: 400; font-size: 11px; color: var(--muted); background: #eef0f4; border-radius: 999px; padding: 0 8px; }
.ch-rows { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 1100px) { .ch-rows { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1640px) { .ch-rows { grid-template-columns: 1fr 1fr 1fr; } }
.acc-row {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; min-width: 0;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); transition: box-shadow .15s ease, border-color .15s ease;
}
.acc-row:hover { box-shadow: var(--shadow); border-color: #d4d9e3; }
.acc-row.sel { border-color: var(--primary); background: #f4f6ff; }
.acc-row.off { opacity: .55; }
.acc-row .ch-sel { width: auto; flex: 0 0 auto; margin: 0; }
.acc-row .ti { min-width: 0; flex: 1; }
.acc-row .ti .l1 { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.acc-row .ti .l1 b { font-size: 13.5px; line-height: 1.35; overflow-wrap: break-word; }
.acc-row .ti .l1 .chip { padding: 0 6px; font-size: 11px; }
.acc-row .ti .sub { font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 3px; overflow-wrap: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.acc-row .acts { display: flex; gap: 4px; flex: 0 0 auto; flex-wrap: nowrap; justify-content: flex-end; }
.acc-row .acts .btn { padding: 2px 7px; font-size: 12px; border-radius: 6px; white-space: nowrap; }
.acc-row .en { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; font-size: 12px; color: var(--muted); }
.acc-row .en input { width: auto; margin: 0; }
.ch-sec-title input[type=checkbox] { width: auto; margin: 0; flex: 0 0 auto; }
/* 账号身份 @用户名 */
.acc-h { color: var(--primary); font-weight: 600; font-size: 12px; }
.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #22263a; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: tin .2s ease; max-width: 420px; }
.toast.err { background: #b4232e; }
.toast.ok { background: #1b7a44; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.empty { text-align: center; color: var(--muted); padding: 44px 10px; }
.empty .big { font-size: 30px; margin-bottom: 6px; }

/* Compact channel cards: name/status above a single action row. */
.ch-search-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ch-search-bar input { width: 100%; max-width: 360px; min-width: 0; }
.ch-rows { grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: 12px; }
.acc-row { display: grid; grid-template-columns: 16px 28px minmax(0, 1fr); align-items: center; gap: 8px; padding: 12px; }
.acc-row[hidden], .ch-sec[hidden], #chSearchEmpty[hidden] { display: none; }
.acc-row .ch-sel { width: 16px; height: 16px; margin: 0; }
.acc-row .ti .l1 { gap: 8px; min-height: 28px; }
.acc-row .ti .l1 b { font-size: 14px; line-height: 22px; overflow-wrap: anywhere; }
.acc-row .chip { line-height: 18px; white-space: nowrap; }
.acc-row .ti .sub { margin-top: 4px; }
.acc-row .en { grid-column: 1 / 3; align-self: end; min-height: 28px; margin: 0; }
.acc-row .acts { grid-column: 3; gap: 6px; flex-wrap: wrap; align-self: end; }
.acc-row .acts .btn { min-height: 28px; padding: 3px 8px; }

.channel-api-config { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 16px; }
.channel-api-config summary { cursor: pointer; font-weight: 600; }

.media-cover { display: inline-block; max-width: 160px; max-height: 160px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; margin: 8px; vertical-align: middle; }

#taskToggle { position:fixed;right:20px;bottom:20px;z-index:45;box-shadow:var(--shadow); }
#taskPanel { position:fixed;right:20px;bottom:64px;width:min(440px,calc(100vw - 40px));max-height:70vh;overflow:auto;background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:16px;z-index:46;box-shadow:var(--shadow); }
#taskPanel[hidden]{display:none}.task-row{padding:12px 0;border-bottom:1px solid var(--line)}.task-row p{margin:8px 0}.provider-fields{border:1px solid var(--line);border-radius:8px;padding:16px;margin-bottom:16px}.provider-fields label.f{display:block;margin-top:12px}
