/* ============================================================
   H5 动效编辑器 — Design System & Layout
   ============================================================ */

/* --- 1. Design Tokens --- */
:root {
  /* Backgrounds */
  --bg:           #e8eaf2;
  --surface:      #ffffff;
  --surface-2:    #f3f5f9;
  --surface-3:    #ebecf5;

  /* Borders */
  --border:       #dde1ec;
  --border-hi:    #c2c8dc;

  /* Header (dark navy) */
  --hd-bg:        #14172b;
  --hd-text:      #dce2f0;
  --hd-dim:       #7580a0;
  --hd-hover:     rgba(255,255,255,0.06);
  --hd-active:    rgba(255,255,255,0.12);
  --hd-sep:       rgba(255,255,255,0.08);

  /* Brand */
  --primary:      #2563eb;
  --primary-hov:  #1d4ed8;
  --primary-sub:  #eff6ff;
  --primary-txt:  #1e40af;

  /* Status */
  --success:      #16a34a;
  --success-sub:  #f0fdf4;
  --warning:      #d97706;
  --warning-sub:  #fffbeb;
  --danger:       #dc2626;
  --danger-hov:   #b91c1c;
  --danger-sub:   #fef2f2;
  --info-sub:     #eff6ff;

  /* Text */
  --text:         #111827;
  --text-2:       #374151;
  --text-3:       #6b7280;
  --text-4:       #9ca3af;

  /* Radii */
  --r:            6px;
  --r-sm:         4px;
  --r-lg:         10px;
  --r-xl:         14px;

  /* Shadows */
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow:       0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:    0 10px 30px rgba(0,0,0,0.15), 0 4px 8px rgba(0,0,0,0.08);

  /* Dimensions */
  --hd-h:         48px;
  --sl-w:         232px;
  --sr-w:         286px;
  --tbar-h:       46px;
}

/* --- 2. Reset / Base --- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* --- 3. App Header --- */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--hd-h);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--hd-bg);
  border-bottom: 1px solid var(--hd-sep);
  padding: 0 8px;
  overflow: visible;
}

/* Brand */
.app-header__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  flex-shrink: 0;
  margin-right: 8px;
}

.brand-logo {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--hd-text);
  white-space: nowrap;
}

/* Nav area */
.app-header__nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
  position: relative;
}

.app-header__nav::-webkit-scrollbar { display: none; }

/* Right actions */
.app-header__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
  flex-shrink: 0;
  border-left: 1px solid var(--hd-sep);
  margin-left: 4px;
}

/* Header buttons */
.hbtn {
  height: 30px;
  padding: 0 10px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--hd-dim);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}

.hbtn:hover {
  background: var(--hd-hover);
  color: var(--hd-text);
}

.hbtn.hbtn--icon {
  width: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hbtn.hbtn--sm {
  font-size: 11px;
  padding: 0 7px;
  color: var(--hd-dim);
}

.hbtn.hbtn--ghost {
  border: 1px solid rgba(255,255,255,0.18);
  color: var(--hd-text);
}
.hbtn.hbtn--ghost:hover { background: var(--hd-hover); }

.hbtn.hbtn--primary {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.hbtn.hbtn--primary:hover { background: var(--primary-hov); }

/* Accent button for import operations */
.hbtn.hbtn--accent {
  background: #0f766e;
  color: #fff;
  font-weight: 600;
}
.hbtn.hbtn--accent:hover { background: #0d9488; }

.hbtn-sep {
  width: 1px;
  height: 20px;
  background: var(--hd-sep);
  flex-shrink: 0;
  margin: 0 4px;
}

.hbtn-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* --- 4. App Body Layout --- */
.app-body {
  display: grid;
  grid-template-columns: var(--sl-w) 1fr var(--sr-w);
  height: calc(100vh - var(--hd-h));
  margin-top: var(--hd-h);
  overflow: hidden;
}

/* --- 5. Sidebars --- */
.sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;          /* explicit height so flex children can use flex:1 */
  min-height: 0;
  background: var(--surface);
  overflow: hidden;
}

.sidebar-left {
  border-right: 1px solid var(--border);
}

.sidebar-right {
  border-left: 1px solid var(--border);
}

/* Sidebar Tab Nav */
.sidebar-tabs {
  display: flex;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 5px 6px 0;
  gap: 2px;
  flex-shrink: 0;
}

.stab {
  flex: 1;
  padding: 6px 6px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}

.stab:hover { color: var(--text-2); }

.stab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--surface);
}

/* Tab Panel Content */
.stab-panel {
  display: none;
  flex-direction: column;
  flex: 1 1 0;      /* flex-basis 0 is key for scrolling inside flex parent */
  min-height: 0;    /* critical: allows overflow-y to work inside flex column */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
  gap: 8px;
}

.stab-panel.active { display: flex; }

/*
 * KEY FIX: All direct children of .stab-panel must NOT shrink.
 * Without flex-shrink:0, flex children compress to fit the container
 * instead of overflowing → no scroll ever fires.
 */
.stab-panel > * {
  flex-shrink: 0;
}

/* --- 6. Center Editor --- */
.editor-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* ---- 6a. Editor Toolbar ---- */
.editor-toolbar {
  height: var(--tbar-h);
  display: flex;
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 6px;
  overflow-x: auto;
  flex-shrink: 0;
  gap: 0;
  scrollbar-width: none;
}

.editor-toolbar::-webkit-scrollbar { display: none; }

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 5px;
  flex-shrink: 0;
}

.toolbar-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  padding-right: 2px;
}

.toolbar-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
}

.tb-btn-tool {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.1s;
  flex-shrink: 0;
}

.tb-btn-tool:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-sub);
}

.tb-btn-tool.active {
  background: var(--primary-sub);
  border-color: var(--primary);
  color: var(--primary);
}

