@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

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

:root {
  --bg: #f8f7f5;
  --surface: #ffffff;
  --surface2: #f3f2ef;
  --border: rgba(0,0,0,0.08);
  --border-md: rgba(0,0,0,0.14);
  --text: #1a1a1a;
  --text-2: #555;
  --text-3: #999;
  --accent: #2d2d2d;
  --accent-hover: #111;
  --danger: #c0392b;
  --success: #27ae60;
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 260px;
  --panel-w: 480px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  display: flex;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 99px; }

/* ── Layout ── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#topbar {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
}

#workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
}

#canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  padding: 32px 24px;
  gap: 20px;
}

#right-panel {
  width: var(--panel-w);
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}

/* ── Sidebar ── */
.sidebar-logo {
  padding: 18px 16px 14px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.3px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo span { font-weight: 300; color: var(--text-2); }

.sidebar-section {
  padding: 10px 16px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.sidebar-scroll { flex: 1; overflow-y: auto; }

.brand-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.1s;
}
.brand-item:hover { background: var(--surface2); }
.brand-item.active { background: var(--surface2); font-weight: 500; }

.brand-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: white;
  flex-shrink: 0;
}

.brand-info { flex: 1; min-width: 0; }
.brand-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-handle { font-size: 11px; color: var(--text-3); }

.project-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px 7px 28px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  transition: background 0.1s;
}
.project-item:hover { background: var(--surface2); color: var(--text); }
.project-item.active { background: var(--surface2); color: var(--text); font-weight: 500; }

.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.1s;
}
.sidebar-btn:hover { color: var(--text); }
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 8px 0;
}

/* ── Topbar ── */
.topbar-title {
  font-weight: 500;
  font-size: 14px;
  flex: 1;
}
.topbar-subtitle { font-size: 12px; color: var(--text-3); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-md);
  background: var(--surface);
  color: var(--text);
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}
.btn:hover { background: var(--surface2); border-color: var(--border-md); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn-danger:hover { background: #fdf0ef; border-color: #e8b5b2; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface2); border-color: var(--border); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px; width: 32px; height: 32px; justify-content: center; }

/* ── Canvas ── */
.canvas-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-3);
  text-align: center;
}
.canvas-empty-icon { font-size: 48px; opacity: 0.3; }

.slide-strip {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 8px;
  width: 100%;
}

.slide-thumb-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.slide-thumb {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  overflow: hidden;
  background: #eee;
  transition: border-color 0.15s;
  position: relative;
}
.slide-thumb:hover { border-color: var(--border-md); }
.slide-thumb.active { border-color: var(--accent); }

.slide-thumb iframe {
  width: 1080px;
  height: 1080px;
  transform: scale(0.111);
  transform-origin: top left;
  border: none;
  pointer-events: none;
}

.slide-thumb-label {
  font-size: 11px;
  color: var(--text-3);
  text-align: center;
}

.slide-thumb-num {
  position: absolute;
  top: 4px; left: 4px;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
}

.add-slide-btn {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  border: 2px dashed var(--border-md);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  color: var(--text-3);
  font-size: 12px;
  transition: all 0.15s;
}
.add-slide-btn:hover { border-color: var(--accent); color: var(--text); background: var(--surface2); }

/* ── Preview principal ── */
#preview-container {
  width: 100%;
  max-width: 540px;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #eee;
  position: relative;
  flex-shrink: 0;
}
#preview-container iframe {
  width: 1080px;
  height: 1080px;
  transform: scale(0.5);
  transform-origin: top left;
  border: none;
}

/* ── Right Panel ── */
.panel-section {
  border-bottom: 1px solid var(--border);
  padding: 16px;
}
.panel-section:last-child { border-bottom: none; }

/* Collapsible accordion section (uses <details>) */
details.panel-section { padding: 0; }
details.panel-section > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: background 0.15s;
}
details.panel-section > summary::-webkit-details-marker { display: none; }
details.panel-section > summary::after {
  content: '▾';
  font-size: 11px;
  color: var(--text-3);
  transition: transform 0.15s;
}
details.panel-section[open] > summary::after { transform: rotate(180deg); }
details.panel-section > summary:hover { background: var(--surface2); }
details.panel-section > .panel-body { padding: 4px 16px 16px; }

.panel-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }

input[type=text], input[type=url], textarea, select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 72px; line-height: 1.5; }

/* Color picker row */
.color-row { display: flex; align-items: center; gap: 8px; }
.color-swatch-input { width: 32px; height: 32px; padding: 2px; border-radius: var(--radius-sm); border: 1px solid var(--border-md); cursor: pointer; background: none; }
.color-presets { display: flex; gap: 4px; flex-wrap: wrap; }
.color-preset {
  width: 20px; height: 20px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: border-color 0.1s;
}
.color-preset:hover { border-color: var(--text-3); }
.color-preset.active { border-color: var(--accent); }

