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

:root {
  --bg: #f5ebe0;
  --panel: #fdf9f4;
  --brown: #5c3d2e;
  --accent: #c45c26;
  --border: #d4b896;
  --user-bg: #fff8f0;
  --bot-bg: #ffffff;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--brown);
  min-height: 100vh;
}

.layout { max-width: 100%; width: 100%; margin: 0 auto; padding: 12px 20px; }

.header {
  text-align: center;
  padding: 16px 0 20px;
  border-bottom: 2px dashed var(--border);
  margin-bottom: 16px;
}
.header h1 { font-size: 28px; }
.header p { color: #8b7355; margin-top: 6px; font-size: 14px; }

.header-nav {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 12px;
}
.header-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-family: inherit;
  display: inline-block;
}
.header-link-primary {
  background: #8b3dff;
  color: #fff !important;
  border-color: #8b3dff;
  font-weight: 600;
}
.header-link-primary:hover { opacity: 0.92; }
  background: rgba(196, 92, 38, 0.08);
}
.header-btn {
  text-decoration: none;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 6px 14px;
}
.header-btn:hover {
  background: #fffaf6;
}
.header-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

body.modal-open { overflow: hidden; }

.ref-profiles-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.ref-profiles-modal[hidden] { display: none; }

.ref-profiles-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(92, 61, 46, 0.45);
}

.ref-profiles-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  max-height: 80vh;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(92, 61, 46, 0.18);
}

.ref-profiles-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px dashed var(--border);
  flex-shrink: 0;
}
.ref-profiles-header h2 {
  font-size: 18px;
  color: var(--brown);
  margin: 0;
}
.ref-profiles-meta {
  font-size: 12px;
  margin-top: 4px;
}
.ref-profiles-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: #8b7355;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
}
.ref-profiles-close:hover { color: var(--brown); }

.ref-profiles-back {
  display: inline-block;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 0 6px;
  margin-bottom: 2px;
  font-family: inherit;
}
.ref-profiles-back:hover { text-decoration: underline; }

.ref-profiles-list {
  overflow-y: auto;
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
}

.ref-loading { text-align: center; padding: 24px 0; }

.ref-profile-card {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ref-profile-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(196, 92, 38, 0.12);
}

.ref-profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.ref-profile-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--brown);
}
.ref-profile-stats {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}
.ref-profile-top {
  font-size: 11px;
  line-height: 1.4;
}

.ref-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  flex-shrink: 0;
}
.status-ok { background: #e8f5ee; color: #1e4d38; }
.status-partial { background: #fff8e6; color: #8a6d00; }
.status-empty { background: #f0f0f0; color: #888; }

.ref-note-row {
  display: block;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
}
.ref-note-row:hover {
  border-color: var(--accent);
}
.ref-note-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--brown);
  line-height: 1.4;
  margin-bottom: 4px;
}
.ref-note-meta {
  font-size: 12px;
  color: #888;
}
.ref-note-excerpt {
  font-size: 12px;
  margin-top: 6px;
  line-height: 1.45;
}

.status-bar {
  margin-top: 10px;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
  display: inline-block;
}
.status-bar.ready { background: #e8f5ee; border-color: #2d6a4f; color: #1e4d38; }
.status-bar.warn { background: #fff0ee; border-color: #e85d4c; color: #8b3a32; }

.main {
  display: grid;
  /* 左侧对话区占 5/9（比原 1:1.4 宽约 +50%），右侧预览区 4/9 */
  grid-template-columns: minmax(720px, 5fr) minmax(480px, 4fr);
  gap: 20px;
  min-height: calc(100vh - 120px);
}

.chat-panel {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 2px dashed var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 480px;
  max-height: calc(100vh - 260px);
}

.msg {
  max-width: 98%;
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.55;
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.user {
  align-self: flex-end;
  background: var(--user-bg);
  border: 1px solid var(--border);
}
.msg.assistant {
  align-self: flex-start;
  background: var(--bot-bg);
  border: 1px solid #e8d5c4;
}

.input-area {
  border-top: 2px dashed var(--border);
  padding: 12px;
  background: #faf6f0;
}
.input-area textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  resize: vertical;
  font-family: inherit;
}
.input-hint {
  margin-top: 6px;
  font-size: 12px;
  color: #8b7355;
}
.input-hint kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  font-size: 11px;
  font-family: inherit;
}
.input-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--brown); color: #fff; }
.btn-secondary { background: #fff; border: 1px solid var(--border); color: var(--brown); }
.btn-accent { background: var(--accent); color: #fff; margin-left: auto; }

.side-panel {
  background: var(--panel);
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 14px;
  overflow-y: auto;
}
.side-panel h2 {
  font-size: 16px;
  margin: 12px 0 8px;
  color: var(--brown);
}
.side-panel h2:first-child { margin-top: 0; }

.upload-list { list-style: none; }
.gallery-hint { font-size: 12px; margin-bottom: 8px; line-height: 1.4; }
.gallery-product-head {
  font-size: 13px;
  font-weight: 700;
  color: var(--brown);
  margin: 12px 0 6px;
  padding: 6px 10px;
  background: #fff8f2;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
}
.gallery-product-head:first-child { margin-top: 0; }
.product-gallery-grid { margin-bottom: 4px; }
.upload-product-tag {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #1e4d38;
  padding: 2px 6px;
  background: #e8f5ee;
  text-align: center;
}

.material-gallery,
.msg-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.msg-gallery {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #e8d5c4;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
}

.gallery-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
}
.gallery-card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(196,92,38,.15); }
.gallery-num {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  background: var(--brown);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}
.gallery-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: #f5f5f5;
}
.gallery-cap {
  font-size: 10px;
  line-height: 1.3;
  padding: 4px 5px;
  color: #5c3d2e;
  max-height: 2.6em;
  overflow: hidden;
}

