/* ── PPT Assistant: PowerPoint-style Editor ── */

.ppt-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.25s;
}
.ppt-overlay.hidden { display: none; }

.ppt-card {
  width: 96vw;
  height: 94vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Toolbar ── */
.ppt-toolbar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
  background: #fafbfc;
}
.ppt-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ppt-toolbar-title {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}
.ppt-toolbar-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #999;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
}
.ppt-toolbar-close:hover { background: #f0f0f0; color: #333; }

.ppt-toolbar-center {
  display: flex;
  align-items: center;
  gap: 4px;
}
/* Toolbar icon-only buttons */
.ppt-tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
}
.ppt-tool-btn:hover {
  background: rgba(0, 148, 244, 0.06);
  color: var(--color-primary, #0094F4);
}
.ppt-tool-btn svg { flex-shrink: 0; }
.ppt-tool-btn.active {
  color: var(--color-primary, #0094F4);
  background: rgba(0, 148, 244, 0.1);
}
.ppt-tool-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}
.ppt-toolbar-sep {
  width: 1px;
  height: 20px;
  background: #ddd;
  margin: 0 4px;
}

.ppt-toolbar-right {
  display: flex;
  align-items: center;
}
.ppt-confirm-btn {
  padding: 7px 20px;
  border: none;
  border-radius: 8px;
  background: var(--color-primary, #0094F4);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}
.ppt-confirm-btn:hover { opacity: 0.85; }
.ppt-confirm-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Refresh All Button ── */
.ppt-refresh-all-btn {
  padding: 7px 10px;
  border: 1px solid var(--color-primary, #0094F4);
  border-radius: 8px;
  background: transparent;
  color: var(--color-primary, #0094F4);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
}
.ppt-refresh-all-btn:hover { background: var(--color-primary, #0094F4); color: #fff; }
.ppt-refresh-all-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Spin animation for refresh buttons ── */
@keyframes ppt-spin-anim {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.ppt-spin { animation: ppt-spin-anim 1s linear infinite; }

/* ── Inline refresh button (properties panel) ── */
.ppt-prop-btn.ppt-refresh-inline {
  width: 32px;
  flex: 0 0 32px;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: var(--color-primary, #0094F4);
  color: var(--color-primary, #0094F4);
}
.ppt-prop-btn.ppt-refresh-inline:hover {
  background: var(--color-primary, #0094F4);
  color: #fff;
}

/* ── Editor main area ── */
.ppt-editor {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* ── Left: Unified panel with tabs ── */
.ppt-left-panel {
  width: 180px;
  min-width: 120px;
  max-width: 700px;
  flex-shrink: 0;
  background: #f5f6f8;
  border-right: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.25s ease, min-width 0.25s ease;
  position: relative;
}
.ppt-left-panel.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  border-right: none;
}
/* Toggle button that stays visible when collapsed */
.ppt-left-toggle {
  position: absolute;
  top: 8px;
  right: -24px;
  width: 22px;
  height: 44px;
  background: #f0f1f3;
  border: 1px solid #e0e0e0;
  border-left: none;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  color: #999;
  transition: all 0.15s;
}
.ppt-left-toggle:hover {
  background: #e8e8e8;
  color: #555;
}
.ppt-left-toggle svg {
  transition: transform 0.25s ease;
}
.ppt-left-panel.collapsed .ppt-left-toggle {
  right: -24px;
}
.ppt-left-panel.collapsed .ppt-left-toggle svg {
  transform: rotate(180deg);
}
.ppt-left-tabs {
  display: flex;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
  background: #fff;
}
.ppt-left-tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: none;
  font-size: 12px;
  color: #888;
  cursor: pointer;
  transition: all 0.15s;
  border-bottom: 2px solid transparent;
  font-weight: 500;
}
.ppt-left-tab:hover { color: #555; background: #f8f8f8; }
.ppt-left-tab.active {
  color: var(--color-primary, #0094F4);
  border-bottom-color: var(--color-primary, #0094F4);
  font-weight: 600;
}
.ppt-left-tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.ppt-left-tab-content::-webkit-scrollbar { width: 4px; }
.ppt-left-tab-content::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.ppt-outline-tree {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  font-size: 13px;
  line-height: 1.6;
}
.ppt-outline-tree::-webkit-scrollbar { width: 4px; }
.ppt-outline-tree::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

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

/* Thumbnail item */
.slide-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #fff;
  border: 2px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
  padding: 4px;
  font-size: 5px;
  line-height: 1.3;
  color: #666;
}
.slide-thumb:hover { border-color: #aaa; }
.slide-thumb.active {
  border-color: var(--color-primary, #0094F4);
  box-shadow: 0 0 0 1px var(--color-primary, #0094F4);
  background-color: rgba(0, 148, 244, 0.04);
}
.slide-thumb:focus {
  outline: none;
  border-color: var(--color-primary, #0094F4);
  box-shadow: 0 0 0 1.5px rgba(0, 148, 244, 0.3);
}

/* Thumbnail insertion zone between slides */
.thumb-insert-zone {
  height: 12px;
  margin: -6px 0;
  position: relative;
  z-index: 5;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, background-color 0.2s;
}
.thumb-insert-zone:hover {
  opacity: 1;
}
.thumb-insert-zone::after {
  content: "+";
  font-size: 14px;
  font-weight: bold;
  color: #fff;
  background: var(--color-primary, #0094F4);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.slide-thumb .thumb-num {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 8px;
  color: #999;
  font-weight: 600;
}
.slide-thumb .thumb-title {
  font-size: 6px;
  font-weight: 700;
  color: #333;
  margin-top: 8px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slide-thumb .thumb-content {
  font-size: 5px;
  color: #888;
  margin-top: 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.slide-thumb .thumb-type-badge {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 5px;
  padding: 0 3px;
  border-radius: 2px;
  font-weight: 600;
}
.thumb-type-badge.t-title { background: #e3f2fd; color: #1565c0; }
.thumb-type-badge.t-content { background: #e8f5e9; color: #2e7d32; }
.thumb-type-badge.t-chart { background: #fff3e0; color: #e65100; }
.thumb-type-badge.t-table { background: #f3e5f5; color: #7b1fa2; }
.thumb-type-badge.t-footer { background: #f5f5f5; color: #757575; }

/* Thumbnail drag-sort */
.slide-thumb.dragging { opacity: 0.4; border-style: dashed; border-color: var(--color-primary, #0094F4); }
.slide-thumb.drag-over-top { box-shadow: 0 -2px 0 0 var(--color-primary, #0094F4); }
.slide-thumb.drag-over-bottom { box-shadow: 0 2px 0 0 var(--color-primary, #0094F4); }

/* Thumbnail delete button */
.thumb-delete-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border: none;
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  z-index: 2;
  padding: 0;
}
.slide-thumb:hover .thumb-delete-btn { opacity: 1; }
.thumb-delete-btn:hover { background: #e53935; }

/* Thumbnail add-slide button */
.thumb-add-btn {
  width: 100%;
  padding: 6px 0;
  margin-top: 6px;
  border: 1.5px dashed #ccc;
  border-radius: 4px;
  background: none;
  color: #999;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.thumb-add-btn:hover {
  border-color: var(--color-primary, #0094F4);
  color: var(--color-primary, #0094F4);
  background: rgba(0, 148, 244, 0.04);
}

/* Outline insert-slide button */
.outline-insert-slide-btn { font-size: 13px; }

/* ── Resizer ── */
.ppt-resizer {
  width: 4px;
  flex-shrink: 0;
  cursor: col-resize;
  background: #e8e8e8;
  transition: background 0.15s;
}
.ppt-resizer:hover,
.ppt-resizer.active { background: var(--color-primary, #0094F4); }

/* ── Right: Canvas area ── */
.ppt-canvas-area {
  flex: 1;
  background: #e8e8e8;
  overflow: auto;
  position: relative;
}
.ppt-canvas-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
}
.ppt-slide-canvas {
  width: 960px;
  height: 540px;
  background: #fff;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
  position: absolute;
  overflow: hidden;
}

/* Canvas empty state */
.ppt-canvas-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #bbb;
  font-size: 14px;
  gap: 8px;
}
.ppt-canvas-empty svg { opacity: 0.3; }

/* ── Canvas elements ── */
.canvas-el {
  position: absolute;
  border: 2px solid transparent;
  cursor: move;
  transition: border-color 0.1s;
  box-sizing: border-box;
  overflow: hidden;
  user-select: none;
}
/* When selected, allow resize handles to show outside bounds */
.canvas-el.selected {
  overflow: visible;
}

/* Visual distinction by content source */
.canvas-el.source-user {
  border-color: #999;
  border-style: solid;
}
.canvas-el.source-user:hover {
  border-color: #666;
}

.canvas-el.source-ai.generated {
  border-color: #00d4aa;
  border-style: solid;
}
.canvas-el.source-ai.generated:hover {
  border-color: #00b894;
}

.canvas-el.source-ai.placeholder,
.canvas-el.source-placeholder {
  border-color: #00d4aa;
  border-style: dashed;
}
.canvas-el.source-ai.placeholder:hover,
.canvas-el.source-placeholder:hover {
  border-color: #00b894;
}

/* Text content wrapper to preserve resize handles */
.canvas-el-text-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  box-sizing: border-box;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.canvas-el:hover { border-color: rgba(0, 148, 244, 0.4); border-style: dashed; }
.canvas-el.selected {
  border-color: var(--color-primary, #0094F4);
  border-style: solid;
}
.canvas-el .el-delete {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ff4444;
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  display: none;
  z-index: 10;
}
.canvas-el.selected .el-delete { display: block; }

/* Source badge (top-left) */
.el-source-badge {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 18px;
  height: 18px;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  z-index: 9;
  display: none;
  pointer-events: none;
}
.canvas-el:hover .el-source-badge,
.canvas-el.selected .el-source-badge { display: block; }

/* Element type styles */
.canvas-el.type-title {
  font-size: 28px;
  font-weight: 700;
  color: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
}
.canvas-el.type-subtitle {
  font-size: 16px;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
}
.canvas-el.type-content {
  font-size: 14px;
  color: #333;
  padding: 10px 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}
.canvas-el.type-chart {
  border: 2px dashed rgba(0, 148, 244, 0.3);
  background: rgba(0, 148, 244, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
}
.canvas-el.type-chart .chart-placeholder {
  color: #0094F4;
  font-size: 13px;
  text-align: center;
  opacity: 0.7;
}
.canvas-el.type-chart .chart-placeholder svg {
  display: block;
  margin: 0 auto 6px;
  opacity: 0.4;
}
.canvas-el.type-table {
  border: 2px solid transparent !important;
  background: transparent !important;
  padding: 0;
}
.canvas-el.type-table.selected {
  border: 2px solid var(--color-primary, #0094F4) !important;
}
.canvas-el.type-table:hover:not(.selected) {
  border: 2px dashed rgba(0, 148, 244, 0.3) !important;
}
.canvas-el.type-table .table-scroll-wrapper {
  width: 100%;
  height: 100%;
  overflow: auto;
  padding: 4px;
  box-sizing: border-box;
}
.canvas-el.type-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.canvas-el.type-table th,
.canvas-el.type-table td {
  border: 1px solid #ddd;
  padding: 3px 6px;
  text-align: left;
}
.canvas-el.type-table th {
  background: #f0f0f0;
  font-weight: 600;
  font-size: 10px;
}
.canvas-el.type-table .table-placeholder {
  color: #4caf50;
  font-size: 13px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  opacity: 0.7;
}

/* Image element */
.canvas-el.type-image {
  border: 2px solid #ddd;
  background: #fafafa;
  overflow: hidden;
}
.canvas-el.type-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.canvas-el.type-image .image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #999;
  font-size: 13px;
  background: rgba(0,0,0,0.03);
}

/* Inline editing */
.canvas-el[contenteditable="true"] {
  cursor: text;
  outline: none;
  border-color: var(--color-primary, #0094F4);
  border-style: solid;
  user-select: text;
}

/* ── ChopChat Assistant Ball ── */
.chopchat-ball {
  position: fixed;
  top: 100px;
  right: 30px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00C9C3 0%, #0094F4 100%);
  box-shadow: 0 6px 20px rgba(0, 201, 195, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, opacity 0.3s;
  z-index: 9999;
  user-select: none;
  animation: chopchat-breathe 4s ease-in-out infinite;
}

/* Empty state styling enhancement */
.ppt-canvas-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #999;
  gap: 16px;
  text-align: center;
  padding: 40px;
}
.ppt-canvas-empty svg {
  color: var(--color-primary, #0094F4);
  opacity: 0.4;
  margin-bottom: 8px;
}
.ppt-canvas-empty .hint-main {
  font-size: 18px;
  font-weight: 500;
  color: #555;
}
.ppt-canvas-empty .hint-sub {
  font-size: 14px;
  color: #888;
  max-width: 300px;
  line-height: 1.6;
}
.ppt-canvas-empty .hint-arrow {
  position: absolute;
  top: 40px;
  right: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--color-primary, #0094F4);
  animation: hint-bounce 2s infinite;
}
@keyframes hint-bounce {
  0%, 100% { transform: translateY(0) rotate(-15deg); }
  50% { transform: translateY(-10px) rotate(-15deg); }
}
@keyframes chopchat-breathe {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(0, 201, 195, 0.35), 0 0 0 0 rgba(0, 148, 244, 0.15);
  }
  50% {
    box-shadow: 0 4px 18px rgba(0, 201, 195, 0.5), 0 0 0 10px rgba(0, 148, 244, 0);
  }
}

.chopchat-ball:hover {
  transform: scale(1.1);
  animation: none;
  box-shadow: 0 6px 24px rgba(0, 201, 195, 0.5);
}

.chopchat-ball:active {
  transform: scale(0.95);
}

.chopchat-ball.dragging {
  cursor: move;
  opacity: 0.8;
  animation: none;
}
.chopchat-ball.thinking {
  animation: chopchat-thinking 1s ease-in-out infinite !important;
}
@keyframes chopchat-thinking {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(0, 201, 195, 0.35), 0 0 20px rgba(0, 148, 244, 0.4);
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 4px 24px rgba(0, 201, 195, 0.6), 0 0 40px rgba(0, 148, 244, 0.6);
  }
}

/* Hover tooltip */
.chopchat-ball-tip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  letter-spacing: 0.3px;
}
.chopchat-ball-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.78);
}
.chopchat-ball:hover .chopchat-ball-tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.chopchat-ball.dragging .chopchat-ball-tip {
  opacity: 0;
}

/* Ball label */
.chopchat-ball-label {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 600;
  color: rgba(0, 148, 244, 0.7);
  letter-spacing: 0.8px;
  white-space: nowrap;
  pointer-events: none;
}

.chopchat-ball-canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
}

.chopchat-ball-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #ff4757;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(255, 71, 87, 0.4);
  animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ── Chat Panel (Right Side, left of properties panel) ── */
.ppt-chat-panel {
  width: 0;
  min-width: 0;
  max-width: 500px;
  flex-shrink: 0;
  background: #fff;
  border-left: 1px solid #e8e8e8;
  border-right: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.3s ease, min-width 0.3s ease;
  position: relative;
}
.ppt-chat-panel.open {
  width: 320px;
  min-width: 280px;
}

/* Chat panel resizer */
.ppt-chat-panel-resizer {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: ew-resize;
  z-index: 10;
  transition: background 0.15s;
}
.ppt-chat-panel-resizer:hover {
  background: rgba(0, 148, 244, 0.3);
}

.ppt-chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e8e8e8;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  background: #fafbfc;
  flex-shrink: 0;
}

.ppt-chat-panel-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.15s;
}
.ppt-chat-panel-close:hover {
  background: rgba(0,0,0,0.05);
  color: #333;
}

.ppt-chat-panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* ── Chat Messages (will be reused in new chat panel) ── */
.ppt-chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.ppt-chat-area::-webkit-scrollbar { width: 4px; }
.ppt-chat-area::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.ppt-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}
.ppt-msg.user {
  align-self: flex-end;
  background: var(--color-primary, #0094F4);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ppt-msg.assistant {
  align-self: flex-start;
  background: #f5f6fa;
  color: #333;
  border-bottom-left-radius: 4px;
}
.ppt-msg.assistant .ppt-msg-rendered { white-space: normal; }
.ppt-msg.assistant .ppt-msg-rendered p { margin: 0 0 4px; }
.ppt-msg.assistant .ppt-msg-rendered code {
  background: #e8e8e8;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 12px;
}
.ppt-msg.assistant .ppt-msg-rendered pre {
  background: #1e1e2e;
  color: #e8e8e8;
  padding: 8px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 11px;
  margin: 4px 0;
}

.ppt-input-area {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid #eee;
}
.ppt-input-area textarea {
  flex: 1;
  resize: none;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  min-height: 34px;
  max-height: 80px;
  background: #fafafa;
  transition: border-color 0.2s;
}
.ppt-input-area textarea:focus { border-color: var(--color-primary, #0094F4); }
.ppt-input-area button {
  padding: 7px 16px;
  border: none;
  border-radius: 8px;
  background: var(--color-primary, #0094F4);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}
.ppt-input-area button:hover { opacity: 0.85; }
.ppt-input-area button:disabled { opacity: 0.5; cursor: not-allowed; }
.ppt-input-area button.ppt-stop-btn {
  background: linear-gradient(135deg, #ef4444, #f59e0b);
  padding: 7px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ppt-input-area button.ppt-stop-btn:hover { opacity: 0.85; }
.ppt-input-area .ppt-stop-square {
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 2px;
}

/* ── Loading spinner ── */
.ppt-outline-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 60px;
  color: #999;
  font-size: 13px;
}
.ppt-outline-loading .ppt-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e0e0e0;
  border-top-color: var(--color-primary, #0094F4);
  border-radius: 50%;
  animation: ppt-spin 0.8s linear infinite;
}
@keyframes ppt-spin { to { transform: rotate(360deg); } }

/* Loading progress bar */
.ppt-loading-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary, #0094F4), #00d4aa);
  border-radius: 2px;
  transition: width 0.5s ease;
  z-index: 10;
}
.ppt-loading-status {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
}

/* Canvas loading overlay */
.ppt-canvas-loading {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 50%, #f0f4f8 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 5;
}
.ppt-loading-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 80px;
  justify-content: center;
  animation: ppt-loading-fade 1.5s ease-in-out infinite;
}
.ppt-loading-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  animation: ppt-loading-bounce 2s ease-in-out infinite;
}
.ppt-loading-icon svg {
  width: 48px;
  height: 48px;
}
.ppt-loading-label {
  font-size: 13px;
  color: #888;
  font-weight: 500;
}
.ppt-loading-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}
.ppt-loading-status {
  font-size: 13px;
  color: #999;
  transition: opacity 0.3s;
}
.ppt-loading-mood {
  font-size: 12px;
  color: #aab;
  font-style: italic;
  margin-top: 4px;
  min-height: 18px;
  transition: opacity 0.5s ease;
  letter-spacing: 0.3px;
}
.ppt-loading-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary, #0094F4), #00C9C3);
  border-radius: 2px;
  transition: width 0.8s ease;
}
@keyframes ppt-loading-fade {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
@keyframes ppt-loading-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.1); }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .ppt-card {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
  .ppt-toolbar-center { display: none; }
  .ppt-slide-sidebar { width: 100px; min-width: 80px; }
  .ppt-editor { flex-direction: row; }
}

/* Thumbnail list */
.ppt-thumbnail-list {
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}


/* Outline slide node */
/* ── Outline Tree (Mubu/Workflowy style) ── */
.outline-slide {
  margin-bottom: 2px;
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: hidden;
}

.outline-slide-header {
  display: flex;
  align-items: center;
  padding: 5px 8px;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
  border-radius: 4px;
  gap: 4px;
}
.outline-slide-header:hover {
  background: rgba(0, 0, 0, 0.04);
}
.outline-slide-header.active {
  background: rgba(0, 148, 244, 0.06);
}
.outline-slide-header.dragging {
  opacity: 0.5;
}

/* Toggle arrow */
.outline-toggle {
  flex-shrink: 0;
  color: #bbb;
  transition: transform 0.2s ease;
}
.outline-toggle.collapsed {
  transform: rotate(-90deg);
}

.outline-slide-icon {
  margin-right: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.outline-slide-title {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outline-slide-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}
.outline-slide-header:hover .outline-slide-actions {
  opacity: 1;
}

.outline-action-btn {
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  color: #bbb;
  cursor: pointer;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.12s;
}
.outline-action-btn:hover {
  background: rgba(0,0,0,0.06);
  color: #666;
}

/* Outline elements (indented children) */
.outline-slide-body {
  padding: 0 0 0 20px;
  display: none;
  border-left: 1.5px solid #e8e8e8;
  margin-left: 13px;
}
.outline-slide:not(.collapsed) .outline-slide-body {
  display: block;
}

.outline-element {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  margin: 1px 0;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
  gap: 6px;
}
.outline-element:hover {
  background: rgba(0, 0, 0, 0.03);
}
.outline-element.selected {
  background: rgba(0, 148, 244, 0.08);
  border-left: 2px solid var(--color-primary, #0094F4);
  padding-left: 6px;
}
.outline-element.dragging {
  opacity: 0.4;
}
.outline-element.drag-over {
  border-top: 2px solid var(--color-primary, #0094F4);
}

.outline-element-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.outline-element-content {
  flex: 1;
  min-width: 0;
}

.outline-element-type {
  font-size: 11px;
  color: #888;
  display: flex;
  align-items: center;
  gap: 4px;
}

.outline-source {
  font-size: 9px;
  padding: 0 4px;
  border-radius: 3px;
  line-height: 16px;
}
.outline-source-user {
  color: #999;
  background: rgba(0,0,0,0.04);
}
.outline-source-ai {
  color: #10b981;
  background: rgba(16,185,129,0.08);
}

.outline-element-text {
  font-size: 12px;
  color: #555;
  word-break: break-word;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.outline-element-text[contenteditable="true"] {
  outline: 1px solid var(--color-primary, #0094F4);
  padding: 2px 4px;
  border-radius: 3px;
  background: #fff;
  white-space: pre-wrap;
}

.outline-element-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}
.outline-element:hover .outline-element-actions {
  opacity: 1;
}

/* Drag drop indicators */
.outline-slide.drag-over-top {
  box-shadow: 0 -2px 0 0 var(--color-primary, #0094F4);
}
.outline-slide.drag-over-bottom {
  box-shadow: 0 2px 0 0 var(--color-primary, #0094F4);
}

/* ── Properties Panel (Right Side) ── */
.ppt-properties-panel {
  width: 0;
  min-width: 0;
  max-width: 600px;
  flex-shrink: 0;
  background: #fafbfc;
  border-left: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.3s ease, min-width 0.3s ease;
  position: relative;
}
.ppt-properties-panel.open {
  width: 280px;
  min-width: 220px;
}

/* Properties panel resizer */
.ppt-properties-resizer {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: ew-resize;
  background: transparent;
  z-index: 10;
  transition: background 0.15s;
}
.ppt-properties-resizer:hover,
.ppt-properties-resizer.active {
  background: var(--color-primary, #0094F4);
}

.ppt-properties-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #e8e8e8;
  font-size: 13px;
  font-weight: 600;
  color: #333;
}

.ppt-properties-close {
  background: none;
  border: none;
  font-size: 18px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  line-height: 1;
  border-radius: 3px;
}
.ppt-properties-close:hover {
  background: rgba(0,0,0,0.05);
  color: #333;
}

.ppt-properties-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.ppt-properties-body::-webkit-scrollbar { width: 4px; }
.ppt-properties-body::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.ppt-properties-empty {
  text-align: center;
  color: #999;
  font-size: 12px;
  padding: 40px 20px;
}

/* ── Collapsible property sections ── */
.ppt-prop-section {
  border-bottom: 1px solid #e8e8e8;
}
.ppt-prop-section:last-child { border-bottom: none; }
.ppt-prop-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  cursor: pointer;
  user-select: none;
}
.ppt-prop-section-header:hover { opacity: 0.8; }
.ppt-prop-section-arrow {
  width: 16px; height: 16px;
  flex-shrink: 0;
  transition: transform 0.2s;
  color: #aaa;
}
.ppt-prop-section.collapsed .ppt-prop-section-arrow {
  transform: rotate(-90deg);
}
.ppt-prop-section-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: #999;
}
.ppt-prop-section-title {
  font-size: 11px;
  font-weight: 600;
  color: #555;
  flex: 1;
  letter-spacing: 0.3px;
}
.ppt-prop-section-badge {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 500;
}
.ppt-prop-section-badge.source-user { background: #f0f0f0; color: #888; }
.ppt-prop-section-badge.source-ai { background: rgba(0,148,244,0.1); color: var(--color-primary, #0094F4); }
.ppt-prop-section-badge.source-placeholder { background: #fff7e6; color: #d48806; }
.ppt-prop-section-body {
  padding: 0 0 10px;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  max-height: 2000px;
  opacity: 1;
}
.ppt-prop-section.collapsed .ppt-prop-section-body {
  max-height: 0;
  opacity: 0;
  padding: 0;
}

/* Property groups - Figma style */
.ppt-prop-group {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}
.ppt-prop-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.ppt-prop-label {
  font-size: 10px;
  font-weight: 600;
  color: #888;
  margin-bottom: 6px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ppt-prop-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.ppt-prop-field {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.ppt-prop-field label {
  font-size: 9px;
  color: #aaa;
  display: block;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 500;
}

.ppt-prop-input {
  width: 100%;
  padding: 5px 6px;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  font-size: 11px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  background: #fff;
}
.ppt-prop-input:hover {
  border-color: #ccc;
}
.ppt-prop-input:focus {
  border-color: var(--color-primary, #0094F4);
  background: #fff;
}

.ppt-prop-select {
  width: 100%;
  padding: 5px 6px;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  font-size: 11px;
  font-family: inherit;
  outline: none;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s;
}
.ppt-prop-select:hover {
  border-color: #ccc;
}
.ppt-prop-select:focus {
  border-color: var(--color-primary, #0094F4);
}

.ppt-prop-btn {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: #fff;
  font-size: 11px;
  color: #555;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.ppt-prop-btn:hover {
  border-color: #bbb;
  background: #f8f8f8;
}
.ppt-prop-btn:active {
  background: #f0f0f0;
}
.ppt-prop-btn.active {
  border-color: var(--color-primary, #0094F4);
  color: var(--color-primary, #0094F4);
  background: rgba(0, 148, 244, 0.08);
}

/* ── Generating indicator animation ── */
.ppt-gen-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  margin-top: 8px;
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 50%, #f0f0ff 100%);
  border-radius: 10px;
  border: 1px solid rgba(0, 148, 244, 0.12);
  animation: ppt-gen-fade-in 0.3s ease;
}
@keyframes ppt-gen-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.ppt-gen-icon {
  flex-shrink: 0;
  color: var(--color-primary, #0094F4);
  animation: ppt-gen-pulse 2s ease-in-out infinite;
}
@keyframes ppt-gen-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}
.ppt-gen-text {
  font-size: 13px;
  font-weight: 500;
  color: #555;
  letter-spacing: 0.3px;
}
.ppt-gen-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: 2px;
}
.ppt-gen-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-primary, #0094F4);
  animation: ppt-gen-bounce 1.4s ease-in-out infinite;
}
.ppt-gen-dots span:nth-child(2) { animation-delay: 0.16s; }
.ppt-gen-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes ppt-gen-bounce {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.7); }
  40% { opacity: 1; transform: scale(1); }
}

/* Format toolbar (B/I/U + align) */
.ppt-format-bar {
  display: flex;
  gap: 2px;
  background: #f5f6f8;
  border-radius: 6px;
  padding: 3px;
}
.ppt-format-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 26px;
  border: none;
  border-radius: 4px;
  background: none;
  color: #666;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.12s;
}
.ppt-format-btn:hover { background: #e8e8e8; color: #333; }
.ppt-format-btn.active {
  background: var(--color-primary, #0094F4);
  color: #fff;
}
.ppt-format-sep {
  width: 1px;
  background: #ddd;
  margin: 2px 3px;
}

/* Table column width controls */
.ppt-colwidth-bar {
  display: flex;
  gap: 3px;
  margin-top: 6px;
  flex-wrap: wrap;
  max-height: 80px;
  overflow-y: auto;
}
.ppt-colwidth-item {
  flex: 1;
  min-width: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.ppt-colwidth-item label {
  font-size: 9px;
  color: #aaa;
}
.ppt-colwidth-item input {
  width: 100%;
  text-align: center;
  font-size: 11px;
  padding: 3px 2px;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  background: #fff;
}
.ppt-colwidth-item input:focus {
  border-color: var(--color-primary, #0094F4);
  outline: none;
}

.ppt-prop-radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ppt-prop-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #555;
  cursor: pointer;
}
.ppt-prop-radio input[type="radio"] {
  cursor: pointer;
}

/* Canvas element resize handles */
.canvas-el-resize-handle {
  position: absolute;
  background: var(--color-primary, #0094F4);
  border: 1px solid #fff;
  box-shadow: 0 0 3px rgba(0,0,0,0.3);
  display: none;
  z-index: 20;
}
.canvas-el.selected .canvas-el-resize-handle {
  display: block;
}

.resize-handle-nw, .resize-handle-ne, .resize-handle-sw, .resize-handle-se {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.resize-handle-n, .resize-handle-s {
  width: 24px;
  height: 8px;
  border-radius: 4px;
  left: 50%;
  transform: translateX(-50%);
}
.resize-handle-e, .resize-handle-w {
  width: 8px;
  height: 24px;
  border-radius: 4px;
  top: 50%;
  transform: translateY(-50%);
}

.resize-handle-nw { top: -5px; left: -5px; cursor: nw-resize; }
.resize-handle-n { top: -4px; cursor: n-resize; }
.resize-handle-ne { top: -5px; right: -5px; cursor: ne-resize; }
.resize-handle-e { right: -4px; cursor: e-resize; }
.resize-handle-se { bottom: -5px; right: -5px; cursor: se-resize; }
.resize-handle-s { bottom: -4px; cursor: s-resize; }
.resize-handle-sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.resize-handle-w { left: -4px; cursor: w-resize; }

/* ── Template Manager Overlay ── */
.template-manager-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-manager-card {
  width: 600px;
  max-width: 90vw;
  max-height: 80vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.template-manager-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e8e8e8;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  background: #fafbfc;
}

.template-manager-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  line-height: 1;
  border-radius: 4px;
}
.template-manager-close:hover {
  background: rgba(0,0,0,0.05);
  color: #333;
}

.template-manager-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.template-manager-body::-webkit-scrollbar { width: 6px; }
.template-manager-body::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

.template-save-btn {
  width: 100%;
  padding: 12px 20px;
  border: 2px dashed var(--color-primary, #0094F4);
  border-radius: 8px;
  background: rgba(0, 148, 244, 0.05);
  color: var(--color-primary, #0094F4);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 20px;
}
.template-save-btn:hover {
  background: rgba(0, 148, 244, 0.1);
  border-color: var(--color-primary, #0094F4);
}

.template-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.template-empty {
  text-align: center;
  color: #999;
  font-size: 14px;
  padding: 40px 20px;
}

.template-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  background: #fafbfc;
  transition: all 0.2s;
}
.template-item:hover {
  border-color: var(--color-primary, #0094F4);
  background: rgba(0, 148, 244, 0.03);
}

.template-info {
  flex: 1;
  min-width: 0;
}

.template-name {
  font-size: 15px;
  font-weight: 500;
  color: #333;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-date {
  font-size: 12px;
  color: #999;
}

.template-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.template-load-btn,
.template-delete-btn {
  padding: 6px 16px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.template-load-btn {
  color: var(--color-primary, #0094F4);
  border-color: var(--color-primary, #0094F4);
}
.template-load-btn:hover {
  background: var(--color-primary, #0094F4);
  color: #fff;
}

.template-delete-btn {
  color: #ff4444;
  border-color: #ff4444;
}
.template-delete-btn:hover {
  background: #ff4444;
  color: #fff;
}

/* ── Template Manager Tabs ── */
.template-manager-tabs {
  display: flex;
  border-bottom: 1px solid #e8e8e8;
  padding: 0 20px;
  background: #fafbfc;
}
.tpl-tab {
  padding: 10px 20px;
  border: none;
  background: none;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tpl-tab.active {
  color: var(--color-primary, #0094F4);
  border-bottom-color: var(--color-primary, #0094F4);
  font-weight: 600;
}
.tpl-tab:hover:not(.active) {
  color: #333;
}
.template-limit-hint {
  font-size: 12px;
  color: #999;
  margin-bottom: 12px;
}

/* ── Template Select Dialog ── */
.tpl-select-option {
  display: block;
  padding: 10px 12px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  transition: all 0.15s;
}
.tpl-select-option:hover {
  border-color: var(--color-primary, #0094F4);
  background: rgba(0, 148, 244, 0.03);
}
.tpl-select-option input[type="radio"] {
  margin-right: 8px;
}

/* Image placeholder */
.image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #999;
  font-size: 13px;
  background: rgba(0,0,0,0.03);
}

/* ── Property Panel: Source Info Badge ── */
.ppt-prop-source-info {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.ppt-prop-source-info.source-user {
  background: #f0f0f0;
  color: #666;
}
.ppt-prop-source-info.source-ai {
  background: rgba(0, 212, 170, 0.1);
  color: #00b894;
}
.ppt-prop-source-info.source-placeholder {
  background: rgba(0, 212, 170, 0.08);
  color: #00b894;
  border: 1px dashed #00d4aa;
}

/* ── Property Panel: Text Textarea ── */
.ppt-prop-textarea {
  resize: vertical;
  min-height: 60px;
  max-height: 200px;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ── Property Panel: Chart JSON Editor (kept for fallback) ── */
.ppt-chart-json-editor {
  font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
  font-size: 11px;
  line-height: 1.5;
  resize: vertical;
  min-height: 120px;
  max-height: 300px;
  tab-size: 2;
  white-space: pre;
}

.ppt-chart-json-view {
  margin-top: 8px;
  padding: 8px;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
}

/* ── Property Panel: Chart Preview ── */
.ppt-chart-preview {
  width: 100%;
  height: 200px;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

/* ── Property Panel: Chart Data Table ── */
.ppt-chart-data-view {
  margin-top: 6px;
  max-height: 200px;
  overflow: auto;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
}
.ppt-chart-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.ppt-chart-data-table th,
.ppt-chart-data-table td {
  padding: 4px 8px;
  border: 1px solid #eee;
  text-align: left;
}
.ppt-chart-data-table th {
  background: #f5f6f8;
  font-weight: 600;
  font-size: 10px;
  color: #666;
}

/* ── Property Panel: Primary action button ── */
.ppt-prop-btn-primary {
  background: var(--color-primary, #0094F4) !important;
  color: #fff !important;
  border-color: var(--color-primary, #0094F4) !important;
}
.ppt-prop-btn-primary:hover {
  opacity: 0.85;
}

/* Element loading overlay (async chart/table fill) */
.ppt-el-loading {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: #666;
  z-index: 10;
  border-radius: 4px;
}
.ppt-el-loading svg { color: var(--color-primary, #0094F4); }

/* ── Property Panel: Chart Type Switch Buttons ── */
.ppt-chart-type-btn {
  font-size: 12px !important;
  transition: all 0.15s;
}
.ppt-chart-type-btn.active {
  background: var(--color-primary, #0094F4) !important;
  color: #fff !important;
  border-color: var(--color-primary, #0094F4) !important;
}

/* ── Property Panel: Table Grid Editor ── */
.ppt-table-editor {
  max-height: 240px;
  overflow: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
}
.ppt-table-grid {
  display: grid;
  gap: 0;
  min-width: 100%;
}
.ppt-table-cell {
  width: 100%;
  padding: 5px 6px;
  border: none;
  border-right: 1px solid #eee;
  border-bottom: 1px solid #eee;
  font-size: 11px;
  font-family: inherit;
  outline: none;
  background: #fff;
  box-sizing: border-box;
}
.ppt-table-cell:focus {
  background: rgba(0, 148, 244, 0.06);
  outline: 1px solid var(--color-primary, #0094F4);
  outline-offset: -1px;
  z-index: 1;
  position: relative;
}

/* ── Property Panel: Image Preview ── */
.ppt-image-preview {
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  overflow: hidden;
  background: #fafafa;
}
.ppt-image-preview img {
  display: block;
  width: 100%;
  max-height: 150px;
  object-fit: contain;
}

/* ── Project List View ── */
.ppt-project-list-view {
  width: 640px;
  max-width: 90vw;
  max-height: 80vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ppt-project-list-view.hidden { display: none; }

.ppt-project-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid #e8e8e8;
  background: #fafbfc;
}
.ppt-project-list-title {
  font-size: 17px;
  font-weight: 600;
  color: #333;
}
.ppt-project-list-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}
.ppt-project-list-body::-webkit-scrollbar { width: 4px; }
.ppt-project-list-body::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.ppt-project-loading {
  text-align: center;
  color: #999;
  padding: 40px 0;
  font-size: 14px;
}

/* New project button */
.ppt-project-new-btn {
  width: 100%;
  padding: 14px 20px;
  border: 2px dashed var(--color-primary, #0094F4);
  border-radius: 10px;
  background: rgba(0, 148, 244, 0.04);
  color: var(--color-primary, #0094F4);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.ppt-project-new-btn:hover {
  background: rgba(0, 148, 244, 0.1);
}
.ppt-project-new-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #ccc;
  color: #999;
}

/* Project card */
.ppt-project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  margin-bottom: 10px;
  background: #fafbfc;
  transition: all 0.15s;
  cursor: pointer;
}
.ppt-project-item:hover {
  border-color: var(--color-primary, #0094F4);
  background: rgba(0, 148, 244, 0.03);
}

.ppt-project-info {
  flex: 1;
  min-width: 0;
}
.ppt-project-name {
  font-size: 15px;
  font-weight: 500;
  color: #333;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ppt-project-meta {
  font-size: 12px;
  color: #999;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ppt-project-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}
.ppt-project-badge.exportable {
  background: #e8f5e9;
  color: #2e7d32;
}
.ppt-project-badge.expired {
  background: #f5f5f5;
  color: #999;
}

.ppt-project-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 12px;
}
.ppt-project-actions button {
  padding: 5px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.ppt-project-actions .ppt-proj-open-btn {
  color: var(--color-primary, #0094F4);
  border-color: var(--color-primary, #0094F4);
}
.ppt-project-actions .ppt-proj-open-btn:hover {
  background: var(--color-primary, #0094F4);
  color: #fff;
}
.ppt-project-actions .ppt-proj-del-btn {
  color: #ff4444;
  border-color: #ffcdd2;
}
.ppt-project-actions .ppt-proj-del-btn:hover {
  background: #ff4444;
  color: #fff;
  border-color: #ff4444;
}

/* Batch delete toolbar */
.ppt-project-toolbar {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.ppt-project-toolbar .ppt-project-new-btn {
  flex: 1;
}
.ppt-proj-batch-del-btn {
  padding: 10px 16px;
  border: 1px solid #ffcdd2;
  border-radius: 10px;
  background: #fff;
  color: #ff4444;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.ppt-proj-batch-del-btn:hover {
  background: #ff4444;
  color: #fff;
  border-color: #ff4444;
}
.ppt-batch-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 13px;
}
.ppt-batch-check-all {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  flex: 1;
}
.ppt-project-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  margin-right: 8px;
  flex-shrink: 0;
}
.ppt-project-item {
  display: flex;
  align-items: center;
}

.ppt-project-empty {
  text-align: center;
  color: #bbb;
  font-size: 14px;
  padding: 40px 0;
}

.ppt-project-limit-hint {
  font-size: 12px;
  color: #999;
  margin-bottom: 12px;
}

/* Save indicator in toolbar */
.ppt-save-indicator {
  font-size: 11px;
  color: #999;
  margin-left: 4px;
  transition: opacity 0.3s;
}
.ppt-save-indicator.saving { color: #f0ad4e; }
.ppt-save-indicator.saved { color: #5cb85c; }

/* ── New Project Dialog ── */
.ppt-new-project-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ppt-new-project-card {
  width: 420px;
  max-width: 90vw;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}
.ppt-new-project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e8e8e8;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  background: #fafbfc;
}
.ppt-new-project-body {
  padding: 20px;
}
.ppt-new-project-body label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #555;
  margin-bottom: 6px;
}
.ppt-new-project-body input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  margin-bottom: 16px;
  box-sizing: border-box;
}
.ppt-new-project-body input[type="text"]:focus {
  border-color: var(--color-primary, #0094F4);
}
.ppt-new-project-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid #e8e8e8;
}
.ppt-new-project-footer button {
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.ppt-new-project-footer .ppt-np-cancel {
  border: 1px solid #ddd;
  background: #fff;
  color: #666;
}
.ppt-new-project-footer .ppt-np-confirm {
  border: none;
  background: var(--color-primary, #0094F4);
  color: #fff;
}
.ppt-new-project-footer .ppt-np-confirm:hover { opacity: 0.85; }

/* Upload template button in create dialog */
.ppt-np-upload-tpl {
  display: inline-block;
  margin-top: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--color-primary, #0094F4);
  border: 1px dashed var(--color-primary, #0094F4);
  border-radius: 6px;
  background: rgba(0, 148, 244, 0.04);
  cursor: pointer;
  transition: all 0.15s;
}
.ppt-np-upload-tpl:hover {
  background: rgba(0, 148, 244, 0.1);
}
.ppt-np-upload-tpl:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Upload PPT button (lock icon) ── */
.ppt-upload-ppt-btn {
  position: relative;
}
.ppt-upload-ppt-btn .ppt-lock-icon {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ff9800;
  border-radius: 50%;
  padding: 2px;
  color: #fff;
  width: 12px;
  height: 12px;
}

/* ── Upgrade Overlay ── */
.ppt-upgrade-overlay {
  position: fixed;
  inset: 0;
  z-index: 10002;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.ppt-upgrade-card {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px 24px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.ppt-upgrade-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
}
.ppt-upgrade-close:hover { color: #333; }
.ppt-upgrade-icon { margin-bottom: 12px; }
.ppt-upgrade-title {
  font-size: 18px;
  font-weight: 700;
  color: #333;
  margin-bottom: 8px;
}
.ppt-upgrade-desc {
  font-size: 13px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 16px;
}
.ppt-upgrade-features {
  text-align: left;
  margin: 0 auto 16px;
  max-width: 300px;
}
.ppt-upgrade-feature {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #444;
  padding: 4px 0;
}
.ppt-upgrade-pricing {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}
.ppt-upgrade-price {
  font-size: 16px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ppt-upgrade-hint {
  font-size: 12px;
  color: #999;
}
.ppt-upgrade-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: var(--gradient-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}
.ppt-upgrade-btn:hover { opacity: 0.9; }