/* 对齐工具图标按钮 */
.tb-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-sm);
  color: var(--text-2);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.1s;
  padding: 0;
}
.tb-btn-icon:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-sub);
}
.tb-btn-icon.active {
  background: var(--primary-sub);
  border-color: var(--primary);
  color: var(--primary);
}
/* 对齐区内小分隔 */
.tb-sep-xs {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
}

/* 文字对齐按钮组 */
.text-align-btns {
  display: flex;
  gap: 4px;
}
.align-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.1s;
  padding: 0;
}
.align-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-sub);
}
.align-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.tb-input-sm {
  height: 28px;
  width: 64px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0 6px;
  font-size: 12px;
  background: var(--surface);
  color: var(--text);
}

.tb-select-sm {
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0 6px;
  font-size: 12px;
  background: var(--surface);
  color: var(--text);
}

.tb-label-inline {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- 6b. Canvas Area ---- */
.canvas-area {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 32px 24px 48px; /* extra bottom so zoomed canvas isn't cut off */
  /* checkered pattern background */
  background-color: #dde0ea;
  background-image:
    linear-gradient(45deg, #cdd0de 25%, transparent 25%),
    linear-gradient(-45deg, #cdd0de 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #cdd0de 75%),
    linear-gradient(-45deg, transparent 75%, #cdd0de 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.canvas {
  position: relative;
  background: #ffffff;
  border-radius: 3px;
  overflow: hidden; /* 与运行时 scene 一致：边界内裁切 */
  box-shadow:
    0 0 0 1px rgba(37,99,235,0.15),
    0 4px 12px rgba(0,0,0,0.18),
    0 16px 40px rgba(0,0,0,0.12);
  transform-origin: top center;
  flex-shrink: 0;
  transition: transform 0.12s ease;
}

/* Canvas focus ring */
.canvas::after {
  content: '';
  position: absolute;
  inset: -2px;
  border: 1.5px dashed rgba(37,99,235,0.3);
  pointer-events: none;
  border-radius: 4px;
}

/* Canvas size label */
.canvas::before {
  content: attr(data-size);
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  white-space: nowrap;
  pointer-events: none;
  letter-spacing: 0.03em;
}

.canvas-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- 6c. Timeline / Collapsible Sections ---- */
.timeline-section {
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  cursor: pointer;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  user-select: none;
  transition: background 0.1s;
}

.section-header:hover { background: var(--surface-3); }

.section-header-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-body {
  overflow: hidden;
  transition: max-height 0.2s ease;
  max-height: 300px;
  padding: 8px;
}

.section-body.collapsed {
  max-height: 0;
  padding: 0;
}

/* Timeline internals */
.timeline-tracks {
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  max-height: 200px;
  overflow: auto;
  position: relative;
}

.timeline-ruler,
.timeline-row {
  display: grid;
  grid-template-columns: 140px 1fr;
}

.timeline-ruler {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface-2);
  z-index: 5;
}

.timeline-ruler .label {
  padding: 5px 8px;
  font-size: 11px;
  color: var(--text-3);
  font-weight: 600;
}

.timeline-ruler .axis {
  position: relative;
  min-height: 26px;
  cursor: pointer; /* clickable to seek */
}
.timeline-ruler .axis:hover {
  background: rgba(37,99,235,0.06);
}

.tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.tick span {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 10px;
  color: var(--text-4);
}

.timeline-row {
  border-bottom: 1px solid var(--surface-2);
  transition: background 0.1s;
}

.timeline-row:hover { background: var(--surface-2); }

.timeline-row .label {
  padding: 6px 8px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-3);
}

.timeline-row.active .label {
  color: var(--primary);
  font-weight: 600;
}

.timeline-track {
  position: relative;
  min-height: 30px;
}

.timeline-seg {
  position: absolute;
  top: 7px;
  height: 16px;
  border-radius: 3px;
}

.timeline-seg.entry  { background: #93c5fd; }
.timeline-seg.hold   { background: #3b82f6; }
.timeline-seg.exit   { background: #fca5a5; }

.timeline-handle {
  position: absolute;
  top: 5px;
  width: 5px;
  height: 20px;
  background: #1e3a8a;
  border-radius: 3px;
  cursor: ew-resize;
  opacity: 0.7;
}

.timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ef4444;
  pointer-events: none;
  z-index: 10;
}

/* Health Report */
.health-report {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
}

.health-item {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 6px 10px;
  background: var(--surface);
  font-size: 12px;
  line-height: 1.5;
}

.health-item.error  { border-color: var(--danger);  background: var(--danger-sub); }
.health-item.warn   { border-color: var(--warning); background: var(--warning-sub); }
.health-item.info   { border-color: #93c5fd;        background: var(--info-sub); }

.health-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  border-radius: 10px;
  padding: 1px 7px;
  line-height: 18px;
  min-width: 0;
  transition: background 0.2s;
}
.health-badge:empty { display: none; }

/* --- 7. Sidebar Panel Components --- */

/* Section title */
.section-card {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 0;
}

.section-card__head {
  padding: 7px 10px;
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.section-card__body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Prevent any flex children inside section-card__body from shrinking */
.section-card__body > * {
  flex-shrink: 0;
}

/* Asset grid */
.asset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.asset-empty {
  grid-column: 1 / -1;
  padding: 24px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
}

.asset-item {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  cursor: grab;
  transition: border-color 0.12s, box-shadow 0.12s;
  overflow: hidden;
}
.asset-item:active { cursor: grabbing; }

.asset-item:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-sub), var(--shadow-sm);
}

.asset-item img {
  width: 100%;
  height: 60px;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.asset-info {
  padding: 5px 5px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.asset-name {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-3);
  font-weight: 500;
}

.asset-size-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  font-size: 9px;
  font-weight: 600;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border-radius: 3px;
  padding: 1px 4px;
  line-height: 1.4;
  pointer-events: none;
}

.asset-actions {
  display: flex;
  gap: 3px;
}
.asset-add-btn, .asset-replace-btn, .asset-preview-btn, .asset-del-btn {
  flex: 1;
  border: none;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
  padding: 3px 4px;
  cursor: pointer;
  transition: background 0.12s;
}
.asset-add-btn {
  background: var(--primary);
  color: #fff;
}
.asset-add-btn:hover { background: var(--primary-hov); }
.asset-replace-btn {
  background: #ecfeff;
  color: #0e7490;
}
.asset-replace-btn:hover { background: #cffafe; }
.asset-preview-btn {
  background: #eef2ff;
  color: #3730a3;
}
.asset-preview-btn:hover { background: #e0e7ff; }
.asset-del-btn {
  background: #fee2e2;
  color: #dc2626;
}
.asset-del-btn:hover { background: #fecaca; }

/* Upload button */
.upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1.5px dashed var(--border-hi);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.upload-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-sub);
}

/* Scene list */
.scene-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}

.scene-item {
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 6px;
  font-size: 11px;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-2);
  transition: all 0.12s;
  overflow: hidden;
  user-select: none;
}

.scene-item:hover { border-color: var(--border-hi); background: var(--surface-2); box-shadow: var(--shadow-sm); }

.scene-item.active {
  border-color: var(--primary);
  background: var(--primary-sub);
  color: var(--primary-txt);
  font-weight: 500;
}

.scene-item.dragging { opacity: 0.4; }
.scene-item.drag-over { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-sub); }

/* Layer list */
.layer-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.layer-item {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 5px 8px;
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 4px;
  align-items: center;
  font-size: 11px;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.1s;
}

.layer-item:hover { border-color: var(--border-hi); }

.layer-item.active {
  border-color: var(--primary);
  background: var(--primary-sub);
}

.layer-item.dragging { opacity: 0.35; }
.layer-item.drag-over { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-sub); }

