:root {
  --primary: #2563EB;
  --bg: #F5F7FB;
  --card: #fff;
  --text: #1F2937;
  --muted: #6B7280;
  --border: #E5E7EB;
  --danger: #DC2626;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 13px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; outline: none; background: #fff; }
input:focus, select:focus { border-color: var(--primary); }

/* ===== 布局 ===== */
.topbar {
  background: linear-gradient(90deg, #1D4ED8, #3B82F6);
  color: #fff; padding: 0 24px; height: 56px;
  display: flex; align-items: center; gap: 24px;
  position: sticky; top: 0; z-index: 50;
}
.topbar .logo { font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.topbar .tabs { display: flex; gap: 8px; flex: 1; }
.topbar .tab {
  padding: 6px 16px; border-radius: 8px; font-size: 14px; cursor: pointer; opacity: .85;
}
.topbar .tab.on { background: rgba(255,255,255,.18); opacity: 1; font-weight: 600; }
.topbar .user { font-size: 13px; opacity: .9; display: flex; align-items: center; gap: 8px; }
.topbar .user b { font-weight: 600; }
.topbar .user .u-sep { opacity: .4; }
.topbar .user .u-link { cursor: pointer; text-decoration: underline; opacity: .9; }
.topbar .user .u-link:hover { opacity: 1; }

.page { max-width: 1440px; margin: 0 auto; padding: 20px 24px 60px; }
.hidden { display: none !important; }

.card { background: var(--card); border-radius: 14px; padding: 20px; box-shadow: 0 1px 4px rgba(31,41,55,.06); margin-bottom: 16px; }
.card h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.card h3 .sub { font-size: 12px; color: var(--muted); font-weight: 400; }

.btn {
  border: none; border-radius: 8px; padding: 8px 16px; font-size: 13px;
  background: #EEF4FF; color: var(--primary);
}
.btn:hover { background: #DBEAFE; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: #1D4ED8; }
.btn.danger { background: #FEF2F2; color: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 12px; }

/* ===== 登录 ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #1D4ED8, #3B82F6 60%, #93C5FD); }
.login-box { background: #fff; border-radius: 20px; padding: 40px; width: 400px; }
.login-box h2 { margin-bottom: 6px; }
.login-box p { color: var(--muted); font-size: 13px; margin-bottom: 22px; line-height: 1.7; }
.login-box input { width: 100%; margin-bottom: 12px; }
.login-box .btn { width: 100%; padding: 11px; }
.login-err {
  margin-top: 12px; font-size: 13px; color: var(--danger);
  min-height: 18px; text-align: center; line-height: 1.5;
}

/* ===== 弹窗 ===== */
.modal-wrap {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, .45); z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: #fff; border-radius: 16px; padding: 28px 30px; width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-box h3 { font-size: 17px; margin-bottom: 20px; }
.modal-box .frow { display: block; margin-bottom: 14px; }
.modal-box .frow span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.modal-box .frow input { width: 100%; }
.modal-acts { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ===== 账号管理 ===== */
.acct-form { max-width: 520px; }
.acct-form .frow { display: block; margin-bottom: 16px; }
.acct-form .frow > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.acct-form .frow > span i { color: var(--danger); font-style: normal; }
.acct-form .frow input { width: 100%; }
.acct-form-acts { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.badge-st.me { background: #EEF4FF; color: var(--primary); }
.badge-st.off { background: #F3F4F6; color: #6B7280; }

/* ===== KPI ===== */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--card); border-radius: 14px; padding: 18px; box-shadow: 0 1px 4px rgba(31,41,55,.06); }
.kpi .v { font-size: 26px; font-weight: 700; color: var(--primary); }
.kpi .l { font-size: 12px; color: var(--muted); margin-top: 4px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3-7 { display: grid; grid-template-columns: 3fr 7fr; gap: 16px; }

.ctrl-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.ctrl-row label { font-size: 13px; color: var(--muted); }

.pill { padding: 5px 14px; border-radius: 999px; border: 1px solid var(--border); background: #fff; font-size: 13px; cursor: pointer; }
.pill.on { background: var(--primary); color: #fff; border-color: var(--primary); }

.chart { width: 100%; height: 340px; }

/* ===== 表格 ===== */
table.dt { width: 100%; border-collapse: collapse; font-size: 13px; }
table.dt th { background: #F5F7FB; text-align: left; padding: 9px 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
table.dt td { padding: 9px 12px; border-bottom: 1px solid #F3F4F6; }
table.dt td.num, table.dt th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.dt tr:hover td { background: #FAFBFF; }
table.dt td.total { font-weight: 700; color: var(--primary); }
.bar-cell { background: linear-gradient(90deg, #DBEAFE, transparent); }

/* ===== 编辑器 ===== */
.editor { display: grid; grid-template-columns: 210px 1fr 330px; gap: 16px; align-items: start; }
.panel { background: var(--card); border-radius: 14px; padding: 16px; box-shadow: 0 1px 4px rgba(31,41,55,.06); }
.panel h4 { font-size: 13px; color: var(--muted); margin-bottom: 12px; }

.block-lib { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lib-item {
  border: 1px dashed var(--border); border-radius: 10px; padding: 10px 6px;
  text-align: center; font-size: 12px; cursor: pointer; color: var(--text); background: #FAFBFC;
}
.lib-item:hover { border-color: var(--primary); color: var(--primary); background: #EEF4FF; }
.lib-item .ico { font-size: 18px; display: block; margin-bottom: 4px; }

.canvas-list { min-height: 400px; }
.blk {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 12px 28px; margin-bottom: 10px;
  cursor: pointer; background: #fff; position: relative; transition: box-shadow .15s;
}
.blk::before {
  content: '⠿'; position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: #C4CBD6; font-size: 14px; cursor: grab;
}
.blk:hover { box-shadow: 0 2px 10px rgba(31,41,55,.08); }
.blk.on { border-color: var(--primary); box-shadow: 0 0 0 2px #DBEAFE; }
.blk.off { opacity: .45; }
.blk.dragging { opacity: .35; }
.blk.drop-before::after,
.blk.drop-after::after {
  content: ''; position: absolute; left: 0; right: 0; height: 3px;
  background: var(--primary); border-radius: 3px; box-shadow: 0 0 6px rgba(37,99,235,.5);
}
.blk.drop-before::after { top: -7px; }
.blk.drop-after::after { bottom: -7px; }
.canvas-list.drag-active { outline: 2px dashed var(--primary); outline-offset: 6px; border-radius: 8px; }
.blk .t { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.blk .badge {
  font-size: 11px; background: #EEF4FF; color: var(--primary);
  border-radius: 6px; padding: 1px 8px; font-weight: 400;
}
.blk .desc { font-size: 12px; color: var(--muted); margin-top: 4px; }
.blk .ops { position: absolute; right: 10px; top: 10px; display: none; gap: 6px; }
.blk:hover .ops { display: flex; }
.blk .ops button { border: none; background: #F5F7FB; border-radius: 6px; width: 24px; height: 24px; font-size: 12px; }
.blk .ops button:hover { background: #EEF4FF; color: var(--primary); }

.props .frow { margin-bottom: 12px; }
.props .frow > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.props .frow input, .props .frow select { width: 100%; }
.props .frow input[type=color] { padding: 2px; height: 34px; }
.props .frow input[type=range] { padding: 0; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type=color] { width: 46px; }
.color-row input[type=text] { flex: 1; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

.chk { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
.chk input { width: auto; }

.preview-box { background: #E9EDF3; border-radius: 14px; padding: 16px; }
.preview-box iframe { width: 100%; height: 720px; border: none; background: #fff; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,.12); }

/* 模板列表 */
.tpl-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tpl-card { border: 2px solid var(--border); border-radius: 14px; padding: 16px; cursor: pointer; position: relative; }
.tpl-card:hover { border-color: var(--primary); }
.tpl-card .name { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.tpl-card .desc { font-size: 12px; color: var(--muted); min-height: 32px; }
.tpl-card .meta { font-size: 11px; color: #9CA3AF; margin-top: 8px; }
.tpl-card .sys { position: absolute; top: 12px; right: 12px; font-size: 11px; background: #FEF3C7; color: #B45309; padding: 2px 8px; border-radius: 6px; }
.tpl-actions { display: flex; gap: 6px; margin-top: 10px; }

.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  background: #111827; color: #fff; font-size: 13px; padding: 9px 18px;
  border-radius: 10px; z-index: 100; opacity: 0; transition: opacity .25s; pointer-events: none;
}
.toast.show { opacity: .95; }

/* ===== 文章管理 ===== */
.hint { font-size: 12px; color: var(--muted); background: #F0F7FF; border-left: 3px solid #93C5FD;
  padding: 8px 12px; border-radius: 6px; margin-bottom: 14px; line-height: 1.7; }
.hint b { color: var(--primary); }
.req { color: #e54d42; font-weight: 600; }

.art-edit { display: grid; grid-template-columns: 1fr 400px; gap: 16px; align-items: start; }
.art-title { width: 100%; border: none; border-bottom: 2px solid var(--border); border-radius: 0;
  font-size: 20px; font-weight: 700; padding: 4px 2px 10px; margin-bottom: 14px; }
.art-title:focus { border-bottom-color: var(--primary); }
.art-textarea {
  width: 100%; height: 620px; border: 1px solid var(--border); border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Noto Sans Mono CJK SC", monospace;
  font-size: 13px; line-height: 1.85; padding: 14px; resize: vertical; outline: none;
}
.art-textarea:focus { border-color: var(--primary); }
.art-preview {
  height: 460px; overflow: auto; border: 1px solid var(--border); border-radius: 10px;
  padding: 18px 20px; background: #FCFDFF; font-size: 13px; line-height: 1.8;
}

/* 小程序端 rich-text 与后台预览共用的 Markdown 排版 */
.md-body h1, .md-body h2, .md-body h3, .md-body h4, .md-body h5, .md-body h6 {
  margin: 18px 0 10px; line-height: 1.4; font-weight: 700; }
.md-body h1 { font-size: 22px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.md-body h2 { font-size: 18px; }
.md-body h3 { font-size: 16px; }
.md-body h1:first-child, .md-body h2:first-child { margin-top: 0; }
.md-body p { margin: 10px 0; }
.md-body ul, .md-body ol { margin: 10px 0; padding-left: 24px; }
.md-body li { margin: 5px 0; }
.md-body blockquote { margin: 12px 0; padding: 8px 14px; border-left: 3px solid #93C5FD;
  background: #F0F7FF; color: #4B5563; border-radius: 0 6px 6px 0; }
.md-body pre.md-code { background: #1F2937; color: #E5E7EB; padding: 12px 14px; border-radius: 8px;
  overflow-x: auto; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.7; }
.md-body pre.md-code code { background: none; color: inherit; padding: 0; }
.md-body code { background: #EEF2F7; color: #B4295B; padding: 1px 6px; border-radius: 5px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.md-body a { color: var(--primary); text-decoration: none; }
.md-body a:hover { text-decoration: underline; }
.md-body img { max-width: 100%; border-radius: 8px; }
.md-body hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.md-body table.md-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 12px; }
.md-body table.md-table th { background: #F5F7FB; text-align: left; padding: 8px 10px; font-weight: 600; }
.md-body table.md-table td { padding: 8px 10px; border-bottom: 1px solid #F3F4F6; }
.md-body .md-empty { color: #9CA3AF; text-align: center; padding: 40px 0; }

/* 状态标签 */
.badge-st { font-size: 11px; padding: 2px 9px; border-radius: 6px; white-space: nowrap; }
.badge-st.published { background: #DCFCE7; color: #15803D; }
.badge-st.draft { background: #FEF3C7; color: #B45309; }
.badge-pin { font-size: 11px; background: #FEE2E2; color: #B91C1C; padding: 2px 8px; border-radius: 6px; margin-left: 6px; }
td.art-title-cell { max-width: 380px; }
td.art-title-cell b { display: block; font-size: 13px; }
td.art-title-cell span { font-size: 11px; color: #9CA3AF; display: block; margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* ===== 分类树（无限层级 + 原生拖拽） ===== */
.cat-tree { margin-top: 8px; }
.empty-hint { color: #9CA3AF; text-align: center; padding: 40px 0; font-size: 13px; }

.cat-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 8px calc(10px + var(--depth, 0) * 22px);
  border: 1px solid transparent; border-radius: 8px;
  background: #fff; margin-bottom: 4px;
  position: relative; transition: background .12s, border-color .12s;
  cursor: default;
}
.cat-row:hover { background: #F8FAFF; border-color: #DBEAFE; }
.cat-row.disabled .cat-name { color: #9CA3AF; text-decoration: line-through; }

/* 拖拽手柄：只有它有 grab 光标，避免整行看起来都能拖 */
.cat-handle { cursor: grab; color: #C7CDD6; font-size: 14px; user-select: none; letter-spacing: -2px; }
.cat-handle:active { cursor: grabbing; }
.cat-row.dragging { opacity: .35; }

.cat-arrow { width: 16px; text-align: center; font-size: 10px; color: #6B7280; cursor: pointer; user-select: none; }
.cat-arrow-leaf { color: #D1D5DB; cursor: default; }
.cat-name { font-weight: 600; font-size: 13px; }
.cat-badge { font-size: 11px; background: #EEF4FF; color: #2563EB; border-radius: 6px; padding: 1px 8px; }
.cat-path { font-size: 11px; color: #B0B7C3; font-family: ui-monospace, Menlo, Consolas, monospace; }
.cat-off { font-size: 11px; background: #F3F4F6; color: #9CA3AF; border-radius: 6px; padding: 1px 8px; }
.cat-ops { margin-left: auto; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.cat-row:hover .cat-ops { opacity: 1; }

/* 落点指示：中间=成为子级，上下边缘=插入同级 */
.cat-row.drop-inside { border-color: var(--primary); background: #EFF6FF; }
.cat-row.drop-before::after,
.cat-row.drop-after::after {
  content: ''; position: absolute; left: 0; right: 0; height: 3px;
  background: var(--primary); border-radius: 2px;
}
.cat-row.drop-before::after { top: -2px; }
.cat-row.drop-after::after { bottom: -2px; }

.cat-children { position: relative; }
/* 子层左侧的引导竖线，让层级关系更直观 */
.cat-children::before {
  content: ''; position: absolute; left: 20px; top: 0; bottom: 4px;
  width: 1px; background: #E8EDF5;
}

/* 编辑分类用的弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .45);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal-box {
  background: #fff; border-radius: 12px; padding: 22px 24px;
  width: 440px; max-width: 92vw; max-height: 88vh; overflow: auto;
  box-shadow: 0 20px 48px rgba(15, 23, 42, .22);
}
.modal-box h3 { font-size: 16px; margin-bottom: 14px; }
.modal-box .frow { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.modal-box .frow > label { font-size: 12px; color: var(--muted); font-weight: 600; }

/* 淘宝客错误详情弹窗：错误文本可能很长（含阿里妈妈原始码 + 处置建议），
   必须保留换行并允许滚动，不能挤成一行 */
.tbk-err-body {
  white-space: pre-wrap; word-break: break-word;
  background: #FFF7F7; border: 1px solid #FBD5D5; border-left: 3px solid #EF4444;
  border-radius: 8px; padding: 12px 14px; margin-bottom: 4px;
  font-size: 13px; line-height: 1.7; color: #7F1D1D;
  max-height: 46vh; overflow: auto;
}

/* ===== 界面文案 ===== */
.text-group { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.text-group-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: #F8FAFF; cursor: pointer; user-select: none;
  font-weight: 600; font-size: 13px;
}
.text-group-head:hover { background: #EFF5FF; }
.text-group-sub { font-weight: 400; font-size: 12px; color: var(--muted); }
.text-group-sub b { color: var(--primary); }
.text-group.collapsed .text-group-body { display: none; }

.text-group-body { padding: 6px 14px 12px; }
.text-row {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 10px 0; border-bottom: 1px dashed #EEF1F6;
}
.text-row:last-child { border-bottom: none; }
.text-row.custom { background: #FFFBF0; margin: 0 -14px; padding: 10px 14px; border-radius: 8px; }

.text-meta { flex: 0 0 42%; display: flex; flex-direction: column; gap: 3px; }
.text-meta b { font-size: 13px; font-weight: 600; }
.text-meta code {
  font-size: 11px; color: #7C8798; background: #F3F6FA; padding: 1px 6px;
  border-radius: 5px; align-self: flex-start;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.text-remark { font-size: 11px; color: #9CA3AF; line-height: 1.5; }
.text-tag { font-size: 10px; background: #FEF3C7; color: #B45309; border-radius: 5px; padding: 1px 6px; margin-left: 6px; font-weight: 500; }

/* ===== 工具图标管理 ===== */
.icon-row {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 0; border-bottom: 1px dashed #EEF1F6;
}
.icon-row:last-child { border-bottom: none; }
.icon-row.custom { background: #FFFBF0; margin: 0 -14px; padding: 10px 14px; border-radius: 8px; }
.icon-meta { flex: 0 0 40%; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.icon-meta b { font-size: 13px; font-weight: 600; }
.icon-meta code {
  font-size: 11px; color: #7C8798; background: #F3F6FA; padding: 1px 6px;
  border-radius: 5px; align-self: flex-start;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.icon-preview {
  flex: 0 0 60px; width: 60px; height: 60px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #EDF3FF, #D8E6FF);
  border: 1px solid rgba(255,255,255,.9); font-size: 30px; line-height: 1;
  overflow: hidden;
}
.icon-preview.is-emoji { text-shadow: 0 2px 3px rgba(24,39,75,.14); }
.icon-preview-img { width: 100%; height: 100%; object-fit: contain; }
.icon-row input { flex: 1; min-width: 0; }

.text-input { flex: 1; display: flex; gap: 6px; align-items: center; }
.text-input input { flex: 1; }

/* ============ 淘宝客 ============ */
.tbk-status { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.tbk-status .pill { cursor: default; }
.pill.ok { background: #ECFDF5; color: #047857; border-color: #A7F3D0; }
.pill.warn { background: #FFFBEB; color: #B45309; border-color: #FDE68A; }
.pill.off { background: #F3F4F6; color: #6B7280; border-color: #E5E7EB; }

.tbk-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.tbk-field { display: flex; flex-direction: column; gap: 6px; }
.tbk-field > label { font-size: 12px; color: var(--muted); }
.tbk-field input { width: 100%; }
.tbk-tip { font-size: 11px; color: var(--muted); }
/* 提示里的示例值（如 PID 末段）用等宽+浅底，避免 30045678 这样的数字
   跟正文混在一起看不出是个「值」 */
.tbk-tip code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px; padding: 1px 4px; border-radius: 3px;
  background: rgba(0, 0, 0, 0.05); color: var(--text);
}

.tbk-switches { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin: 6px 0 4px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.switch input { width: auto; margin: 0; }
.tbk-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.tbk-inline input { width: 90px; }

.tbk-filter { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.tbk-filter select, .tbk-filter input { width: auto; min-width: 130px; }

.tbk-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbk-table th, .tbk-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.tbk-table th { font-size: 12px; color: var(--muted); font-weight: 500; background: #FAFBFD; }
.tbk-table .nowrap { white-space: nowrap; }
.tbk-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; background: #F3F4F6; display: inline-block; }
.tbk-thumb.ph { font-size: 11px; color: var(--muted); line-height: 48px; text-align: center; width: 48px; }
.tbk-title { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbk-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.tbk-tpwd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.tbk-msg { max-width: 420px; word-break: break-word; }
.tbk-table .btn.sm { margin-right: 6px; margin-bottom: 4px; }

.tbk-modal-box { max-width: 560px; width: 92%; }
.tbk-form2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 720px) {
  .tbk-form { grid-template-columns: 1fr; }
  .tbk-form2 { grid-template-columns: 1fr; }
}

/* ===== 排盘记录（云端收藏 + 解卦心得） ===== */
.rec-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rec-table th, .rec-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #EEF2F7; vertical-align: top; }
.rec-table th { color: #6B7280; font-weight: 600; background: #F8FAFC; position: sticky; top: 0; }
.rec-table tr:hover td { background: #F8FAFC; }
.rec-table td.rec-note { max-width: 280px; white-space: pre-wrap; word-break: break-word; color: #374151; }
.rec-sub { color: #9CA3AF; font-size: 12px; }
.rec-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #fff; }
.rec-tag-bazi { background: #B45309; }
.rec-tag-liuren { background: #0E7490; }
.rec-tag-qimen { background: #6D28D9; }
.rec-tag-ziwei { background: #B91C1C; }
.rec-tag-liuyao { background: #0F766E; }
.rec-ops { white-space: nowrap; }
.rec-lnk { color: #2563EB; cursor: pointer; font-size: 13px; }
.rec-lnk:hover { text-decoration: underline; }
.rec-lnk.rec-danger { color: #DC2626; margin-left: 8px; }
.rec-pager { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.rec-empty, .rec-loading { color: #9CA3AF; text-align: center; padding: 36px 0; font-size: 13px; }
/* 详情弹窗 */
.rec-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
.rec-kv { margin-bottom: 14px; border-bottom: 1px dashed #EEF2F7; padding-bottom: 12px; }
.rec-kv > b { display: block; font-size: 12px; color: #6B7280; margin-bottom: 6px; }
.rec-chart-json { background: #F8FAFC; border-radius: 8px; padding: 10px 12px; font-size: 12px; line-height: 1.7; max-height: 200px; overflow: auto; }
.rec-chart-json .rec-key { color: #2563EB; }
.rec-note-edit { width: 100%; min-height: 120px; box-sizing: border-box; padding: 10px 12px; border: 1px solid #D1D5DB; border-radius: 8px; font-size: 13px; line-height: 1.6; resize: vertical; }
.rec-acts { display: flex; gap: 10px; margin-top: 10px; }

/* 结构化命盘 / 卦盘渲染 */
.rec-fields { border: 1px solid #EEF2F7; border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
.rec-row { display: flex; gap: 10px; padding: 7px 12px; font-size: 13px; line-height: 1.6; }
.rec-row + .rec-row { border-top: 1px solid #F3F6FA; }
.rec-row .rec-key { flex: 0 0 108px; color: #6B7280; }
.rec-row .rec-val { flex: 1; color: #111827; word-break: break-all; }
.rec-mini { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 6px 0 10px; }
.rec-mini th { background: #F8FAFC; color: #6B7280; font-weight: 600; text-align: left; padding: 7px 10px; border-bottom: 1px solid #E5E7EB; white-space: nowrap; }
.rec-mini td { padding: 7px 10px; border-bottom: 1px solid #F3F6FA; vertical-align: top; }
.rec-mini tr:hover td { background: #FCFDFF; }
.rec-b { display: inline-block; font-size: 10px; padding: 1px 5px; border-radius: 4px; margin-left: 4px; vertical-align: 1px; }
.rec-b.b-ming { background: #FEE2E2; color: #B91C1C; }
.rec-b.b-shen { background: #DBEAFE; color: #1D4ED8; }
.rec-b.b-ln { background: #FEF3C7; color: #92400E; }
.rec-verdict { background: #FFFBEB; border-left: 3px solid #F59E0B; padding: 9px 12px; border-radius: 6px; font-size: 13px; line-height: 1.65; color: #78350F; margin-bottom: 10px; }
.rec-json-wrap { margin-bottom: 14px; }
.rec-json-wrap > summary { cursor: pointer; font-size: 12px; color: #2563EB; padding: 4px 0; }
.rec-json-wrap pre.rec-chart-json { white-space: pre-wrap; word-break: break-all; max-height: 320px; margin: 6px 0 0; }

/* ---- 淘宝客：批量上下架工具栏 ---- */
.tbk-batch-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 4px 0 10px; background: #F8FAFC; border: 1px solid var(--border); border-radius: 8px; }
.tbk-batch-bar #tbk-sel-count { font-size: 13px; color: var(--muted); margin-right: auto; }
/* 勾选列：窄、居中 */
.tbk-table .tbk-check { width: 34px; text-align: center; }
.tbk-table .tbk-check input { width: 15px; height: 15px; cursor: pointer; vertical-align: middle; }
/* 万能转链解析的降级提示（部分字段需手填） */
.tbk-convert-notes { margin-top: 6px; padding: 10px 12px; background: #FFFBEB; border-left: 3px solid #F59E0B; border-radius: 6px; font-size: 12.5px; line-height: 1.6; color: #78350F; word-break: break-all; }

/* ===== 计数日历 ===== */
.cc-summary { font-size: 13px; color: #4B5563; margin: 12px 0; line-height: 1.8; }
.cc-summary b { color: #1F2937; }
.cc-week { display: flex; border-top: 1px solid #EEF0F4; border-left: 1px solid #EEF0F4; }
.cc-week span { flex: 1; text-align: center; font-size: 12px; color: #9CA3AF; padding: 8px 0; border-right: 1px solid #EEF0F4; border-bottom: 1px solid #EEF0F4; }
.cc-grid { display: flex; flex-wrap: wrap; border-left: 1px solid #EEF0F4; border-top: 1px solid #EEF0F4; }
.cc-cell {
  width: 14.2857%; box-sizing: border-box; min-height: 78px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-right: 1px solid #EEF0F4; border-bottom: 1px solid #EEF0F4; position: relative; cursor: pointer;
}
.cc-cell:hover:not(.cc-empty):not(.cc-future) { background: #F0F5FF; }
.cc-empty { background: #FAFBFC; cursor: default; }
.cc-num { font-size: 14px; color: #1F2937; font-weight: 600; }
.cc-val { font-size: 13px; color: #2563EB; font-weight: 600; margin-top: 4px; }
.cc-cell:not(.cc-empty):not(.cc-future) { background: #EEF2FF; }
.cc-today { outline: 2px solid #2563EB; outline-offset: -2px; }
.cc-future { background: #FAFBFC; cursor: default; }
.cc-future .cc-num { color: #CBD2DC; }
.cc-miss { background: #FEF2F2; }
.cc-miss-tag { position: absolute; bottom: 8px; font-size: 11px; color: #DC2626; background: #FEE2E2; border-radius: 4px; padding: 0 6px; }

/* ===== 计数日历：当日明细 / 编辑 / 变更历史 ===== */
/* 遮罩 66% + 实底白 + 强阴影：半透明弹窗会让后面的日历透上来影响阅读 */
.cc-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .66);
  display: flex; align-items: center; justify-content: center; z-index: 300;
}
.cc-mask.hidden { display: none; }
.cc-modal-box {
  background: #FFFFFF; border: 1px solid #E5E7EB; border-radius: 14px;
  width: 440px; max-width: 94vw; max-height: 88vh; overflow: auto;
  padding: 22px 24px; box-shadow: 0 24px 60px rgba(15, 23, 42, .3);
}
.cc-modal-box.wide { width: 860px; }
.cc-modal-box h3 { font-size: 16px; margin-bottom: 14px; color: #111827; }
.cc-has { cursor: pointer; }
.cc-has:hover { background: #E0EBFF; }
.cc-day-body { max-height: 56vh; overflow: auto; }
.cc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cc-table th, .cc-table td {
  padding: 9px 10px; border-bottom: 1px solid #EEF2F7;
  text-align: left; vertical-align: top;
}
.cc-table th { background: #F8FAFC; color: #6B7280; font-weight: 600; position: sticky; top: 0; }
.cc-table .cc-note { max-width: 220px; word-break: break-word; white-space: pre-wrap; }
.cc-ops { white-space: nowrap; }
.cc-ops .rec-lnk { margin-right: 10px; }
.cc-edited {
  font-size: 11px; color: #B45309; background: #FEF3C7;
  border-radius: 4px; padding: 1px 6px; white-space: nowrap;
}
.cc-preview {
  font-size: 12.5px; color: #1D4ED8; background: #EFF6FF;
  border-radius: 8px; padding: 10px 12px; margin-top: 14px;
}
.cc-logs-title { font-size: 13px; font-weight: 600; color: #374151; margin: 18px 0 10px; }
.cc-log { border-left: 3px solid #DBEAFE; padding: 6px 0 6px 12px; margin-bottom: 10px; }
.cc-log-tag {
  font-size: 11px; color: #1D4ED8; background: #DBEAFE;
  border-radius: 4px; padding: 2px 8px; margin-right: 8px;
}
.cc-log-tag.del { color: #B91C1C; background: #FEE2E2; }
.cc-log-who { font-size: 12px; color: #4B5563; margin-right: 8px; }
.cc-log-time { font-size: 11px; color: #9CA3AF; }
.cc-log-sum { font-size: 12px; color: #6B7280; margin-top: 4px; line-height: 1.6; }

/* 补录弹窗表单字段（复用 modal-box/modal-acts） */
.modal-body { padding: 6px 2px 14px; }
.fld { display: block; font-size: 12px; color: #6B7280; margin: 12px 0 4px; }
.inp { width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1px solid #D8DEE8; border-radius: 8px; font-size: 14px; }
.inp:focus { outline: none; border-color: #2563EB; }

/* ===== 在线代码运行（配置 / 自检 / 审计） ===== */
.code-deploy {
  border-radius: 10px; padding: 12px 16px; margin: 12px 0 18px;
  font-size: 13px; line-height: 1.7;
}
.code-deploy.ready { background: #ECFDF5; border: 1px solid #A7F3D0; color: #065F46; }
.code-deploy.notready { background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; }
.code-deploy code, .code-health code {
  font-family: 'Courier New', Consolas, monospace; font-size: 12px;
  background: rgba(0,0,0,.05); border-radius: 4px; padding: 1px 5px;
}
.code-form { margin-top: 6px; }
.code-health {
  margin-top: 16px; border-radius: 10px; padding: 12px 16px;
  font-size: 13px; line-height: 1.7; display: none;
}
.code-health:not(:empty) { display: block; }
.code-health.ok { background: #ECFDF5; border: 1px solid #A7F3D0; color: #065F46; }
.code-health.warn { background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; }
.code-health.bad { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; }
.code-st { font-size: 11px; padding: 2px 9px; border-radius: 6px; white-space: nowrap; }
.code-st.ok { background: #DCFCE7; color: #15803D; }
.code-st.warn { background: #FEF3C7; color: #B45309; }
.code-st.bad { background: #FEE2E2; color: #B91C1C; }

@media (max-width: 900px) {
  .row4 { grid-template-columns: 1fr 1fr; }
}

/* ===== 在线代码运行：语言多选 / AI 配置 / 语言探测 pill ===== */
.lang-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px; margin-top: 8px;
}
.lang-chk {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  border: 1px solid #E5E7EB; border-radius: 8px; padding: 9px 12px;
  cursor: pointer; background: #fff;
}
.lang-chk input { width: auto; margin: 0; }
.lang-chk span { flex: 1; }
.lang-chk em { font-style: normal; font-size: 11px; color: #B45309; }
.lang-chk em.ok { color: #15803D; }
.lang-chk.off { background: #F9FAFB; color: #9CA3AF; cursor: not-allowed; }
.lang-tools { margin-top: 10px; display: flex; gap: 8px; }

.lang-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.lang-pill {
  font-size: 11px; padding: 3px 10px; border-radius: 999rpx;
  border: 1px solid #E5E7EB; white-space: nowrap;
}
.lang-pill.on { background: #DCFCE7; color: #15803D; border-color: #BBF7D0; }
.lang-pill.off { background: #F3F4F6; color: #9CA3AF; }

.ai-cfg {
  margin-top: 22px; border: 1px solid #EDE9FE; border-radius: 12px;
  padding: 16px 18px; background: #FCFBFF;
}
.ai-cfg h4 { margin: 0 0 8px; font-size: 15px; color: #6D28D9; }
.ai-cfg .hint { background: #F5F3FF; border-left-color: #C4B5FD; }
.ai-cfg .hint b { color: #6D28D9; }

/* ===== 项目回收站 + 补录规则 ===== */
.trash-cfg { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; padding: 6px 0 4px; }
.trash-cfg .fld { margin: 0 0 4px; width: 100%; }
.trash-cfg .inp { width: 180px; }
.trash-cfg .btn { flex: none; }
.trash-cfg-tip { font-size: 12px; color: var(--muted); padding-bottom: 9px; }
.trash-owner {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: #F3F4F6; color: #6B7280;
}
.trash-owner.team { background: #EEF2FF; color: #4338CA; }
.trash-ops { white-space: nowrap; }
.trash-ops .btn.sm { margin-right: 6px; }

/* ===== 大模型接入配置（后台可改） ===== */
.ai-endpoint {
  margin-top: 14px; padding: 14px 16px; border-radius: 10px;
  background: #fff; border: 1px solid #EDE9FE;
}
.ai-endpoint .row4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ai-src {
  font-size: 12px; color: #6D28D9; background: #F5F3FF;
  border: 1px solid #EDE9FE; border-radius: 8px;
  padding: 7px 12px; margin-bottom: 12px;
}
.ai-src b { color: #5B21B6; }
.ai-cfg-ops { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.ai-cfg-ops .btn.sm { flex: none; }
#code-ai-cfg-logs table { width: 100%; font-size: 12px; }

@media (max-width: 900px) {
  .lang-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .ai-endpoint .row4 { grid-template-columns: 1fr; }
}
