/* 小红书发布管理后台 —— 简洁风格 */

:root {
  --red: #ff2e4d;
  --red-dark: #e5203d;
  --red-soft: #fff1f3;
  --ink: #16161a;
  --ink-2: #4a4a52;
  --gray: #8a8a94;
  --gray-light: #b8b8c0;
  --line: #ebebf0;
  --line-2: #f5f5f8;
  --bg: #f7f7f9;
  --white: #fff;
  --ok: #00b578;
  --ok-soft: #e8f9f2;
  --warn: #ff8f1f;
  --warn-soft: #fff5e8;
  --err: #f5222d;
  --err-soft: #fff1f0;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(22, 22, 26, .04), 0 1px 2px rgba(22, 22, 26, .06);
  --shadow-lg: 0 4px 16px rgba(22, 22, 26, .08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ---------------- 布局 ---------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px;
  flex: none;
  background: var(--white);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--line-2);
}
.logo {
  width: 34px; height: 34px; flex: none;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--red), #ff5b7a);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600;
}
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: -.2px; }
.brand-sub { font-size: 10px; color: var(--gray-light); letter-spacing: .3px; }

nav { padding: 12px 10px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
  transition: .15s;
  margin-bottom: 2px;
  text-decoration: none;
}
.nav-item:hover { background: var(--line-2); }
.nav-item.active { background: var(--red-soft); color: var(--red); font-weight: 500; }
.nav-item .ico { font-size: 13px; width: 16px; text-align: center; opacity: .85; }

.sidebar-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between;
}
.mock-badge {
  font-size: 10px; padding: 3px 7px;
  background: var(--warn-soft); color: var(--warn);
  border-radius: 4px; font-weight: 500;
}
.mock-badge.live { background: var(--ok-soft); color: var(--ok); }
.ver { font-size: 10px; color: var(--gray-light); }

.main { flex: 1; padding: 26px 30px; max-width: 1240px; min-width: 0; }

.view { display: none; }
.view.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

/* ---------------- 页头 ---------------- */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 22px; gap: 16px;
}
.page-head h1 { font-size: 21px; font-weight: 600; letter-spacing: -.4px; }
.page-head .sub { font-size: 13px; color: var(--gray); margin-top: 2px; }
.head-actions { display: flex; gap: 8px; align-items: center; }

/* ---------------- 按钮 ---------------- */
.btn {
  padding: 8px 15px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--ink-2);
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--gray-light); background: #fcfcfd; }
.btn.primary {
  background: var(--red); border-color: var(--red); color: #fff; font-weight: 500;
}
.btn.primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn.sm { padding: 5px 11px; font-size: 12px; }
.btn.danger { color: var(--err); }
.btn.danger:hover { background: var(--err-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.select {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 13px; font-family: inherit;
  color: var(--ink); cursor: pointer; outline: none;
}
.select.w100 { width: 100%; }
.select:focus { border-color: var(--red); }

/* ---------------- 卡片 ---------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px 18px;
  box-shadow: var(--shadow);
  transition: .15s;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.card-label { font-size: 12px; color: var(--gray); margin-bottom: 6px; }
.card-num {
  font-size: 27px; font-weight: 600; line-height: 1.1;
  letter-spacing: -.8px; font-variant-numeric: tabular-nums;
}
.card-foot { font-size: 11px; color: var(--gray-light); margin-top: 5px; }
.card.ok .card-num { color: var(--ok); }
.card.warn .card-num { color: var(--warn); }
.card.err .card-num { color: var(--err); }

/* ---------------- 面板 ---------------- */
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}
.panel.narrow { max-width: 720px; }
.panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between;
}
.panel-head h2 { font-size: 14px; font-weight: 600; }
.panel-actions { display: flex; gap: 7px; }
.sub-panel-head {
  padding: 8px 12px;
  margin: 4px 0 12px;
  background: #f3f6f9;
  border-left: 3px solid #ff2442;
  font-size: 12px;
  font-weight: 600;
  color: #1f2329;
  border-radius: 3px;
}
.link {
  font-size: 12px; color: var(--red); cursor: pointer; text-decoration: none;
}
.link:hover { text-decoration: underline; }