.layer-item .name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-2);
  font-size: 12px;
}

/* Preset list (templates, components, groups) */
.preset-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* app.js generates elements with class "template-preset-item" — keep both */
.preset-item,
.template-preset-item {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 7px 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  background: var(--surface);
  transition: border-color 0.1s, background 0.1s;
}

.preset-item:hover,
.template-preset-item:hover { border-color: var(--border-hi); background: var(--surface-2); }

.preset-item.active,
.template-preset-item.active {
  border-color: var(--primary);
  background: var(--primary-sub);
}

.preset-item__name,
.template-preset-item .preset-name,
.template-preset-item > div:first-child {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  color: var(--text-2);
  overflow: hidden;
}

.template-preset-item > div:first-child input.group-name-input {
  width: 100%;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0 6px;
  font-size: 12px;
  background: var(--surface);
  color: var(--text);
}

.preset-item__meta,
.template-preset-meta {
  color: var(--text-4);
  font-size: 11px;
  width: 100%;
}

/* Slot list */
.slot-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slot-item {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  background: var(--surface);
}

.slot-item .slot-key {
  font-weight: 700;
  color: var(--primary-txt);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Role rule list */
.role-rule-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.role-rule-item {
  border: 1px solid rgba(99,102,241,.18);
  border-radius: 7px;
  padding: 6px 8px;
  display: grid;
  grid-template-columns: 1fr 72px 72px auto;
  gap: 4px;
  align-items: center;
  font-size: 11px;
  background: rgba(99,102,241,.06);
  transition: border-color .15s;
}
.role-rule-item:hover {
  border-color: rgba(99,102,241,.4);
}

/* --- 8. Property Forms --- */

/* Field label + input */
.field-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field-input {
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.field-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.field-input[type="number"] { font-variant-numeric: tabular-nums; }

select.field-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}

/* Field grids — all field items must not shrink so their parent can scroll */
.field-grid-1 { display: flex; flex-direction: column; gap: 6px; }
.field-grid-1 > * { flex-shrink: 0; }

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

.field-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Checkbox field variant */
.checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
}

.checkbox-field input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* Subsection headings within props */
.prop-subtitle {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 0 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}

/* Hint text */
.hint-text {
  font-size: 12px;
  color: var(--text-4);
  text-align: center;
  padding: 16px 8px;
  background: var(--surface-2);
  border-radius: var(--r);
  border: 1px dashed var(--border);
}

/* Meta text */
.meta-text {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}

/* --- 9. Buttons --- */

/* Small buttons (in panels) */
.btn-sm {
  height: 27px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.1s;
  flex-shrink: 0;
}

.btn-sm:hover {
  border-color: var(--border-hi);
  background: var(--surface-2);
  color: var(--text);
}