/* Font picker */
.font-grid { display: flex; gap: 6px; flex-wrap: wrap; }
.font-pill {
  padding: 5px 10px; border-radius: 20px; font-size: 12px;
  border: 1px solid var(--border-md); cursor: pointer;
  background: var(--surface); color: var(--text-2);
  transition: all 0.15s;
}
.font-pill:hover { border-color: var(--accent); color: var(--text); }
.font-pill.active { background: var(--accent); color: white; border-color: var(--accent); }

/* Slide type picker */
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.type-card {
  padding: 10px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-md); cursor: pointer;
  text-align: center; font-size: 12px; color: var(--text-2);
  transition: all 0.15s;
}
.type-card:hover { border-color: var(--accent); color: var(--text); }
.type-card.active { border-color: var(--accent); background: var(--accent); color: white; }
.type-card-icon { font-size: 20px; margin-bottom: 4px; }

/* Align picker */
.align-row { display: flex; gap: 4px; }
.align-btn {
  flex: 1; padding: 6px; border: 1px solid var(--border-md);
  border-radius: var(--radius-sm); cursor: pointer;
  background: var(--surface); color: var(--text-2);
  font-size: 13px; text-align: center; transition: all 0.15s;
}
.align-btn:hover { border-color: var(--accent); }
.align-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

