:root {
  --brand: #8b2332;
  --brand-dark: #6b1a28;
  --bg: #f7f4f2;
  --card: #fff;
  --text: #1a1a1a;
  --muted: #666;
  --border: #e8e0dc;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--brand);
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.hero {
  text-align: center;
  padding: 32px 0 24px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 28px;
  color: var(--brand);
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 18px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  margin-bottom: 12px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(139, 35, 50, 0.22);
}

.btn {
  display: inline-block;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-dark);
}

.btn-secondary {
  background: #eee;
  color: var(--text);
}

.btn-danger {
  background: #c62828;
  color: #fff;
}

.btn-danger:hover {
  background: #b71c1c;
}

.btn-block {
  width: 100%;
}

.msg {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 12px;
}

.msg.err {
  background: #fde8e8;
  color: #b42318;
}

.msg.ok {
  background: #e8f5e9;
  color: #2e7d32;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  color: var(--muted);
  font-weight: 500;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}

.hidden {
  display: none !important;
}

.slot-canvas-stage {
  position: relative;
  margin: 12px 0;
  overflow: visible;
}

/* 照片框弹窗蒙版：仅视觉压暗，不拦截指针，便于拖框/拖边 */
.slot-inspector-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1190;
  background: rgba(20, 12, 14, 0.18);
  pointer-events: none;
  border: 0;
  padding: 0;
  margin: 0;
}
.slot-inspector-backdrop.show {
  display: block;
}
.slot-inspector-backdrop.hidden {
  display: none !important;
}

/* 编辑时画布叠在蒙版之上，红框可拖移/缩放 */
body.slot-inspector-open .slot-canvas-stage {
  position: relative;
  z-index: 1195;
}

.tpl-editor-canvas-row {
  display: block;
  margin: 12px 0 0;
}

.tpl-editor-canvas-row .slot-canvas-stage {
  margin: 0;
  position: relative;
}

/* 悬浮微调面板：不占文档流，不挤占画布 */
.slot-inspector-dock {
  display: none;
  position: fixed;
  z-index: 1200;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(268px, calc(100vw - 32px));
  max-height: min(72vh, 560px);
  pointer-events: none;
}

.slot-inspector-dock.is-open {
  display: block;
}

.slot-inspector-dock.is-dragging {
  z-index: 1300;
  user-select: none;
}