.btn-sm.btn-primary-sm {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-sm.btn-primary-sm:hover { background: var(--primary-hov); border-color: var(--primary-hov); }

.btn-sm.btn-danger-sm {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-sm.btn-danger-sm:hover { background: var(--danger-hov); border-color: var(--danger-hov); }

/* Mini inline button */
.mini-btn {
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-sm);
  font-size: 11px;
  color: var(--text-3);
  cursor: pointer;
  flex-shrink: 0;
}
.mini-btn:hover { border-color: var(--border-hi); color: var(--text); }

/* Button row */
.btn-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* Action row (page controls in left sidebar) */
.action-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* --- 10. Spacing utilities --- */
.mt-4  { margin-top: 4px; }
.mt-6  { margin-top: 6px; }
.mt-8  { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.flex-1 { flex: 1; min-width: 0; }
.full-width { width: 100%; }
.hidden { display: none !important; }

/* --- 11. Canvas Layer System (keep for app.js compatibility) --- */

.layer {
  position: absolute;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
  border: 0;
  cursor: move;
  border-radius: 1px;
}

.layer.locked { outline: 1px solid rgba(239,68,68,0.45); outline-offset: 0; }
.layer.selected { outline: 1.5px dashed var(--primary); outline-offset: 0; }
.layer.timeline-active { box-shadow: 0 0 0 2px rgba(239,68,68,0.5); }
.layer.hidden-layer { opacity: 0.2 !important; }
.layer.out-of-bounds {
  outline: 1.5px solid rgba(239,68,68,0.9);
  outline-offset: 0;
}
.layer.out-of-bounds::before {
  content: '超界';
  position: absolute;
  top: -18px;
  right: 0;
  font-size: 10px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 3px;
  background: rgba(239,68,68,0.9);
  color: #fff;
  pointer-events: none;
}

.layer img {
  width: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* Resize & Rotate handles */
.layer-resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  z-index: 20;
}

.layer-resize-handle.handle-se {
  right: -6px;
  bottom: -6px;
  cursor: nwse-resize;
}

.layer-resize-handle.handle-e {
  right: -6px;
  top: calc(50% - 6px);
  cursor: ew-resize;
}

.layer-resize-handle.handle-w {
  left: -6px;
  top: calc(50% - 6px);
  cursor: ew-resize;
}

.layer-resize-handle.handle-rotate {
  left: calc(50% - 6px);
  top: -22px;
  cursor: grab;
  border-color: #0f766e;
  background: #f0fdfa;
}

/* Snap guides */
.snap-guide {
  position: absolute;
  background: rgba(14,165,233,0.8);
  pointer-events: none;
  z-index: 999;
}

.safe-area-frame {
  position: absolute;
  left: 5%;
  top: 5%;
  width: 90%;
  height: 90%;
  border: 1px dashed rgba(16,185,129,0.85);
  border-radius: 2px;
  pointer-events: none;
  z-index: 1;
}

.safe-area-label {
  position: absolute;
  left: 6%;
  top: 5%;
  transform: translateY(-110%);
  font-size: 10px;
  color: #065f46;
  background: rgba(167,243,208,0.85);
  border: 1px solid rgba(16,185,129,0.6);
  border-radius: 3px;
  padding: 1px 6px;
  pointer-events: none;
  z-index: 1;
}

.snap-guide.v { top: 0; bottom: 0; width: 1px; }
.snap-guide.h { left: 0; right: 0; height: 1px; }

.snap-gap-line {
  position: absolute;
  height: 1px;
  background: rgba(16,185,129,0.9);
  pointer-events: none;
  z-index: 999;
}

.snap-gap-text {
  position: absolute;
  transform: translate(-50%, -120%);
  background: rgba(15,23,42,0.85);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 1000;
}

/* Component preview inside canvas */
.component-preview {
  width: 100%;
  min-height: 40px;
  border-radius: var(--r);
  border: 1px solid #93c5fd;
  background: rgba(59,130,246,0.07);
  color: var(--primary-txt);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px;
  font-weight: 500;
}

.component-preview.form    { min-height: 80px; }
.component-preview.video,
.component-preview.carousel { min-height: 70px; }

/* --- 12. Modals --- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  backdrop-filter: blur(2px);
}

.modal-box {
  width: min(92vw, 920px);
  height: min(90vh, 800px);
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-box.modal-sm {
  width: min(92vw, 520px);
  height: auto;
  max-height: 90vh;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  flex-shrink: 0;
}

.modal-close-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--r);
  color: var(--text-3);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.1s;
}

.modal-close-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#previewFrame {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  margin: 0;
  display: block;
  background: #f0f0f0;
}

/* --- 13. Toast 通知系统 --- */
#toast-container {
  position: fixed;
  top: 60px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  max-width: 360px;
  padding: 10px 14px 10px 12px;
  border-radius: var(--r-lg);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  pointer-events: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.10);
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.28s ease, transform 0.28s ease;
  will-change: opacity, transform;
}

.toast.entering {
  opacity: 0;
  transform: translateX(16px);
}

.toast.leaving {
  opacity: 0;
  transform: translateX(16px);
}

.toast--success {
  background: #166534;
  color: #dcfce7;
  border-left: 3px solid #4ade80;
}

.toast--error {
  background: #7f1d1d;
  color: #fee2e2;
  border-left: 3px solid #f87171;
}

.toast--warning {
  background: #78350f;
  color: #fef3c7;
  border-left: 3px solid #fbbf24;
}

.toast--info {
  background: #1e3a5f;
  color: #dbeafe;
  border-left: 3px solid #60a5fa;
}

.toast__icon {
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast__msg {
  flex: 1;
  word-break: break-word;
}

.toast__close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 0;
  font-size: 13px;
  line-height: 1;
  margin-top: 1px;
}

.toast__close:hover {
  opacity: 1;
}

/* --- 14. 文本图层 --- */
.component-preview.text {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  padding: 6px 8px;
  word-break: break-all;
  text-align: center;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: pre-wrap;
}

/* 自动保存状态指示器 */
.autosave-indicator {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-4);
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 50;
  backdrop-filter: blur(4px);
}

.autosave-indicator.visible {
  opacity: 1;
}

/* 快捷键提示 */
.shortcut-hint {
  font-size: 10px;
  color: var(--text-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
  font-family: monospace;
  vertical-align: middle;
}

/* 场景列表复制按钮 */
.scene-item-actions {
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  gap: 2px;
}

.scene-item:hover .scene-item-actions {
  display: flex;
}

.scene-item {
  position: relative;
}

.scene-dup-btn {
  padding: 2px 5px;
  font-size: 10px;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  color: var(--text-2);
  line-height: 1.4;
}

.scene-dup-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* --- 15. 属性面板优化 --- */

/* 属性区块标题带左边色条 */
.prop-subtitle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  position: relative;
}

.prop-subtitle::before {
  content: '';
  width: 3px;
  height: 12px;
  background: var(--primary);
  border-radius: 2px;
  flex-shrink: 0;
}

/* 数字输入框更紧凑 */
.field-grid-3 .field-input[type="number"],
.field-grid-2 .field-input[type="number"] {
  text-align: right;
  padding-right: 6px;
}