.panel-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 1000px) { .panel-grid { grid-template-columns: 1fr; } }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 10px 18px;
  font-size: 11px;
  font-weight: 500;
  color: var(--gray);
  background: #fcfcfd;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .4px;
}
td {
  padding: 11px 18px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fcfcfd; }
td.empty {
  text-align: center; color: var(--gray-light);
  padding: 32px; font-size: 13px;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px; color: var(--ink-2);
}
.ttl {
  max-width: 320px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.tag.pending { background: var(--line-2); color: var(--gray); }
.tag.success { background: var(--ok-soft); color: var(--ok); }
.tag.filled  { background: var(--warn-soft); color: var(--warn); }
.tag.failed  { background: var(--err-soft); color: var(--err); }
.tag.immediate { background: #eef4ff; color: #2f6fed; }
.tag.scheduled { background: #f5f0ff; color: #7a4fed; }
.tag.warn-tag { background: var(--warn-soft); color: var(--warn); }

/* 表格单元格内的副文本（如发布时间原文，保留核对） */
.cell-sub {
  margin-top: 2px;
  font-size: 11px;
  color: var(--gray);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 备用入口占位区（数据分析等） */
.placeholder-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 80px 20px;
  text-align: center;
}
.placeholder-ico { font-size: 56px; line-height: 1; }
.placeholder-title { font-size: 18px; font-weight: 600; color: var(--txt, #1f2329); }
.placeholder-desc { font-size: 13px; color: var(--gray); max-width: 460px; line-height: 1.7; }

/* ---------------- 健康检查 ---------------- */
.health { list-style: none; padding: 14px 18px; }
.health li {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 0; font-size: 13px;
}
.hdot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gray-light); flex: none;
}
.hdot.ok { background: var(--ok); }
.hdot.err { background: var(--err); }
.hdot.warn { background: var(--warn); }
.hname { flex: 1; color: var(--ink-2); }
.hval { font-size: 12px; color: var(--gray); }

.tips {
  margin: 4px 18px 18px;
  padding: 13px 15px;
  background: var(--red-soft);
  border-radius: var(--radius-sm);
  border: 1px solid #ffe0e5;
}
.tips-title {
  font-size: 12px; font-weight: 600; color: var(--red); margin-bottom: 7px;
}
.tips ul { list-style: none; }
.tips li {
  font-size: 12px; color: var(--ink-2); padding: 2px 0 2px 13px;
  position: relative; line-height: 1.65;
}
.tips li::before {
  content: '·'; position: absolute; left: 3px; color: var(--red); font-weight: 700;
}
.tips b { color: var(--red); }

/* ---------------- 表单 ---------------- */
.form { padding: 18px; }
.fg { margin-bottom: 15px; }
.fg label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500;
}
.counter {
  font-size: 11px; color: var(--gray-light); font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.counter.over { color: var(--err); font-weight: 600; }
.fg input[type=text], .fg input[type=password], .fg input[type=number],
.fg input[type=datetime-local], .fg textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  transition: .15s;
  background: var(--white);
}
.fg textarea { resize: vertical; line-height: 1.65; min-height: 70px; }
.fg input:focus, .fg textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 46, 77, .07);
}
.fg input.invalid, .fg textarea.invalid { border-color: var(--err); }
.hint { font-size: 11px; color: var(--gray-light); margin-top: 5px; line-height: 1.5; }
.hint.err { color: var(--err); }
.hint.ok { color: var(--ok); }
.img-upload-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.img-upload-bar .hint { margin-top: 0; }
.fg-row { display: flex; gap: 12px; }
.fg-row .fg { flex: 1; }
.btn-row { display: flex; gap: 9px; margin-top: 18px; }