.slot-inspector-dock .slot-inspector {
  pointer-events: auto;
  position: relative;
  margin: 0;
  width: 100%;
  max-height: min(72vh, 560px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 10px 12px 12px;
  border: 1.5px solid rgba(196, 48, 64, 0.35);
  box-shadow: 0 16px 48px rgba(40, 16, 20, 0.28);
}

.slot-inspector-dock .slot-inspector.hidden {
  display: none !important;
}

.slot-editor-wrap {
  position: relative;
  max-width: 100%;
  min-height: 220px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #f0ebe8;
}

.slot-editor-wrap:has(canvas.slot-canvas-ready) {
  border-style: solid;
  background: #333;
  overflow: auto;
}

.slot-editor-wrap canvas {
  display: none;
  width: 100%;
  height: auto;
  max-width: 100%;
  cursor: crosshair;
  touch-action: none;
  vertical-align: top;
}

.slot-editor-wrap canvas.slot-canvas-ready {
  display: block;
}

.slot-canvas-stack {
  position: relative;
  width: 100%;
  line-height: 0;
}

.slot-canvas-stack canvas {
  width: 100%;
  height: auto;
  max-width: 100%;
  vertical-align: top;
}

.slot-canvas-stack:not(:has(canvas.slot-canvas-ready)) {
  display: none;
}

.slot-overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.store-slot-el {
  position: absolute;
  box-sizing: border-box;
  pointer-events: auto;
  cursor: pointer;
  background: rgba(139, 35, 50, 0.22);
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow:
    inset 0 0 0 1.5px rgba(139, 35, 50, 0.95),
    0 0 0 1px rgba(139, 35, 50, 0.55);
  border-radius: 2px;
  z-index: 1;
}

.store-slot-el.is-hover {
  background: rgba(139, 35, 50, 0.32);
  box-shadow:
    inset 0 0 0 2px rgba(139, 35, 50, 1),
    0 0 0 2px rgba(255, 255, 255, 0.85);
  z-index: 3;
}

.store-slot-el.is-editing {
  background: rgba(139, 35, 50, 0.28);
  border-style: dashed;
  border-width: 2px;
  box-shadow:
    inset 0 0 0 2px rgba(139, 35, 50, 1),
    0 0 0 2px rgba(255, 255, 255, 0.95);
  z-index: 4;
  cursor: move;
}

.store-slot-el.is-dim {
  background: rgba(139, 35, 50, 0.15);
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 0 1px rgba(139, 35, 50, 0.55);
  opacity: 0.85;
}

.store-slot-el.is-draft {
  background: rgba(139, 35, 50, 0.28);
  border: 2px dashed #fff;
  box-shadow:
    inset 0 0 0 2px rgba(139, 35, 50, 1),
    0 0 0 1px rgba(139, 35, 50, 0.8);
  z-index: 5;
  cursor: move;
  pointer-events: auto;
}

.store-slot-label {
  position: absolute;
  top: 2px;
  left: 2px;
  max-width: calc(100% - 4px);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  color: #fff;
  background: rgba(139, 35, 50, 0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  user-select: none;
}

.store-slot-el.is-editing .store-slot-label,
.store-slot-el.is-draft .store-slot-label {
  background: rgba(139, 35, 50, 0.95);
}

.slot-overlay-layer.is-drafting .store-slot-el[data-slot-i] {
  pointer-events: none;
}

.slot-overlay-layer.is-drafting .store-slot-el.is-draft {
  pointer-events: auto;
}

.store-slot-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 1.5px solid rgba(139, 35, 50, 1);
  box-sizing: border-box;
  pointer-events: auto;
  z-index: 2;
  /* 扩大可点区域，避免拖边难点中 */
  touch-action: none;
}
.store-slot-handle::before {
  content: "";
  position: absolute;
  inset: -8px;
}
.store-slot-handle.nw { left: -7px; top: -7px; cursor: nwse-resize; }
.store-slot-handle.ne { right: -7px; top: -7px; cursor: nesw-resize; }
.store-slot-handle.sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.store-slot-handle.se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.store-slot-handle.n { left: calc(50% - 7px); top: -7px; cursor: ns-resize; }
.store-slot-handle.s { left: calc(50% - 7px); bottom: -7px; cursor: ns-resize; }
.store-slot-handle.e { right: -7px; top: calc(50% - 7px); cursor: ew-resize; }
.store-slot-handle.w { left: -7px; top: calc(50% - 7px); cursor: ew-resize; }

.slot-canvas-stage.is-bg-loading .slot-canvas-stack::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  animation: slotBgShimmer 1.2s linear infinite;
}
@keyframes slotBgShimmer {
  from { transform: translateX(-40%); }
  to { transform: translateX(40%); }
}

.tpl-upload-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  width: 100%;
  padding: 28px 20px;
  cursor: pointer;
  box-sizing: border-box;
  transition: background 0.15s, border-color 0.15s;
}

.tpl-upload-dropzone.hidden {
  display: none !important;
}

.tpl-upload-dropzone:hover,
.tpl-upload-dropzone.dragover {
  background: rgba(139, 35, 50, 0.06);
}

.tpl-upload-dropzone.dragover {
  outline: 2px dashed var(--brand);
  outline-offset: -8px;
}

.tpl-upload-dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  max-width: 320px;
}

.tpl-upload-dropzone-inner strong {
  font-size: 16px;
  color: var(--text);
}