/* 颜色选择器 */
.field-input[type="color"] {
  padding: 2px 4px;
  cursor: pointer;
  height: 30px;
}

/* ===== 双色输入（色块 + Hex文本） ===== */
.color-field-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.color-swatch-btn {
  flex-shrink: 0;
  width: 32px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 2px;
  cursor: pointer;
  background: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.color-swatch-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}
.color-hex-input {
  flex: 1;
  min-width: 0;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
}

/* ===== 透明度滑条 ===== */
.opacity-field-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.range-slider {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  accent-color: var(--primary);
  cursor: pointer;
}
.opacity-num-input {
  width: 56px !important;
  flex-shrink: 0;
  text-align: right;
  padding-right: 6px;
}

/* ===== 带单位的输入框 ===== */
.input-with-unit {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
}
.input-with-unit .field-input {
  border-radius: var(--r) 0 0 var(--r);
  border-right: none;
}
.input-unit {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  min-width: 24px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--r) var(--r) 0;
  background: var(--surface-2, #f3f4f6);
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

/* ===== 位置/尺寸 组合网格 ===== */
.pos-size-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pos-size-group {
  background: var(--surface-2, #f8f9fa);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}
.pos-size-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.pos-size-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.pos-field {
  flex-direction: row !important;
  align-items: center !important;
  gap: 5px !important;
}
.pos-field .field-input {
  flex: 1;
  min-width: 0;
  text-align: right;
  padding-right: 6px;
}
.pos-axis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
  color: #fff;
}
.pos-axis-x { background: #ef4444; }
.pos-axis-y { background: #22c55e; }
.pos-axis-w { background: #3b82f6; }
.pos-axis-h { background: #f59e0b; }
.pos-unit {
  font-size: 10px;
  color: var(--text-3);
  flex-shrink: 0;
  font-weight: 600;
}

/* ===== 动画类型卡片选择器 ===== */
.anim-type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.anim-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 11px;
  color: var(--text-2);
  min-height: 50px;
}
.anim-card:hover {
  border-color: var(--primary);
  background: var(--primary-sub, rgba(37,99,235,0.06));
  color: var(--primary);
}
.anim-card.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}
.anim-card-icon {
  font-size: 16px;
  line-height: 1;
}
.anim-card-name {
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 100%;
}

/* ===== 高级动画参数折叠 ===== */
.anim-advanced {
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}
.anim-advanced-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  list-style: none;
}
.anim-advanced-toggle::-webkit-details-marker { display: none; }
.anim-advanced-toggle::before {
  content: '▶';
  font-size: 8px;
  transition: transform 0.15s;
}
details.anim-advanced[open] .anim-advanced-toggle::before {
  transform: rotate(90deg);
}
.anim-advanced > .field-grid-2 {
  padding: 8px;
  border-top: 1px solid var(--border);
  background: var(--surface-2, #f8f9fa);
}

/* 图层列表 — 视觉改进 */
.layer-item {
  border-radius: 6px;
}

/* 多选提示标签 */
.layer-multisel-tip {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  background: var(--surface-2, #f3f4f6);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  letter-spacing: 0.02em;
  text-transform: none;
}

/* 图层头部全选按钮 */
.layer-head-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid rgba(99,102,241,.35);
  background: rgba(99,102,241,.1);
  color: #a5b4fc;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.layer-head-btn:hover {
  background: rgba(99,102,241,.25);
  border-color: #6366f1;
  color: #c7d2fe;
}

/* 多选浮出操作栏 */
.layer-multi-bar {
  padding: 7px 10px 8px;
  background: linear-gradient(135deg, rgba(37,99,235,0.07), rgba(99,102,241,0.1));
  border-top: 1px solid rgba(99,102,241,.3);
  border-radius: 0 0 8px 8px;
}
.layer-multi-bar-top {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}
.layer-multi-bar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.layer-multi-hint {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(99,102,241,.15);
}
.layer-multi-hint span {
  font-size: 10px;
  color: #6b7280;
}
.multi-count {
  font-size: 11px;
  font-weight: 700;
  color: #a5b4fc;
  white-space: nowrap;
}
.multi-act-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--primary);
  border-radius: 5px;
  background: #fff;
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
  flex-shrink: 0;
}
.multi-act-btn:hover {
  background: var(--primary);
  color: #fff;
}
.multi-act-btn.multi-act-danger {
  border-color: #ef4444;
  color: #ef4444;
}
.multi-act-btn.multi-act-danger:hover {
  background: #ef4444;
  color: #fff;
}
.multi-act-btn.multi-act-ghost {
  border-color: var(--border);
  color: var(--text-3);
}
.multi-act-btn.multi-act-ghost:hover {
  background: var(--border);
  color: var(--text);
}

/* 编组成员缩进标识 */
.layer-item.in-group {
  border-left: 3px solid #818cf8;
  padding-left: 8px;
  margin-left: 6px;
  border-radius: 0 6px 6px 0;
  background: rgba(129,140,248,0.04);
}
.layer-item.in-group.group-first {
  border-top: 1px solid rgba(129,140,248,0.3);
  border-radius: 0 6px 0 0;
}
.layer-item.in-group.group-last {
  border-bottom: 1px solid rgba(129,140,248,0.3);
  border-radius: 0 0 6px 0;
}

/* ===== 组件专属参数面板 ===== */
.comp-section {
  margin-top: 10px;
}
.comp-section-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 0 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

/* 开关按钮组 */
.comp-switch-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.comp-switch-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-2);
  user-select: none;
}
.comp-switch-input {
  display: none;
}
.comp-switch-track {
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: var(--border);
  position: relative;
  flex-shrink: 0;
  transition: background 0.18s;
}
.comp-switch-track::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform 0.18s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.comp-switch-input:checked + .comp-switch-track {
  background: var(--primary);
}
.comp-switch-input:checked + .comp-switch-track::after {
  transform: translateX(14px);
}