.gallery-card-edit {
  cursor: default;
  padding-bottom: 4px;
}
.gallery-card-edit.upload-highlight {
  border-color: var(--accent);
  background: #fff8f0;
  box-shadow: 0 0 0 2px rgba(196, 92, 38, 0.25);
}
.gallery-img-btn {
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  line-height: 0;
}
.gallery-img-btn img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}
.gallery-label-input {
  width: calc(100% - 8px);
  margin: 0 4px 4px;
  font-size: 11px;
  padding: 3px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.gallery-card-edit .upload-type {
  margin: 2px 4px 0;
  align-self: flex-start;
}

.material-carousel {
  border: 1px solid #ead8c8;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  margin-bottom: 10px;
}
.material-gallery.material-gallery-carousel {
  display: block;
  grid-template-columns: none;
  gap: 0;
  margin-top: 8px;
}
.material-viewer {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  gap: 6px;
  align-items: center;
}
.material-main-img {
  width: 100%;
  min-height: 220px;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border: 1px solid #e8d5c4;
  border-radius: 8px;
  background: #faf8f6;
  cursor: zoom-in;
}
.material-nav-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.material-meta {
  margin-top: 6px;
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 6px;
  align-items: center;
}
.material-num {
  background: var(--brown);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
}
.material-product-select {
  grid-column: 1 / -1;
  width: 100%;
  font-size: 11px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}
.material-thumbs {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 4px;
}
.material-thumb {
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 0;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  background: none;
  cursor: pointer;
}
.material-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}
.material-thumb.active {
  border-color: var(--accent);
}