.tpl-upload-dropzone-inner span {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.tpl-upload-dropzone-cta {
  margin-top: 6px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff !important;
  font-size: 14px !important;
  font-weight: 700;
}

.slot-panel.card {
  padding: 16px;
}

/* —— 模板框微调面板（浮层） —— */
.slot-inspector {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(139, 35, 50, 0.22);
}

.slot-inspector-pop {
  /* 兼容旧类名：现改为文档流 dock，不再 fixed */
  position: static;
  z-index: auto;
  margin: 0;
  width: 100%;
  max-width: none;
}

.slot-inspector-pop.pop-fallback-center {
  position: static !important;
}

.slot-inspector-pop::before {
  display: none;
}

.slot-inspector-pop.pop-arrow-below::before {
  display: none;
}

@media (max-width: 900px) {
  .tpl-editor-canvas-row {
    display: block;
  }

  .slot-inspector-dock {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: calc(72px + env(safe-area-inset-bottom));
    transform: none;
    width: auto;
    max-height: min(48vh, 380px);
  }

  .slot-inspector-dock.is-open {
    display: block;
  }

  .slot-inspector-dock .slot-inspector {
    max-height: min(48vh, 380px);
    border-radius: 14px 14px 10px 10px;
  }

  body.admin-app-mobile .slot-inspector-dock {
    bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

.slot-inspector-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.slot-inspector-head-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.slot-inspector-head-actions {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  max-width: 58%;
}

.slot-insp-tb-btn {
  appearance: none;
  border: none;
  margin: 0;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
  color: #fff;
  white-space: nowrap;
}

.slot-insp-tb-btn.is-save {
  background: rgba(139, 35, 50, 1);
}

.slot-insp-tb-btn.is-save:hover {
  background: rgba(168, 42, 58, 1);
}

.slot-insp-tb-btn.is-del {
  background: rgba(170, 40, 48, 0.96);
}

.slot-insp-tb-btn.is-del:hover {
  background: rgba(190, 48, 56, 1);
}

.slot-insp-tb-btn.is-cancel {
  background: rgba(70, 70, 75, 0.9);
}

.slot-insp-tb-btn.is-cancel:hover {
  background: rgba(90, 90, 95, 1);
}

.slot-inspector-head.is-draggable {
  cursor: grab;
  user-select: none;
  touch-action: none;
  padding: 4px 2px 8px;
  margin: -4px -2px 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.slot-inspector-dock.is-dragging .slot-inspector-head.is-draggable {
  cursor: grabbing;
}

.slot-inspector-head strong {
  font-size: 15px;
}

.slot-inspector-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
}

.slot-inspector-hint {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 8px;
  line-height: 1.4;
}

.slot-orient-hint {
  font-size: 10px;
  color: var(--muted);
  margin: 2px 0 8px;
  line-height: 1.4;
}

#slotDraftRotate {
  width: 100%;
  margin-bottom: 2px;
}

.slot-nudge-block {
  margin: 8px 0 6px;
  padding: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.28);
}

.slot-nudge-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.slot-nudge-step-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
}

.slot-nudge-step-label select {
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  min-height: 0;
  margin: 0;
}

.slot-nudge-pad {
  display: grid;
  grid-template-columns: repeat(3, 40px);
  grid-template-rows: repeat(3, 40px);
  gap: 5px;
  justify-content: center;
  margin-bottom: 6px;
}

.slot-nudge-btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--brand);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  font-family: inherit;
}

.slot-nudge-btn:hover:not(:disabled) {
  border-color: var(--brand);
  background: #fdf8f9;
}

.slot-nudge-btn:active:not(:disabled) {
  background: var(--brand);
  color: #fff;
}

.slot-nudge-btn[data-nudge="up"] {
  grid-column: 2;
  grid-row: 1;
}

.slot-nudge-btn[data-nudge="left"] {
  grid-column: 1;
  grid-row: 2;
}

.slot-nudge-btn.slot-nudge-center {
  grid-column: 2;
  grid-row: 2;
  opacity: 0.35;
  cursor: default;
  color: var(--muted);
  font-size: 12px;
}

.slot-nudge-btn[data-nudge="right"] {
  grid-column: 3;
  grid-row: 2;
}

.slot-nudge-btn[data-nudge="down"] {
  grid-column: 2;
  grid-row: 3;
}

.slot-nudge-readout {
  display: none !important; /* 坐标状态栏不再展示 */
  margin: 0;
  text-align: center;
  font-size: 11px;
  font-family: ui-monospace, monospace;
  color: var(--muted);
}

.slot-inspector input,
.slot-inspector select {
  background: rgba(255, 255, 255, 0.55);
}

.slot-inspector .btn-secondary,
.slot-inspector .btn-ghost {
  background: rgba(255, 255, 255, 0.5);
}

.slot-nudge-btn {
  background: rgba(255, 255, 255, 0.55) !important;
}

.slot-precise-details {
  margin: 8px 0 4px;
  font-size: 12px;
  color: var(--muted);
}