.create-grid {
  display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: start;
}
.create-left { min-width: 0; }
.create-right {
  width: 480px; max-height: calc(100vh - 140px); overflow: hidden;
  transition: width .3s ease, opacity .2s ease;
}
.create-right.collapsed {
  width: 0; opacity: 0; pointer-events: none;
  padding: 0; border: 0;
}
.create-actions {
  display: flex; gap: 10px; margin-top: 16px;
}
.create-actions .btn { flex: none; }
@media (max-width: 1100px) {
  .create-grid { grid-template-columns: 1fr; }
  .create-right { width: 100%; }
}

/* ---------------- JSON 预览 ---------------- */
.json-preview {
  margin: 0; padding: 16px 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px; line-height: 1.7;
  background: #fbfbfc;
  color: var(--ink-2);
  overflow-x: auto;
  max-height: 460px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word;
}
.json-preview .k { color: #c41d7f; }
.json-preview .s { color: #0958d9; }
.json-preview .n { color: #d46b08; }
.json-preview .b { color: #7a4fed; }

.validate-box { padding: 0 18px 18px; }
.vmsg {
  display: flex; align-items: flex-start; gap: 7px;
  font-size: 12px; padding: 8px 11px; border-radius: var(--radius-sm);
  margin-bottom: 6px; line-height: 1.5;
}
.vmsg { background: var(--line-2); color: var(--ink-2); }
.vmsg.ok { background: var(--ok-soft); color: #00875a; }
.vmsg.err { background: var(--err-soft); color: #cf1322; }
.vmsg .vi { flex: none; font-weight: 700; }

.conn-result { margin-top: 13px; font-size: 12px; }
.conn-result .ok { color: var(--ok); }
.conn-result .err { color: var(--err); }
.conn-result pre {
  margin-top: 7px; padding: 11px; background: #fbfbfc;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px; overflow-x: auto; color: var(--ink-2);
  max-height: 200px; overflow-y: auto;
}

/* ---------------- API 文档 ---------------- */
.api-docs { padding: 6px 18px 18px; }
.api-item {
  padding: 13px 0; border-bottom: 1px solid var(--line-2);
}
.api-item:last-child { border: none; }
.api-line { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; }
.method {
  font-size: 10px; font-weight: 700; padding: 2px 7px;
  border-radius: 3px; letter-spacing: .3px;
}
.method.get { background: #e8f4ff; color: #0958d9; }
.method.post { background: var(--ok-soft); color: #00875a; }
.api-path {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px; color: var(--ink);
}
.api-desc { font-size: 12px; color: var(--gray); line-height: 1.6; }
.api-desc code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px; background: var(--line-2);
  padding: 1px 5px; border-radius: 3px; color: var(--ink-2);
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; bottom: 26px; left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: rgba(22, 22, 26, .9);
  color: #fff; padding: 10px 18px;
  border-radius: 20px; font-size: 13px;
  opacity: 0; transition: .22s; pointer-events: none;
  z-index: 999; max-width: 80vw; text-align: center;
  backdrop-filter: blur(8px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: none; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 85vh; display: flex; flex-direction: column;
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-md { width: 480px; }
.modal-lg { width: 640px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16px; }
.modal-close {
  background: none; border: 0; font-size: 22px; cursor: pointer;
  color: var(--gray); line-height: 1; padding: 4px 8px;
}
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ---------------- 笔记预览（小红书风格） ---------------- */
.note-preview {
  background: #fff; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line);
}
.note-cover {
  width: 100%; aspect-ratio: 3/4; background: #f0f0f0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.note-cover img { width: 100%; height: 100%; object-fit: cover; }
.note-content { padding: 16px; }
.note-title {
  font-size: 17px; font-weight: 600; color: var(--ink);
  line-height: 1.5; margin-bottom: 10px;
}
.note-body {
  font-size: 14px; color: var(--ink-2); line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
  margin-bottom: 12px;
}
.note-topics {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px;
}
.note-topics span {
  color: #0066cc; font-size: 13px; cursor: pointer;
}
.note-meta {
  font-size: 12px; color: var(--gray);
  display: flex; gap: 12px; padding-top: 10px;
  border-top: 1px solid var(--line-2);
}
.note-imgs-more {
  margin-top: 8px; font-size: 12px; color: var(--gray);
  text-align: center;
}
.note-img-thumbs {
  display: flex; gap: 6px; padding: 0 16px 12px;
  overflow-x: auto;
}
.note-img-thumbs img {
  width: 60px; height: 60px; object-fit: cover;
  border-radius: 6px; flex: none; cursor: pointer;
  border: 2px solid transparent;
}
.note-img-thumbs img.active { border-color: var(--red); }

/* 编辑弹窗：图片上传工具 + 缩略图 */
.img-tools {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px;
}
.img-thumbs {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px;
  min-height: 0;
}
.img-thumbs:empty { display: none; }
.img-thumbs .thumb {
  position: relative;
  width: 72px; height: 72px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--line-2);
  border: 1px solid var(--line);
  flex: none;
}
.img-thumbs .thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.img-thumbs .thumb .idx {
  position: absolute; left: 2px; top: 2px;
  font-size: 11px; line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(0,0,0,.55);
  color: #fff;
  pointer-events: none;
}
.img-thumbs .thumb .cover-flag {
  position: absolute; right: 2px; top: 2px;
  font-size: 10px; line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  background: var(--red);
  color: #fff;
  pointer-events: none;
}
.img-thumbs .thumb .del {
  position: absolute; right: 2px; bottom: 2px;
  width: 20px; height: 20px;
  border: 0; border-radius: 50%;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 12px; line-height: 18px;
  cursor: pointer;
  display: none;
  padding: 0;
}
.img-thumbs .thumb:hover .del { display: block; }
.img-thumbs .thumb.broken img { opacity: .25; }

/* 缩略图 hover 预览大图 */
.img-thumbs .thumb .hover-preview {
  position: absolute;
  display: none;
  z-index: 9999;
  pointer-events: none;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  padding: 4px;
  max-width: 360px;
  max-height: 360px;
}
.img-thumbs .thumb .hover-preview img {
  display: block;
  max-width: 360px;
  max-height: 360px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.img-thumbs .thumb:hover .hover-preview { display: block; }

/* AI 工具按钮行 */
.ai-tools {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px;
}

/* AI 弹窗 */
.prompt-row {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
}
.ai-form .fg { min-width: 0; }
.ai-form textarea#aiPromptText { width: 100%; resize: vertical; }
.ai-status {
  font-size: 12px; color: var(--gray);
  margin: 10px 0 4px;
  min-height: 18px;
}
.ai-status.err { color: var(--err); }
.ai-status.ok { color: var(--ok); }
.ai-results {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 50vh; overflow: auto;
  margin-top: 8px;
}
.ai-results:empty { display: none; }
.ai-result {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex; gap: 10px; align-items: flex-start;
}
.ai-result .ai-text {
  flex: 1; min-width: 0;
  white-space: pre-wrap; word-break: break-word;
  font: 13px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
}
.ai-result .ai-meta {
  font-size: 11px; color: var(--gray);
  margin-top: 6px;
}
.ai-line { font-size: 12px; line-height: 1.6; margin-bottom: 4px; }
.ai-line b { color: #555; font-weight: 600; margin-right: 4px; }
.topic-chip {
  display: inline-block;
  background: #eef6ff; color: #2f7dff;
  padding: 1px 6px; border-radius: 8px;
  font-size: 11px; margin-right: 4px; margin-bottom: 2px;
}
.ai-result .ai-actions {
  display: flex; flex-direction: column; gap: 6px;
  flex: none;
}
.ai-result.loading .ai-text::after {
  content: ' …';
  animation: ai-blink 1s steps(2, start) infinite;
}
@keyframes ai-blink { 50% { opacity: 0; } }
.ai-result.err { border-color: var(--err); background: var(--err-soft); }

/* === AI 生成图文 → 批量复制工具栏 === */
.ai-batch-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(180deg, var(--primary-soft, #eef2ff), transparent);
  border: 1px dashed var(--primary, #6366f1);
  border-radius: 8px;
  margin-bottom: 12px;
}
.ai-batch-bar input[type="number"] {
  width: 70px; padding: 4px 6px; border: 1px solid var(--border, #ddd);
  border-radius: 4px; font-size: 13px;
}

/* === 批量任务卡区域 === */
.batch-cards-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; margin-top: 18px; margin-bottom: 8px;
  background: var(--primary-soft, #eef2ff);
  border-left: 4px solid var(--primary, #6366f1);
  border-radius: 4px;
  font-size: 14px;
}

/* 横向 3 列布局：每个 .create-grid 从左到右排开，最多 3 列，超出自动换到下一行 */
#batchCardsGrid {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  gap: 16px;
  margin-top: 16px;
}
/* 进入批量模式：把原"单卡"create-grid 整块隐藏，避免与批量卡重复展示 */
#view-create.batch-mode > .create-grid { display: none !important; }
#view-create.batch-mode > .batch-mode-hint { display: block; }

/* 每个 .create-grid 子卡(批量卡):固定 1/3 列宽,保留单卡原本的 grid 排版(左右两列,只是右列已 remove) */
#batchCardsGrid > .create-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;  /* 占位:即便只剩 left,grid 也能正常排 */
  gap: 16px;
  flex: 0 0 calc((100% - 32px) / 3);  /* 3 列,中间 2 个 gap=16px → 共 32px */
  max-width: calc((100% - 32px) / 3);
  min-width: 360px;                    /* 低于此宽度时换行,而不是压缩到 1/3 极窄 */
  box-sizing: border-box;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
/* 中屏(<1100px):1 行 2 张 */
@media (max-width: 1200px) {
  #batchCardsGrid > .create-grid {
    flex: 0 0 calc((100% - 16px) / 2);
    max-width: calc((100% - 16px) / 2);
  }
}
/* 窄屏(<760px):1 行 1 张 */
@media (max-width: 760px) {
  #batchCardsGrid > .create-grid {
    flex: 0 0 100%;
    max-width: 100%;
  }
}
/* 批量卡内 .create-left 占满整行(右侧 .create-right 已被 JS 移除) */
#batchCardsGrid > .create-grid .create-left {
  grid-column: 1 / -1;  /* 横跨整行 */
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 14px 16px;
  min-width: 0;
}
/* 批量卡内 .create-right:JS 已 remove,这里兜底隐藏以防万一 */
#batchCardsGrid > .create-grid .create-right { display: none !important; }
/* 批量卡头部条 */
#batchCardsGrid > .create-grid > .batch-card-head {
  grid-column: 1 / -1;  /* 头部横跨两列 */
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(180deg, #f3f4f6, #fff);
  border-bottom: 1px solid var(--border, #e5e7eb);
  border-radius: 10px 10px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}
#batchCardsGrid .batch-head-actions {
  display: flex; gap: 6px; align-items: center;
}
#batchCardsGrid > .create-grid .panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0 10px 0;
  border-bottom: 1px solid var(--border, #e5e7eb);
  margin-bottom: 12px;
}
#batchCardsGrid > .create-grid .panel-head h2 { font-size: 15px; margin: 0; }
/* 缩窄的样式(批量卡可适当紧凑) */
#batchCardsGrid .form { gap: 10px; }
#batchCardsGrid .form .fg { margin-bottom: 10px; }
#batchCardsGrid .form textarea { min-height: 90px; }
#batchCardsGrid .form .counter { font-size: 11px; }
#batchCardsGrid .create-actions { padding: 8px 0 0 0; margin-top: 10px; border-top: 1px solid var(--border, #e5e7eb); }
#batchCardsGrid .batch-submit-btn { min-width: 140px; padding: 8px 16px; }
#batchCardsGrid .img-upload-bar { display: none; } /* 批量卡不要上传工具条(图片复用第一张) */
#batchCardsGrid .json-preview { font-size: 12px; max-height: 420px; overflow: auto; }
#batchCardsGrid .ai-rewrite-btn,
#batchCardsGrid .ai-genfull-btn { display: none !important; } /* 批量卡隐藏 AI 改写/生成 */
#batchCardsGrid .ai-tools { display: none !important; }
#batchCardsGrid input[readonly],
#batchCardsGrid textarea[readonly],
#batchCardsGrid select[readonly] { background: #f3f4f6; color: #6b7280; cursor: not-allowed; }
#batchCardsGrid .batch-shared-hint { font-size: 11px; color: #6b7280; margin-top: 4px; }

/* 提示行：单卡隐藏、批量模式显示 */
.batch-mode-hint { display: none; padding: 10px 14px; background: #fef3c7; border: 1px solid #fde68a; border-radius: 6px; margin: 12px 0; font-size: 13px; color: #92400e; }

/* AI 生图弹窗：网格化缩略图 + 复选 */
.ai-img-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 10px;
  max-height: 50vh; overflow: auto;
}
.ai-img-results:empty { display: none; }
.ai-img-card {
  position: relative;
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s, transform .15s;
}
.ai-img-card:hover { transform: translateY(-2px); border-color: var(--brand); }
.ai-img-card.selected { border-color: var(--red); box-shadow: 0 0 0 2px var(--red-soft); }
.ai-img-card .ai-img {
  display: block; width: 100%; height: 180px; object-fit: cover;
  background: var(--line-2);
}
.ai-img-card .ai-img-checkbox {
  position: absolute; left: 8px; top: 8px;
  width: 20px; height: 20px;
  border-radius: 4px;
  background: rgba(255,255,255,.85);
  border: 1.5px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--red);
  font-weight: 700;
}
.ai-img-card.selected .ai-img-checkbox { background: var(--red); color: #fff; border-color: var(--red); }
.ai-img-card .ai-img-meta {
  position: absolute; right: 6px; bottom: 6px;
  background: rgba(0,0,0,.6);
  color: #fff; font-size: 11px;
  padding: 2px 6px; border-radius: 4px;
}
.ai-img-card.loading .ai-img { opacity: .4; }
.ai-img-card.err { border-color: var(--err); background: var(--err-soft); }
.ai-img-card.err .ai-img { display: none; }
.ai-img-card.err::after {
  content: '生成失败'; display: block; padding: 30px 8px; text-align: center; color: var(--err); font-size: 12px;
}
.ai-img-card .ai-img-actions {
  position: absolute; right: 6px; top: 6px;
  display: flex; gap: 4px;
}
.ai-img-card .ai-img-actions .icon-btn {
  background: rgba(255,255,255,.85);
  border: 1px solid var(--line);
  border-radius: 4px;
  width: 24px; height: 24px;
  font-size: 12px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* 绿色「保存为模版」按钮 */
.btn.save-tpl {
  margin-left: 8px;
  background: #00b578;
  color: #fff;
  border: 0;
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
}
.btn.save-tpl:hover { background: #009b65; }
.btn.save-tpl:active { background: #008955; }

/* AI 改写正文按钮：红色背景，更醒目 */
.btn.ai-rewrite-btn {
  background: #ff2442;
  border-color: #ff2442;
  color: #fff;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(255,36,66,.25);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn.ai-rewrite-btn:hover { background: #e51d39; border-color: #e51d39; }
.btn.ai-rewrite-btn:active { background: #cc1932; border-color: #cc1932; }

/* AI 生成图文按钮：绿色背景，强调可一键生成全套内容 */
.btn.ai-genfull-btn {
  background: #00b578;
  border-color: #00b578;
  color: #fff;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0,181,120,.25);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn.ai-genfull-btn:hover { background: #00a067; border-color: #00a067; }
.btn.ai-genfull-btn:active { background: #008955; border-color: #008955; }

/* label 行内嵌按钮：左标题 + 右按钮，flex 排开 */
label.ai-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
label.ai-label-row > span:first-child {
  flex: 1;
  min-width: 0;
}

/* 小弹窗 */
.modal.modal-sm { max-width: 420px; }

/* 滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #dcdce4; border-radius: 5px; border: 2px solid var(--white);
}
::-webkit-scrollbar-thumb:hover { background: #c4c4d0; }

/* ================================================================ 批次5：登录态 / 用户角色管理 */

/* ---------------- 登录 / 注册 / 找回密码 全屏卡片 ---------------- */
.auth-wrap { display: none; }
body.is-auth { background: var(--bg); }
body.is-auth .layout { display: none; }
body.is-auth .auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.auth-card {
  display: none;
  width: 380px;
  max-width: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 26px 26px 22px;
}
.auth-card.active { display: block; animation: fade .2s ease; }
.auth-card .form { padding: 0; margin-top: 18px; }
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.auth-logo {
  width: 30px; height: 30px; flex: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--red), #ff5b7a);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
}
.auth-title {
  margin-top: 16px;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}
.auth-card .fg input[type=text],
.auth-card .fg input[type=password],
.auth-card .fg input[type=email] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  transition: .15s;
  background: var(--white);
}
.auth-card .fg input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 46, 77, .07);
}
.auth-err {
  display: none;
  color: var(--err);
  font-size: 12px;
  line-height: 1.5;
  margin: -4px 0 10px;
  min-height: 0;
}
.btn.block { width: 100%; }
.auth-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 13px;
  font-size: 12px;
}
.auth-links a { color: var(--red); text-decoration: none; cursor: pointer; }
.auth-links a:hover { color: var(--red-dark); text-decoration: underline; }
.auth-code-row { display: flex; gap: 8px; }
.auth-code-row input { flex: 1; min-width: 0; }
.auth-code-row .btn { flex: none; white-space: nowrap; }

/* 登录卡片之外的通用邮箱输入框（沿用 .fg 同款外观） */
.fg input[type=email] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  background: var(--white);
}
.fg input[type=email]:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 46, 77, .07);
}

/* ---------------- 侧边栏账号区 ---------------- */
.sidebar-foot {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.nav-account {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 2px;
}
.nav-account-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-account-email {
  font-size: 11px;
  color: var(--gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-logout { width: 100%; margin-top: 6px; }

/* ---------------- 超管「所属用户」列（非超管隐藏） ---------------- */
body:not(.is-super) .col-owner { display: none; }

/* ---------------- 通用小元件 ---------------- */
.muted { color: var(--gray); font-size: 12px; }
code.muted { font-family: inherit; background: none; }

.input {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  background: var(--white);
  transition: .15s;
}
.input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 46, 77, .07);
}

.form-err {
  color: var(--err);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 10px;
  min-height: 0;
}

.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.err-tag { background: var(--err-soft); color: var(--err); }

/* 行内操作按钮组 */
.row-actions { white-space: nowrap; }
.row-actions .btn { margin-right: 5px; }
.row-actions .btn:last-child { margin-right: 0; }

/* 分页条 */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 14px;
}
.pager-info { font-size: 12px; color: var(--gray); font-variant-numeric: tabular-nums; }

/* ---------------- 权限勾选组 / 角色弹窗 ---------------- */
.perm-group {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}
.perm-group-title {
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--line-2);
}
.perm-group-items {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px 14px;
  padding: 8px 12px;
}
.check-line {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  padding: 4px 2px;
  line-height: 1.5;
}
.check-line input { margin-top: 3px; flex: none; }
.check-line code {
  margin-left: 5px;
  font-size: 11px;
  color: var(--gray);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.perm-group-items .check-line .tag { margin-left: 5px; vertical-align: 1px; }

/* 分配角色弹窗：整行排列 */
#assignRoleList { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
#assignRoleList .check-line { padding: 6px 4px; border-radius: var(--radius-sm); }
#assignRoleList .check-line:hover { background: var(--line-2); }

/* 重置密码一次性明文展示 */
.one-time-pwd {
  margin: 8px 0;
  padding: 9px 11px;
  background: var(--line-2);
  border: 1px dashed var(--gray-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
  user-select: all;
  word-break: break-all;
}