/* 表单字段编辑器 */
.form-fields-editor,
.carousel-items-editor {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 6px;
}
.form-field-row,
.carousel-item-row {
  display: flex;
  align-items: center;
  gap: 5px;
}
.form-field-row .field-input,
.carousel-item-row .field-input {
  flex: 1;
  height: 28px;
  font-size: 12px;
}
.form-field-type {
  width: 74px;
  height: 28px;
  font-size: 11px;
  flex-shrink: 0;
}
.field-del-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid #fca5a5;
  border-radius: 5px;
  background: #fff5f5;
  color: #ef4444;
  cursor: pointer;
  font-size: 13px;
  flex-shrink: 0;
  transition: all 0.12s;
}
.field-del-btn:hover {
  background: #ef4444;
  color: #fff;
}

/* 添加按钮 */
.comp-add-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  height: 30px;
  border: 1px dashed var(--border);
  border-radius: var(--r);
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  cursor: pointer;
  justify-content: center;
  transition: all 0.12s;
}
.comp-add-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-sub);
}

/* 编组标识点 */
.group-dot {
  display: inline-block;
  color: #818cf8;
  font-size: 14px;
  line-height: 1;
  margin-right: 3px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* 折叠分组行 */
.layer-item.group-collapsed-row {
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 7px;
  padding: 5px 8px;
  margin: 2px 0;
}
.group-collapsed-row .group-name-tag {
  font-weight: 600;
  font-size: 11px;
  color: #4f46e5;
  flex: 1;
}

.layer-item .type-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.layer-item .type-badge.img  { background: #e0f2fe; color: #0369a1; }
.layer-item .type-badge.btn  { background: #dcfce7; color: #166534; }
.layer-item .type-badge.txt  { background: #fef3c7; color: #92400e; }
.layer-item .type-badge.vid  { background: #f3e8ff; color: #7e22ce; }
.layer-item .type-badge.form { background: #fce7f3; color: #9d174d; }
.layer-item .type-badge.csl  { background: #e0e7ff; color: #3730a3; }

/* 场景缩略图 */
.scene-thumb {
  width: 40px;
  height: 24px;
  object-fit: cover;
  border-radius: 3px;
  background: #f0f4ff;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

/* 拖拽提示 */
.drag-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(37,99,235,0.08);
  border: 2px dashed var(--primary);
  border-radius: var(--r);
  font-size: 13px;
  color: var(--primary);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 100;
}

.canvas-area.dragging-over .drag-hint {
  opacity: 1;
}

.audio-preview-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.audio-preview-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 画布右下角尺寸/缩放水印 */
.canvas-zoom-label {
  position: fixed;
  bottom: 24px;
  right: 300px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.65);
  background: rgba(30,40,60,0.55);
  border-radius: 20px;
  padding: 3px 10px;
  pointer-events: none;
  z-index: 20;
  backdrop-filter: blur(4px);
}

/* 组件预览通用 */
.component-preview {
  width: 100%;
  height: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  pointer-events: none;
  overflow: hidden;
  user-select: none;
}

.component-preview.button {
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px;
}

.component-preview.form {
  font-size: 12px;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
}

.component-preview.video {
  font-size: 22px;
  flex-direction: column;
  gap: 4px;
}

.component-preview.carousel {
  font-size: 12px;
}

/* 层级工具栏 - 对齐/分布高亮 */
.tb-btn-tool.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* 工具栏分组标签 */
.toolbar-group-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  padding: 0 2px;
  flex-shrink: 0;
}

/* 健康检查徽章改进 */
.health-badge.warn { background: #d97706; }
.health-badge.error { background: #dc2626; }
.health-badge.ok { background: #16a34a; }

/* 时间轴轨道高亮 */
.timeline-bar.entry { background: var(--primary); opacity: 0.85; }
.timeline-bar.hold  { background: #0891b2; opacity: 0.75; }
.timeline-bar.exit  { background: #7c3aed; opacity: 0.75; }

/* --- 16. 全局滚动条美化 --- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-hi);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* --- 17. 图层在画布上 selected 状态改进 --- */
.layer.selected::after {
  content: '';
  position: absolute;
  inset: -2px;
  border: 2px solid var(--primary);
  border-radius: 3px;
  pointer-events: none;
  z-index: 100;
}

/* --- 18. 空状态改进 --- */
.no-layer-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
  gap: 8px;
  color: var(--text-4);
  font-size: 12px;
}

.no-layer-hint__icon {
  font-size: 32px;
  opacity: 0.5;
}

.no-layer-hint__title {
  font-weight: 600;
  color: var(--text-3);
  font-size: 13px;
}

/* --- 19. 响应式改进 --- */
@media (max-width: 1200px) {
  :root {
    --sl-w: 200px;
    --sr-w: 256px;
  }
}

@media (max-width: 900px) {
  :root {
    --sl-w: 0px;
    --sr-w: 0px;
  }
  .sidebar { display: none; }
  .app-header__nav { overflow-x: auto; }
}

/* ── Header dropdown menus ─────────────────────────────────────────────────── */
.hbtn.hbtn--accent2 {
  background: rgba(99,102,241,.15);
  color: #a78bfa;
  border-color: rgba(99,102,241,.3);
}
.hbtn.hbtn--accent2:hover { background: rgba(99,102,241,.25); }

/* Fix: Prevent SVG from being click target */
.hbtn svg,
.hbtn svg * {
  pointer-events: none;
}

.hbtn-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 1200;
  background: #1a1a26;
  border: 1px solid #24243a;
  border-radius: 10px;
  padding: 5px;
  min-width: 190px;
  box-shadow: 0 8px 28px rgba(0,0,0,.5);
  display: none;
}
.hbtn-dropdown.open { display: block; }
.hbtn-dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 7px;
  border: none;
  background: none;
  color: #c0c0d8;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background .12s, color .12s;
}
.hbtn-dd-item:hover { background: rgba(99,102,241,.12); color: #e8e8f2; }
.hbtn-dd-sep { height: 1px; background: #24243a; margin: 4px 0; }

/* ── Modal overlay ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: #13131c;
  border: 1px solid #24243a;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  overflow: hidden;
  color: #e8e8f2;
}
.modal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #24243a;
  font-size: 15px;
  font-weight: 700;
  color: #e8e8f2;
  background: #161625;
}
.modal-close {
  background: none;
  border: none;
  color: #9090b8;
  cursor: pointer;
  font-size: 15px;
  padding: 2px 6px;
  border-radius: 5px;
}
.modal-close:hover { background: rgba(255,255,255,.06); color: #e8e8f2; }
.modal-bd { padding: 16px 20px; overflow-y: auto; flex: 1; color: #c8cbea; }
.modal-ft {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid #24243a;
}

/* Cloud modal form controls */
.prop-row { display: flex; flex-direction: column; gap: 6px; }
.prop-label {
  font-size: 12px;
  font-weight: 600;
  color: #b7bcdf;
}
.prop-input,
.prop-select {
  width: 100%;
  height: 34px;
  border: 1px solid #2e324d;
  border-radius: 8px;
  padding: 0 10px;
  background: #1a1d2e;
  color: #e8e8f2;
  font-size: 13px;
  outline: none;
}
.prop-input:focus,
.prop-select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99,102,241,.18);
}
.prop-input::placeholder { color: #7e84ad; }

/* ── Cloud project list item ─────────────────────────────────────────────── */
.cloud-proj-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 13px;
  border: 1px solid #24243a;
  border-radius: 10px;
  background: #1a1a26;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.cloud-proj-item:hover { border-color: rgba(99,102,241,.5); background: rgba(99,102,241,.06); }
.cloud-proj-name { font-size: 14px; font-weight: 600; }
.cloud-proj-meta { font-size: 12px; color: #9090b8; margin-top: 3px; }

/* ══════════════════════════════════════════════════════════════════════════
   内置模板库样式
═══════════════════════════════════════════════════════════════════════════ */

/* 分类按钮栏 */
/* 分类筛选按钮 */
.tpl-cat-btn {
  padding: 4px 11px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  background: transparent;
  color: #8080a8;
  font-size: 11px;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}
.tpl-cat-btn:hover { border-color: rgba(99,102,241,.5); color: #c4c4e0; background: rgba(99,102,241,.06); }
.tpl-cat-btn.active { background: rgba(99,102,241,.22); border-color: rgba(99,102,241,.7); color: #a5b4fc; font-weight: 700; }

/* 模板网格 */
.builtin-tpl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

/* 模板卡片 */
.builtin-tpl-card {
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid rgba(255,255,255,.07);
  background: #13131e;
  cursor: pointer;
  transition: border-color .18s, transform .18s, box-shadow .18s;
  display: flex;
  flex-direction: column;
  position: relative;
}
.builtin-tpl-card:hover {
  border-color: rgba(99,102,241,.7);
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 8px 24px rgba(0,0,0,.5), 0 0 0 1px rgba(99,102,241,.2);
}
.builtin-tpl-card:hover .builtin-tpl-use-btn {
  background: rgba(99,102,241,.5);
  color: #fff;
}

/* 卡片预览区 */
.builtin-tpl-preview {
  height: 130px;
  position: relative;
  overflow: hidden;
}
.builtin-tpl-preview::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 60%, rgba(0,0,0,.25) 100%);
  pointer-events: none;
}

/* 卡片信息区 */
.builtin-tpl-info {
  padding: 7px 8px 3px;
  flex: 1;
}
.builtin-tpl-name {
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.builtin-tpl-desc {
  font-size: 10px;
  color: #525272;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* 使用按钮 */
.builtin-tpl-use-btn {
  display: block;
  width: calc(100% - 14px);
  margin: 4px 7px 7px;
  padding: 6px;
  border: none;
  border-radius: 7px;
  background: rgba(99,102,241,.16);
  color: #8896d0;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  letter-spacing: .5px;
}
.builtin-tpl-use-btn:hover {
  background: rgba(99,102,241,.48);
  color: #ffffff;
}

/* ========== 设置面板 ========== */

/* 画布快捷预设按钮 */
.canvas-preset-btn {
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: #8896d0;
  font-size: 10px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.canvas-preset-btn:hover {
  border-color: rgba(99,102,241,.5);
  background: rgba(99,102,241,.15);
  color: #a5b4fc;
}

/* Toggle 开关行 */
.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.settings-toggle-label {
  font-size: 11px;
  color: #c8d0e8;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255,255,255,.12);
  border-radius: 18px;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.toggle-switch input:checked + .toggle-slider {
  background: #6366f1;
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(14px);
}

/* ========== 规则面板重设计 ========== */

/* 使用说明盒子 */
.rules-guide-box {
  background: linear-gradient(135deg, #1a1a2e 0%, #12122a 100%);
  border: 1px solid rgba(99,102,241,.25);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.rules-guide-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #a5b4fc;
  margin-bottom: 10px;
}
.rules-guide-steps {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 12px;
}
.rules-guide-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11px;
  color: #c8d0e8;
  line-height: 1.5;
}
.rules-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  min-width: 18px;
  background: rgba(99,102,241,.4);
  color: #a5b4fc;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  margin-top: 1px;
}
.rules-step-eg {
  font-size: 10px;
  color: #6b7280;
}

/* 手机示意图 */
.rules-phone-mockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
  width: 90px;
}
.rules-phone-screen {
  width: 90px;
  height: 160px;
  border: 2.5px solid rgba(99,102,241,.5);
  border-radius: 10px;
  background: #0d0d1f;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.rules-phone-home {
  width: 20px;
  height: 4px;
  background: rgba(99,102,241,.4);
  border-radius: 2px;
  margin-top: 4px;
}
.rules-role-zone {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  text-align: center;
  font-size: 8px;
  padding: 3px 0;
  border-radius: 3px;
  line-height: 1.3;
  pointer-events: none;
}
.rules-role-top {
  top: 4px;
  background: rgba(99,240,120,.15);
  color: #6ee7a0;
  border: 1px solid rgba(99,240,120,.3);
}
.rules-role-center {
  top: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  background: rgba(99,160,241,.15);
  color: #93c5fd;
  border: 1px solid rgba(99,160,241,.3);
}
.rules-role-bottom {
  bottom: 4px;
  background: rgba(241,99,99,.15);
  color: #fca5a5;
  border: 1px solid rgba(241,99,99,.3);
}
.rules-role-left {
  top: 50%;
  left: 8px;
  transform: translateY(-50%);
  width: 24px;
  background: rgba(241,200,99,.12);
  color: #fcd34d;
  border: 1px solid rgba(241,200,99,.25);
  border-radius: 3px;
  font-size: 7px;
  text-align: center;
  padding: 4px 2px;
  line-height: 1.3;
}
.rules-role-right {
  top: 50%;
  left: auto;
  right: 8px;
  transform: translateY(-50%);
  width: 24px;
  background: rgba(200,99,241,.12);
  color: #d8b4fe;
  border: 1px solid rgba(200,99,241,.25);
  border-radius: 3px;
  font-size: 7px;
  text-align: center;
  padding: 4px 2px;
  line-height: 1.3;
}
.rules-role-logo {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 16px;
  height: 16px;
  background: rgba(251,146,60,.2);
  border: 1px solid rgba(251,146,60,.4);
  color: #fb923c;
  border-radius: 50%;
  font-size: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* 角色选择卡片网格 */
.role-select-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-bottom: 10px;
}
.role-select-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 4px;
  border-radius: 7px;
  border: 1.5px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.03);
  cursor: pointer;
  transition: all .15s;
}
.role-select-card:hover {
  border-color: rgba(99,102,241,.5);
  background: rgba(99,102,241,.1);
}
.role-select-card.active {
  border-color: #6366f1;
  background: rgba(99,102,241,.2);
}
.role-card-icon {
  font-size: 14px;
  line-height: 1;
}
.role-card-label {
  font-size: 10px;
  color: #c8d0e8;
  font-weight: 500;
}
.role-select-card.active .role-card-label {
  color: #a5b4fc;
}

/* 角色详情盒子 */
.role-detail-box {
  background: rgba(99,102,241,.07);
  border: 1px solid rgba(99,102,241,.2);
  border-radius: 8px;
  padding: 10px;
}
.role-detail-title {
  font-size: 11px;
  font-weight: 700;
  color: #a5b4fc;
  margin-bottom: 8px;
}

/* 一键布局按钮（旧，保留兼容） */
.rules-layout-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
  color: #c8d0e8;
  font-size: 11px;
  cursor: pointer;
  transition: all .18s;
}
.rules-layout-btn:hover {
  border-color: rgba(99,102,241,.5);
  background: rgba(99,102,241,.15);
  color: #a5b4fc;
}
.rules-layout-btn-icon { font-size: 18px; line-height: 1; }

/* ========== 智能自动排版 ========== */
.auto-layout-desc {
  font-size: 11px;
  color: #8896d0;
  line-height: 1.6;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: rgba(99,102,241,.08);
  border-radius: 7px;
  border-left: 3px solid rgba(99,102,241,.5);
}

/* 布局方案网格 */
.auto-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 0;
}
.auto-layout-card {
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.03);
  cursor: pointer;
  transition: all .15s;
  overflow: hidden;
}
.auto-layout-card:hover {
  border-color: rgba(99,102,241,.5);
  background: rgba(99,102,241,.1);
}
.auto-layout-card.selected {
  border-color: #6366f1;
  background: rgba(99,102,241,.2);
  box-shadow: 0 0 0 2px rgba(99,102,241,.3);
}

/* 布局预览小屏 */
.alc-preview {
  position: relative;
  width: 100%;
  padding-top: 56%;
  background: linear-gradient(160deg, #0d0d1f 0%, #12122a 100%);
  border-bottom: 1px solid rgba(255,255,255,.06);
  overflow: hidden;
}
.alc-el {
  position: absolute;
  width: 80%;
  left: 10%;
  border-radius: 2px;
}
.alc-el-img { background: rgba(99,160,241,.3); border: 1px solid rgba(99,160,241,.4); }
.alc-el-title { background: rgba(255,255,255,.35); }
.alc-el-text { background: rgba(255,255,255,.15); }
.alc-el-btn { background: rgba(99,102,241,.5); border-radius: 3px; }

.alc-name {
  font-size: 10px;
  font-weight: 700;
  color: #c8d0e8;
  text-align: center;
  padding: 4px 2px 1px;
}
.alc-desc {
  font-size: 9px;
  color: #6b7280;
  text-align: center;
  padding: 0 2px 4px;
}

/* 动画风格选择 */
.auto-anim-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.auto-anim-chip {
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: #8896d0;
  font-size: 10px;
  cursor: pointer;
  transition: all .15s;
}
.auto-anim-chip:hover {
  border-color: rgba(99,102,241,.4);
  color: #a5b4fc;
}
.auto-anim-chip.active {
  background: rgba(99,102,241,.25);
  border-color: #6366f1;
  color: #c7d2fe;
  font-weight: 600;
}

/* 执行按钮 */
.smart-layout-apply-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all .18s;
  letter-spacing: .3px;
}
.smart-layout-apply-btn:hover {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(99,102,241,.5);
}
.smart-layout-apply-btn:active {
  transform: translateY(0);
}