.slot-precise-details summary {
  cursor: pointer;
  font-weight: 600;
  padding: 6px 0;
  list-style: none;
}

.slot-precise-details summary::-webkit-details-marker {
  display: none;
}

.slot-precise-details[open] summary {
  margin-bottom: 6px;
}

.slot-inspector-grid input {
  margin-bottom: 8px;
}

.slot-inspector-actions .btn-danger {
  margin-left: auto;
}

.slot-inspector-actions {
  margin-top: 12px;
  margin-bottom: 0;
}

.slot-inspector-actions:not(:has(button:not(.hidden))) {
  display: none;
}

.slot-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  margin: 16px 0 8px;
  color: var(--text);
}

.slot-list-head-above-canvas {
  margin-top: 12px;
  margin-bottom: 6px;
}

.slot-continuous-add {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.slot-quick-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}

.slot-quick-nav.hidden {
  display: none;
}

.slot-quick-chip {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.slot-quick-chip.active {
  border-color: var(--brand);
  background: #fdf8f9;
  color: var(--brand);
}

.slot-inspector-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0 4px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.slot-inspector-nav.hidden {
  display: none;
}

.slot-inspector-index {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.slot-list-count {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
}

.slot-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slot-list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.slot-list-item.dragging {
  opacity: 0.45;
}

.slot-list-item.drag-over {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(139, 35, 50, 0.18);
}

.slot-list-handle {
  flex: 0 0 auto;
  width: 22px;
  height: 36px;
  margin: -4px 0 -4px -4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: grab;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  letter-spacing: -1px;
  line-height: 1;
  user-select: none;
  touch-action: none;
}

.slot-list-handle:active {
  cursor: grabbing;
}

.slot-list-layer {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  color: var(--brand);
  background: rgba(139, 35, 50, 0.08);
  vertical-align: middle;
}

.slot-list-oob {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  color: #9a3412;
  background: rgba(234, 88, 12, 0.14);
  vertical-align: middle;
}

.slot-list-item.slot-oob {
  border-color: rgba(234, 88, 12, 0.35);
  background: rgba(255, 247, 237, 0.9);
}

.slot-list-order-btns {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}

.slot-list-order-btns .btn {
  min-width: 40px;
  padding: 3px 8px;
  line-height: 1.2;
  font-size: 11px;
}

.slot-list-item.active-edit {
  border-color: var(--brand);
  background: #fdf8f9;
}

.slot-list-item .slot-list-meta {
  flex: 1;
  min-width: 140px;
  line-height: 1.4;
}

.slot-list-item .slot-list-meta strong {
  display: block;
  font-size: 13px;
}

.slot-list-item .slot-list-meta span {
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}

.slot-list-item .slot-list-btns {
  display: flex;
  gap: 6px;
}


.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.album-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
}

.album-grid .sel {
  outline: 3px solid var(--brand);
}

.album-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 13px;
}

.album-flow-step {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  box-shadow: var(--shadow);
}

.album-flow-step.active {
  background: var(--brand);
  color: #fff;
}

.album-flow-arrow {
  color: var(--muted);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.topbar .brand {
  font-weight: 700;
  color: var(--brand);
}

.tpl-workspace {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 800px) {
  .tpl-workspace {
    grid-template-columns: 1fr;
  }
}

.tpl-sidebar {
  border-right: 1px solid var(--border);
  padding-right: 12px;
  max-height: 75vh;
  overflow-y: auto;
}

@media (max-width: 800px) {
  .tpl-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 16px;
    max-height: none;
  }
}

.tpl-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tpl-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tpl-card-item {
  display: flex;
  gap: 10px;
  padding: 8px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: var(--card);
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
}

.tpl-card-item:hover {
  border-color: #d4a5ad;
}

.tpl-card-item.active {
  border-color: var(--brand);
  background: #fdf8f9;
}

.tpl-card-item img {
  width: 52px;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
  background: #eee;
  flex-shrink: 0;
}

.tpl-card-item .meta {
  flex: 1;
  min-width: 0;
}

.tpl-card-item .meta strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tpl-card-item .meta span {
  font-size: 11px;
  color: var(--muted);
}

.tpl-editor-main {
  min-width: 0;
}

.tpl-panel.card {
  padding: 16px;
}