.composition-preview {
  font-size: 11px;
  line-height: 1.45;
  background: #f0f7f4;
  border: 1px dashed #2d6a4f;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 8px;
  color: #1e4d38;
  white-space: pre-wrap;
}
.content-cover-grid { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.copy-topics-edit { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.topic-block {
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fafafa;
}
.copy-btn-row,
.layout-plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.copy-slides-edit { display: flex; flex-direction: column; gap: 6px; }
.copy-slide-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 6px;
  align-items: center;
  font-size: 12px;
}
.copy-slide-id { font-weight: 600; color: #8b7355; }

.layout-plan-meta {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--brown);
}
.layout-plan-form { display: flex; flex-direction: column; gap: 12px; }
.layout-page-block {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 8px;
  background: #fafafa;
}
.layout-page-head {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--brown);
}
.layout-page-quota {
  font-size: 11px;
  margin-bottom: 6px;
  color: #6b5344;
}
.layout-img-slots { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.layout-img-slot-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border: 1px dashed #ddd;
  border-radius: 6px;
  background: #fff;
}
.layout-img-slot-label { font-size: 11px; color: #5c4033; line-height: 1.4; font-weight: 600; }
.layout-img-select {
  width: 100%;
  font-size: 11px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.layout-img-slot-hint { font-size: 10px; color: #8b7355; }
.layout-copy-ta {
  width: 100%;
  font-size: 11px;
  line-height: 1.45;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  resize: vertical;
  min-height: 72px;
}
.tpl-page-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 12px;
}
.tpl-page-select {
  flex: 1;
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.tpl-slot-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0;
}
.tpl-slot-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tpl-slot-label {
  font-size: 11px;
  color: #666;
}
.tpl-slot-ta {
  width: 100%;
  font-size: 11px;
  line-height: 1.4;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  resize: vertical;
  min-height: 44px;
}
.tpl-img-list {
  margin: 4px 0 10px;
  padding-left: 18px;
  font-size: 11px;
}
.layout-img-pre {
  font-size: 10px;
  line-height: 1.45;
  color: #666;
  white-space: pre-wrap;
  background: #fff;
  border: 1px dashed #ddd;
  border-radius: 4px;
  padding: 6px;
  max-height: 120px;
  overflow-y: auto;
}

.msg-text { white-space: pre-wrap; word-break: break-word; }

.result-area .muted { color: #999; font-size: 13px; }
.result-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.result-gallery img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
}
.content-box {
  margin-top: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
}
.copy-btn {
  margin-top: 8px;
  width: 100%;
}

.copy-draft-area {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 12px;
  max-height: 320px;
  overflow-y: auto;
}
.copy-form { display: flex; flex-direction: column; gap: 8px; }
.copy-row { font-size: 13px; display: flex; align-items: center; gap: 8px; }
.copy-row select, .copy-color { flex: 1; padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; }
.copy-label { font-size: 13px; font-weight: 600; margin-top: 4px; }
.copy-label-primary { font-size: 13px; font-weight: 700; color: var(--brown); margin-top: 0; padding: 6px 0; border-bottom: 2px solid var(--accent); }
.copy-input { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; }
.copy-body { width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; font-family: inherit; resize: vertical; }
.copy-body-primary { min-height: 180px; border-color: var(--accent); background: #fffaf6; line-height: 1.55; }
.copy-tags { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; font-family: inherit; resize: vertical; }
.copy-inline-btn { align-self: flex-start; font-size: 12px; padding: 4px 10px; }
.copy-slides-preview { font-size: 11px; color: #666; line-height: 1.5; max-height: 100px; overflow-y: auto; }
.copy-slides-preview p { margin: 2px 0; }
.copy-confirm-btn { width: 100%; margin-top: 6px; }

.reference-area { margin-bottom: 12px; }
.reference-area h2 { font-size: 16px; margin: 12px 0 8px; color: var(--brown); }
.ref-hint { font-size: 12px; color: #8b7355; margin-bottom: 8px; line-height: 1.4; }
.ref-list { list-style: none; font-size: 12px; color: #555; }
.ref-list li { padding: 6px 0; border-bottom: 1px solid #eee; line-height: 1.4; }

.layout-plan-gen-btn { width: 100%; margin-top: 10px; }
.layout-plan-topbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #f0f7ff;
  border-radius: 8px;
  border: 1px solid #c5d9f0;
  position: sticky;
  top: 0;
  z-index: 2;
}
.layout-plan-confirm-top { width: 100%; }
#confirmLayoutBtn:not(:disabled) {
  box-shadow: 0 0 0 2px rgba(196, 92, 38, 0.25);
}
.layout-plan-area {
  margin-bottom: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  max-height: 560px;
  overflow-y: auto;
}
.layout-plan-pre {
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.55;
  color: #4d3a2f;
}
.layout-plan-copy {
  color: #1e4d38;
  font-weight: 600;
}
.layout-plan-image {
  color: #6b4423;
}

/* 小红书预览 mock — 右侧加宽，配图大图 */
.preview-area { margin-bottom: 12px; }
.xhs-mock {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}
.xhs-carousel-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.xhs-slide-img {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 3/4;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #eee;
  background: #fafafa;
  cursor: pointer;
}
.xhs-preview-badge {
  font-size: 11px;
  color: #888;
  background: #f5f5f5;
  padding: 3px 10px;
  border-radius: 4px;
}
.xhs-carousel-nav { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.xhs-nav-btn {
  width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; cursor: pointer; font-size: 18px; line-height: 1;
}
.xhs-counter { font-weight: 600; min-width: 60px; text-align: center; }
.xhs-post {
  font-size: 14px;
  line-height: 1.6;
  max-height: 360px;
  overflow-y: auto;
  padding: 12px;
  background: #fafafa;
  border-radius: 8px;
  border: 1px solid #eee;
}
.xhs-author { font-weight: 600; color: var(--brown); margin-bottom: 8px; font-size: 13px; }
.xhs-title { font-size: 16px; font-weight: 700; margin: 0 0 10px; color: #222; }
.xhs-body { white-space: pre-wrap; color: #333; margin-bottom: 10px; font-size: 13px; }
.xhs-tags { color: #1a6fb5; font-size: 12px; line-height: 1.5; }
.xhs-warnings { margin-top: 8px; padding: 10px; background: #fff8e6; border-radius: 6px; font-size: 12px; color: #8a6d00; line-height: 1.5; border: 1px dashed #e6c200; }
.xhs-hint { margin-top: 8px; font-size: 12px; }

.btn-sm { padding: 6px 12px; font-size: 13px; }

.preview-edit-bar {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.preview-edit-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e8f5ee;
  color: #2d6a4f;
  font-weight: 600;
}
.preview-edit-badge.pending {
  background: #fff4eb;
  color: #c45c26;
}

/* ===== 配图微调全屏编辑器 ===== */
.slide-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #1a1510;
  display: flex;
  flex-direction: column;
  color: #f5ebe0;
}
.slide-editor-modal[hidden] { display: none; }

.slide-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #2c2419;
  border-bottom: 1px solid #4a3d30;
  flex-wrap: wrap;
}
.slide-editor-counter { margin-left: 10px; opacity: 0.85; font-size: 14px; }
.slide-editor-dirty {
  margin-left: 8px;
  font-size: 12px;
  color: #ffb347;
  font-weight: 600;
}
.slide-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex: 1;
  justify-content: center;
}
.slide-editor-select {
  max-width: 220px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #6b5344;
  background: #fdf9f4;
  color: #2c2419;
  font-size: 13px;
}
.slide-editor-status { font-size: 12px; max-width: 280px; }

.slide-editor-ref-toggle {
  font-size: 12px;
  color: #ccc;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.layout-plan-topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.layout-plan-topbar .muted { flex: 1 1 200px; margin: 0; }

.slide-editor-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}
.slide-editor-thumbs {
  width: 88px;
  overflow-y: auto;
  padding: 8px 6px;
  background: #221c16;
  border-right: 1px solid #4a3d30;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.slide-editor-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 2px;
  background: none;
  cursor: pointer;
  color: #ccc;
  font-size: 11px;
  text-align: center;
}
.slide-editor-thumb img {
  width: 72px;
  height: 96px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}
.slide-editor-thumb.active { border-color: var(--accent); }
.slide-editor-thumb.saved span::after { content: " ✓"; color: #6fcf97; }

.slide-editor-canvas-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
  background: #2a2a2a;
}

/* Fabric 会包一层 .canvas-container，必须固定 540×720，否则会撑满视口导致内容沉底 */
.slide-editor-canvas-wrap .canvas-container {
  position: relative !important;
  width: var(--editor-canvas-w, 540px) !important;
  height: var(--editor-canvas-h, 720px) !important;
  flex-shrink: 0;
  margin: 0 auto;
}

.slide-editor-canvas-wrap .lower-canvas,
.slide-editor-canvas-wrap .upper-canvas {
  width: var(--editor-canvas-w, 540px) !important;
  height: var(--editor-canvas-h, 720px) !important;
  left: 0 !important;
  top: 0 !important;
}

.slide-editor-canvas-wrap canvas {
  border: 2px solid #666;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}
.slide-editor-hint { margin-top: 10px; font-size: 12px; color: #aaa; }

.slide-editor-footer {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px;
  background: #2c2419;
  border-top: 1px solid #4a3d30;
}

@media (max-width: 1400px) {
  .main { grid-template-columns: minmax(560px, 3fr) minmax(420px, 2fr); }
  .xhs-slide-img { max-width: 360px; }
}

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