/* Logo upload */
.logo-upload {
  border: 2px dashed var(--border-md);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
}
.logo-upload.has-logo {
  border: 1px solid var(--border);
  border-style: solid;
  padding: 12px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-2);
}
.logo-upload:hover { border-color: var(--accent); }
.logo-upload.has-logo:hover { background: var(--bg-3); }
.logo-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.logo-preview { width: 64px; height: 64px; border-radius: 12px; object-fit: contain; display: block; margin: 0; background: #fff; padding: 4px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* Color palette grid */
.color-palette-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.color-palette-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 3px;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.12s;
  font-size: 11px;
  position: relative;
  background: var(--bg-2);
  overflow: hidden;
}
.color-palette-item:hover { border-color: var(--accent); background: var(--bg-3); }
.color-palette-item.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(var(--accent-rgb, 60,60,60), 0.15); }
.color-palette-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.12);
  flex-shrink: 0;
}
.color-palette-label {
  flex: 1;
  min-width: 0;
  color: var(--text-2);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.color-palette-edit,
.color-palette-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  color: var(--text-3);
  line-height: 1;
  flex-shrink: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.color-palette-item:hover .color-palette-edit,
.color-palette-item:hover .color-palette-del {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.color-palette-edit:hover { color: var(--accent); }
.color-palette-del:hover { color: #dc2626; }
.color-palette-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px dashed var(--border-md);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-3);
  transition: all 0.12s;
}
.color-palette-add:hover { border-color: var(--accent); color: var(--accent); background: var(--bg-2); }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tab {
  padding: 10px 16px; font-size: 13px; cursor: pointer;
  color: var(--text-3); border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 500; }

/* ── Save indicator ── */
.save-indicator {
  font-size: 11px;
  color: var(--text-3);
  padding: 4px 10px;
  border-radius: 99px;
  background: transparent;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  white-space: nowrap;
}
.save-indicator.saving {
  background: #fef9c3; color: #854d0e;
}
.save-indicator.saved {
  background: #dcfce7; color: #166534;
}
.save-indicator.error {
  background: #fee2e2; color: #991b1b; cursor: pointer;
}
.save-indicator.dirty {
  background: var(--surface2); color: var(--text-2);
}
.save-indicator:empty { display: none; }
.save-indicator .dot {
  width: 6px; height: 6px; border-radius: 50%; display: inline-block;
}
.save-indicator.saving .dot { background: #ca8a04; animation: pulse 1s ease-in-out infinite; }
.save-indicator.saved .dot { background: #16a34a; }
.save-indicator.error .dot { background: #dc2626; }
.save-indicator.dirty .dot { background: var(--text-3); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(3px);
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal, .modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  width: auto;
  min-width: 320px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  border: 1px solid var(--border-md);
  animation: modalIn 0.18s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ── Toast ── */
#toast-container {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999;
}
.toast {
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--accent); color: white;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideIn 0.2s ease;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* ── Slider ── */
input[type=range] {
  width: 100%; height: 4px;
  background: var(--border-md); border-radius: 2px;
  outline: none; border: none; padding: 0;
  cursor: pointer; accent-color: var(--accent);
}

/* ── Misc ── */
.divider { height: 1px; background: var(--border); margin: 8px 0; }
.row { display: flex; gap: 8px; align-items: center; }
.flex1 { flex: 1; }
.hidden { display: none !important; }

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Slide type badge ── */
.type-badge {
  display: inline-block;
  padding: 2px 7px; border-radius: 99px;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.5px; text-transform: uppercase;
}
.type-badge.cover { background: #fef3cd; color: #856404; }
.type-badge.content { background: #d1ecf1; color: #0c5460; }
.type-badge.list { background: #d4edda; color: #155724; }
.type-badge.quote { background: #f8d7da; color: #721c24; }
.type-badge.cta { background: #e2d9f3; color: #4a235a; }
.type-badge.stat { background: #ffe9cc; color: #8a4b00; }
.type-badge.beforeafter { background: #f9e2ff; color: #6b2387; }
.type-badge.hook { background: #ffe0b2; color: #8d3a00; }
.type-badge.testimonial { background: #e8f5e9; color: #1b5e20; }
.type-badge.steps { background: #e3f2fd; color: #0d47a1; }
.type-badge.checklist { background: #f1f8e9; color: #33691e; }
.type-badge.split { background: #ede7f6; color: #4527a0; }
.type-badge.image { background: #e1f5fe; color: #01579b; }
.type-badge.numberedlist { background: #fff3e0; color: #e65100; }
.type-badge.tipsgrid { background: #e0f7fa; color: #006064; }

/* ── Responsive preview scaling ── */
@media (max-width: 1200px) {
  #preview-container { max-width: 400px; }
  #preview-container iframe { transform: scale(0.37); }
}

/* ── Storage / S3 panel ── */
.storage-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.storage-item:last-child { border-bottom: none; }
.storage-badge {
  padding: 2px 8px; border-radius: 99px; font-size: 10px;
  font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase;
  background: var(--surface2); color: var(--text-2);
}
.storage-badge.r2 { background: #fff0e0; color: #b45309; }
.storage-badge.s3 { background: #e8f5e9; color: #2e7d32; }
.storage-badge.minio { background: #e8eaf6; color: #3949ab; }

/* ── Context menu (right-click en sidebar) ── */
.ctx-menu {
  position: fixed; z-index: 2000;
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 4px 0; min-width: 160px;
}
.ctx-item {
  padding: 8px 14px; font-size: 13px; cursor: pointer;
  color: var(--text);
}
.ctx-item:hover { background: var(--surface2); }
.ctx-item.danger { color: var(--danger); }

/* ── Inline rename input ── */
.rename-input {
  width: 100%; border: none; outline: none;
  font-size: 13px; font-family: var(--font-sans);
  background: var(--surface2);
  padding: 2px 4px; border-radius: 3px;
  color: var(--text);
}

/* ── Download modal ── */
.dl-option {
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  padding: 12px 14px; cursor: pointer; transition: all 0.15s;
  display: flex; gap: 12px; align-items: flex-start; flex: 1;
}
.dl-option:hover { border-color: var(--accent); background: var(--surface2); }
.dl-option.active { border-color: var(--accent); background: var(--surface2); }
.dl-option.disabled { opacity: 0.4; pointer-events: none; }
.dl-option-icon { font-size: 20px; flex-shrink: 0; }
.dl-option-title { font-size: 13px; font-weight: 500; }
.dl-option-desc { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ── Progress bar ── */
.progress-bar-container {
  width: 100%; height: 6px; background: var(--surface2);
  border-radius: 3px; overflow: hidden;
}
.progress-bar {
  height: 100%; background: var(--accent);
  border-radius: 3px; transition: width 0.2s ease;
}

/* ── Custom colors ── */
.custom-color {
  position: relative; cursor: pointer;
}
.custom-color-delete {
  position: absolute; top: -6px; right: -6px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--danger); color: white;
  font-size: 10px; line-height: 14px; text-align: center;
  display: none; cursor: pointer; z-index: 1;
}
.custom-color:hover .custom-color-delete { display: block; }

/* ── Drag & drop slides ── */
.slide-thumb-wrap.sortable-ghost {
  opacity: 0.3;
}
.slide-thumb-wrap.sortable-drag {
  opacity: 0.9; transform: scale(1.05);
}
.slide-thumb-wrap[draggable="true"] { cursor: grab; }
.slide-thumb-wrap[draggable="true"]:active { cursor: grabbing; }

/* ── Brand View (full canvas area) ── */
#canvas-area .brand-view-proj-item:hover {
  background: var(--surface2);
}

/* Responsive brand view: stack columns on narrow screens */
@media (max-width: 900px) {
  #canvas-area [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

/* ── Accordion sections (slide editor) ── */
.acc-section { border-top: 1px solid var(--border); }
.acc-section:first-of-type { border-top: 0; }
.acc-header {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: transparent; border: 0; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text-1);
  text-align: left;
}
.acc-header:hover { background: var(--surface2); }
.acc-chevron { transition: transform .15s ease; color: var(--text-3); }
.acc-section.is-open .acc-chevron { transform: rotate(180deg); }
.acc-body { display: none; padding: 8px 16px 16px; }
.acc-section.is-open .acc-body { display: block; }

/* Position grid 3x3 */
.pos-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  width: 96px; margin-top: 6px;
}
.pos-cell {
  aspect-ratio: 1 / 1; border: 1px solid var(--border); border-radius: 4px;
  background: var(--surface1); cursor: pointer; padding: 0;
}
.pos-cell:hover { background: var(--surface2); }
.pos-cell.is-active { background: var(--accent, #3a2a26); border-color: var(--accent, #3a2a26); }

/* Brand toggle row */
.brand-toggle-row { padding: 8px 0; }
.brand-toggle-row .ck {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; cursor: pointer; user-select: none;
}
.brand-toggle-row input[type="checkbox"] { cursor: pointer; }
.field .hint { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* ── Typography overrides (slide editor Step B) ── */
.typo-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--surface1);
}
.typo-card-title {
  font-size: 12px; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 1px;
  padding-bottom: 8px; margin-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}
.typo-card .field { margin-bottom: 8px; }
.typo-card .field:last-child { margin-bottom: 0; }
.typo-card label { font-size: 12px; color: var(--text-2); display: block; margin-bottom: 4px; }
.typo-card input[type="number"],
.typo-card input[type="text"],
.typo-card select {
  width: 100%; padding: 5px 8px; font-size: 12px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--surface); color: var(--text-1);
}
.typo-card input[type="range"] { width: 100%; }
.typo-card input[type="color"] {
  width: 32px; height: 28px; padding: 0; border: 1px solid var(--border);
  border-radius: 4px; background: transparent; cursor: pointer;
}
.row-inline { display: flex; align-items: center; gap: 6px; }
.btn-mini {
  padding: 2px 8px; font-size: 12px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--surface); color: var(--text-2); cursor: pointer;
}
.btn-mini:hover { background: var(--surface2); color: var(--text-1); }

/* Segmented button group */
.seg-group { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.seg-btn {
  padding: 4px 10px; font-size: 12px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--surface); color: var(--text-2); cursor: pointer;
}
.seg-btn:hover { background: var(--surface2); }
.seg-btn.is-active {
  background: var(--accent, #3a2a26); color: white;
  border-color: var(--accent, #3a2a26);
}

/* ── Background + Decoration overrides (Step C) ── */
.bg-card, .deco-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--surface1);
}
.bg-panel { padding-top: 4px; border-top: 1px dashed var(--border); margin-top: 8px; }

/* ── E3: Change-type modal grid ── */
.slide-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
}
.slide-type-option {
  position: relative;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  transition: all .15s ease;
}
.slide-type-option:hover {
  border-color: var(--accent, #3a2a26);
  background: var(--surface1);
  transform: translateY(-1px);
}
.slide-type-option.is-current {
  border-color: var(--accent, #3a2a26);
  background: var(--surface1);
  cursor: default;
}
.slide-type-option.is-current:hover { transform: none; }
.slide-type-name {
  font-weight: 600; font-size: 13px; color: var(--text-1);
  margin-bottom: 4px;
}
.slide-type-desc {
  font-size: 11px; color: var(--text-2); line-height: 1.4;
}
.slide-type-current {
  position: absolute; top: 6px; right: 8px;
  font-size: 10px; padding: 2px 6px; border-radius: 3px;
  background: var(--accent, #3a2a26); color: white;
}

/* ── E4: Mosaic modal ── */
.mosaic-modal {
  max-width: 96vw; width: 96vw;
  max-height: 92vh;
  display: flex; flex-direction: column;
}
.mosaic-body {
  overflow-y: auto;
  padding: 16px;
  background: var(--surface);
}
.mosaic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.mosaic-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.mosaic-cell {
  cursor: pointer;
  transition: transform .15s ease;
  display: flex; flex-direction: column;
  gap: 6px;
}
.mosaic-cell:hover { transform: scale(1.02); }
.mosaic-frame {
  width: 100%; aspect-ratio: 1 / 1;
  border-radius: 6px; overflow: hidden;
  border: 2px solid var(--border);
  background: white;
  position: relative;
}
.mosaic-cell:hover .mosaic-frame { border-color: var(--accent, #3a2a26); }
.mosaic-frame iframe {
  position: absolute; top: 0; left: 0;
  width: 1080px; height: 1080px;
  transform-origin: top left;
  border: none;
}
.mosaic-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-2);
}
.mosaic-num {
  font-weight: 700; font-size: 13px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface1); color: var(--text-1);
  display: inline-flex; align-items: center; justify-content: center;
}
