/* ══════════════════════════════════════════════
   BLOCKS.CSS — Styles for editor UI + content blocks
   ══════════════════════════════════════════════ */

/* ── SLIDE MANAGER PANEL ── */
.slide-manager-panel {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: 240px; z-index: 190;
  background: #f5f5f5;
  border-right: 1px solid #e0e0e0;
  display: none; flex-direction: column;
  overflow: hidden;
  box-shadow: 2px 0 12px rgba(0,0,0,0.06);
}
.slide-manager-panel.open { display: flex; }

/*
 * Panel push is handled dynamically by the panel resize system in deck-engine.js.
 * It sets inline styles on slides, wrapper padding, nav elements.
 * No static CSS rules needed — JS manages all dimensions.
 */

/* ── Panel resize handles (draggable separators) ── */
.panel-resize-handle {
  position: fixed; top: 0; bottom: 0;
  width: 6px; cursor: col-resize; z-index: 196;
  background: transparent;
  transition: background 0.15s;
}
.panel-resize-handle:hover,
.panel-resize-handle.dragging {
  background: var(--teal);
  opacity: 0.4;
}
.panel-resize-handle.left {
  /* Positioned dynamically by JS at the right edge of slide manager */
}
.panel-resize-handle.right {
  /* Positioned dynamically by JS at the left edge of chat panel */
}

/* Brand row at top of slide panel */
.sm-brand {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 12px 10px;
}
.sm-brand-link {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: rgba(255,255,255,0.7);
  font-family: 'Sora', sans-serif; font-size: 14px; font-weight: 600;
  letter-spacing: -0.01em; transition: color 0.15s;
}
.sm-brand-link:hover { color: var(--teal); }
.sm-panel-close {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px;
  background: none; border: none;
  color: rgba(255,255,255,0.35); cursor: pointer; transition: all 0.15s;
}
.sm-panel-close:hover { color: var(--teal); background: rgba(0,229,204,0.08); }
body.light-mode .sm-brand-link { color: #333; }
body.light-mode .sm-brand-link:hover { color: #008577; }
body.light-mode .sm-panel-close { color: #adadad; }
body.light-mode .sm-panel-close:hover { color: #008577; background: rgba(0,133,119,0.06); }

.sm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; border-bottom: 1px solid rgba(0,229,204,0.1);
}
.sm-title {
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 0.15em;
  color: var(--gray);
}
.sm-actions { display: flex; gap: 6px; }
.sm-btn {
  width: 28px; height: 28px; border-radius: 6px;
  background: rgba(0,229,204,0.08);
  border: 1px solid rgba(0,229,204,0.2);
  color: var(--teal); font-size: 16px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.sm-btn:hover {
  background: rgba(0,229,204,0.15);
  border-color: var(--teal);
}

.sm-thumbs {
  flex: 1; overflow-y: auto;
  padding: 8px;
  display: flex; flex-direction: column; gap: 4px;
}

.sm-thumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
  position: relative;
}
.sm-thumb:hover { background: rgba(0,229,204,0.05); }
.sm-thumb.active {
  background: rgba(0,229,204,0.08);
  border-color: rgba(0,229,204,0.25);
}
.sm-thumb.dragging { opacity: 0.4; }
.sm-thumb.drag-over { border-color: var(--teal); background: rgba(0,229,204,0.1); }

/* Slide thumbnail preview */
.sm-thumb-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  background: #0d1117;
  border: 1px solid rgba(255,255,255,0.08);
  order: -1;
  /* Container-query based sizing so the 1920×1080 slide inside auto-scales
     to fill the preview width — eliminates the JS rAF timing gap that used
     to leave a right-edge whitespace strip when the sidebar resized. */
  container-type: inline-size;
}
.sm-thumb-preview > .slide,
.sm-thumb-preview > section.slide {
  transform-origin: top left;
  width: 1920px !important;
  height: 1080px !important;
  max-height: none !important;
  padding: 0 !important;
  pointer-events: none;
  overflow: hidden;
  /* CSS-driven scale to fit container width exactly (no JS needed).
     `1920px` (WITH unit) is mandatory — `calc(length / unitless)` resolves
     to a length, which scale() silently rejects, leaving the thumb at raw
     1920×1080 and overflowing into nothing visible. */
  transform: scale(calc(100cqw / 1920px));
}
/* Force all objects visible in thumbnails (skip entrance animations) */
.sm-thumb-preview .anim-pending {
  opacity: 1 !important;
}
body.light-mode .sm-thumb-preview {
  background: #fff;
  border-color: rgba(0,0,0,0.1);
}

.sm-thumb-num {
  font-family: 'DM Mono', monospace;
  font-size: 11px; color: var(--teal);
  min-width: 20px; text-align: center;
}
.sm-thumb-label {
  font-size: 12px; color: var(--gray-light);
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sm-thumb-actions {
  display: none; gap: 4px;
}
.sm-thumb:hover .sm-thumb-actions { display: flex; }

.sm-thumb-btn {
  width: 22px; height: 22px; border-radius: 4px;
  background: transparent; border: 1px solid rgba(255,255,255,0.1);
  color: var(--gray); font-size: 13px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.sm-thumb-btn:hover {
  border-color: rgba(0,229,204,0.3);
  color: var(--teal);
  background: rgba(0,229,204,0.1);
}
.sm-thumb-btn.sm-del:hover {
  border-color: rgba(255,80,80,0.3);
  color: #ff5050;
  background: rgba(255,80,80,0.1);
}

/* Collapse button */
.sm-collapse {
  position: absolute; right: -16px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 48px;
  background: rgba(13,30,53,0.97);
  border: 1px solid rgba(0,229,204,0.15);
  border-left: none;
  border-radius: 0 6px 6px 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray); font-size: 16px;
  cursor: pointer; z-index: 191;
  transition: all 0.15s;
}
.sm-collapse:hover {
  color: var(--teal);
  background: rgba(0,229,204,0.05);
}

/* Editable label */
.sm-thumb-label[contenteditable="true"] {
  outline: 1px solid rgba(0,229,204,0.4);
  outline-offset: 1px;
  border-radius: 3px;
  background: rgba(0,229,204,0.04);
  cursor: text;
}

/* ── FORMAT TOOLBAR ── */
.format-toolbar {
  position: fixed; z-index: 195;
  display: flex; align-items: center; gap: 2px;
  padding: 4px 6px;
  background: rgba(13,30,53,0.97);
  border: 1px solid rgba(0,229,204,0.2);
  border-radius: 10px;
  backdrop-filter: blur(20px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.fmt-btn {
  width: 30px; height: 28px;
  background: transparent; border: none; border-radius: 6px;
  color: var(--gray-light); font-size: 13px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  font-family: 'Sora', sans-serif;
}
.fmt-btn:hover { background: rgba(0,229,204,0.1); color: var(--teal); }
.fmt-btn.active { background: rgba(0,229,204,0.15); color: var(--teal); }
.fmt-btn.fmt-size { font-size: 11px; width: 32px; }

.fmt-sep {
  width: 1px; height: 20px;
  background: rgba(255,255,255,0.1);
  margin: 0 4px;
}

.fmt-color {
  width: 24px; height: 24px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  cursor: pointer;
  background: none;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
}
.fmt-color::-webkit-color-swatch-wrapper { padding: 2px; }
.fmt-color::-webkit-color-swatch { border: none; border-radius: 50%; }

/* ── CONTENT BLOCKS (shared) ── */
.content-block {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
}
.content-block[data-block-type="zoomable-image"] {
  border: 1px solid rgba(0,229,204,0.1);
  cursor: grab;
}
.content-block[data-block-type="zoomable-image"]:active {
  cursor: grabbing;
}

/* Zoomable image minimap */
.block-minimap {
  position: absolute; bottom: 8px; right: 8px;
  width: 80px; height: 60px;
  border: 1px solid rgba(0,229,204,0.3);
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0,0,0,0.5);
  pointer-events: none;
  z-index: 5;
}
.block-minimap img {
  width: 100%; height: 100%; object-fit: contain;
}
.mm-viewport {
  position: absolute;
  border: 1px solid var(--teal);
  background: rgba(0,229,204,0.1);
}

/* ── DATA TABLE BLOCK ── */
.content-block[data-block-type="data-table"] table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.content-block[data-block-type="data-table"] th {
  text-align: left; padding: 8px 12px;
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 0.05em;
  color: var(--teal); border-bottom: 1px solid rgba(0,229,204,0.2);
  background: rgba(0,229,204,0.03);
  user-select: none;
}
.content-block[data-block-type="data-table"] td {
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--gray-light);
}
.content-block[data-block-type="data-table"] tr:hover td {
  background: rgba(0,229,204,0.03);
}
.content-block[data-block-type="data-table"] tr.highlighted td {
  background: rgba(0,229,204,0.08);
  color: var(--white);
}

.table-filter {
  margin-bottom: 8px;
}
.table-filter input {
  width: 100%; padding: 6px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: var(--gray-light); font-size: 13px;
  font-family: 'Sora', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}
.table-filter input:focus {
  border-color: rgba(0,229,204,0.4);
}
.table-filter input::placeholder {
  color: rgba(255,255,255,0.2);
}

.table-pager {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin-top: 8px; padding: 8px 0;
}
.pager-btn {
  padding: 4px 12px; border-radius: 6px;
  background: rgba(0,229,204,0.08);
  border: 1px solid rgba(0,229,204,0.2);
  color: var(--teal); font-size: 12px;
  cursor: pointer; transition: all 0.15s;
  font-family: 'DM Mono', monospace;
}
.pager-btn:hover:not(:disabled) {
  background: rgba(0,229,204,0.15);
}
.pager-btn:disabled {
  opacity: 0.3; cursor: default;
}
.pager-info {
  font-family: 'DM Mono', monospace;
  font-size: 12px; color: var(--gray);
}

/* ── PARAM SLIDER BLOCK ── */
.param-slider-container {
  padding: 12px 16px;
  background: rgba(0,229,204,0.03);
  border: 1px solid rgba(0,229,204,0.1);
  border-radius: 8px;
}
.param-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 0.1em;
  color: var(--gray); margin-bottom: 8px;
  display: block;
}
.param-controls {
  display: flex; align-items: center; gap: 12px;
}
.param-controls input[type="range"] {
  flex: 1; accent-color: var(--teal);
}
.param-value {
  font-family: 'DM Mono', monospace;
  font-size: 14px; color: var(--teal);
  min-width: 60px; text-align: right;
}

/* ── STAT CARD BLOCK — Dark Glass design system ── */
/* `.stat-card-inner` = JSON-path DOM, `.stat-card` = HTML-path DOM
   (generated by html_gen_prompt). Style both identically so the
   Biostate Dark look is consistent across generation paths. */
.stat-card-inner,
.stat-card {
  padding: 24px 20px; text-align: left;
  background: linear-gradient(160deg, #232a3a 0%, #1a1f2e 100%);
  border: 1px solid rgba(120,200,180,0.18);
  border-radius: 16px;
  height: 100%;
  position: relative;
  overflow: hidden;
}
/* Glass top-edge shine — design system spec */
.stat-card-inner::before,
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(100,220,180,0.38), transparent);
  pointer-events: none;
}
/* Inner ambient glow */
.stat-card-inner::after,
.stat-card::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(61,214,163,0.05), transparent);
  pointer-events: none;
}
/* When parent has gradient fill, make inner bg transparent to show through */
body:not(.light-mode) .deck-object[data-has-fill="true"] .stat-card-inner,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .stat-card-inner {
  background: transparent;
  border-color: transparent;
}
.stat-card-inner.purple,
.stat-card.purple {
  background: linear-gradient(160deg, #25203a 0%, #1a1f2e 100%);
  border-color: rgba(167,139,250,0.30);
}
.stat-card-inner.purple::after,
.stat-card.purple::after {
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(167,139,250,0.08), transparent);
}
.stat-value {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 44px; font-weight: 600;
  color: #3dd6a3; line-height: 1;
  margin-bottom: 12px;
  letter-spacing: -1px;
}
.stat-card-inner.purple .stat-value,
.stat-card.purple .stat-value { color: #a78bfa; }
.stat-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px; font-weight: 600;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  line-height: 1;
  color: #e8f0f8;
  display: block;
  margin-bottom: 4px;
}
.stat-desc {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px; font-weight: 400;
  line-height: 1.55;
  color: #7a9bb5;
}
.stat-bar {
  margin-top: 16px;
  height: 3px;
  border-radius: 2px;
  background: rgba(120,200,180,0.18);
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--teal), #7eb8f0);
}
.stat-card-inner.purple .stat-bar-fill,
.stat-card.purple .stat-bar-fill {
  background: linear-gradient(90deg, var(--purple), #c4b5fd);
}
.stat-delta {
  font-family: 'DM Mono', monospace;
  font-size: 12px; margin-top: 4px;
}
.stat-delta.positive { color: #22c55e; }
.stat-delta.negative { color: #ef4444; }

/* ── CLEAN LIGHT: Stat Card overrides ── */
/* Scoped via [data-theme-mode="light"] or body.light-mode */
body.light-mode .stat-card-inner,
[data-theme-mode="light"] .stat-card-inner {
  background: #FFFFFF;
  border: 1px solid #D4E4EF;
  border-radius: 10px;
  padding: 20px 16px 16px;
}
/* Light-mode stat card color overrides (top bar removed per design) */
body.light-mode .stat-card-inner.teal .stat-value,
[data-theme-mode="light"] .stat-card-inner.teal .stat-value {
  color: #1BC9C1;
}
/* Blue variant */
body.light-mode .stat-card-inner.blue .stat-value,
[data-theme-mode="light"] .stat-card-inner.blue .stat-value {
  color: #7FB3D9;
}
body.light-mode .stat-card-inner.purple,
[data-theme-mode="light"] .stat-card-inner.purple {
  background: #FFFFFF;
  border-color: #D4E4EF;
}
body.light-mode .stat-card-inner.purple .stat-value,
[data-theme-mode="light"] .stat-card-inner.purple .stat-value {
  color: #9B93D4;
}
/* Clean Light stat fonts */
body.light-mode .stat-value,
[data-theme-mode="light"] .stat-value {
  font-family: 'DM Sans', sans-serif;
  font-size: 44px; font-weight: 500;
  letter-spacing: -2px;
}
body.light-mode .stat-label,
[data-theme-mode="light"] .stat-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px; font-weight: 500;
  color: #2E3A5C;
}
/* Stat bar — Clean Light style */
body.light-mode .stat-bar,
[data-theme-mode="light"] .stat-bar {
  background: #E8F0F5;
}
body.light-mode .stat-card-inner.teal .stat-bar-fill,
[data-theme-mode="light"] .stat-card-inner.teal .stat-bar-fill {
  background: linear-gradient(90deg, #1BC9C1, #7FB3D9);
}
body.light-mode .stat-card-inner.blue .stat-bar-fill,
[data-theme-mode="light"] .stat-card-inner.blue .stat-bar-fill {
  background: linear-gradient(90deg, #7FB3D9, #9B93D4);
}
body.light-mode .stat-card-inner.purple .stat-bar-fill,
[data-theme-mode="light"] .stat-card-inner.purple .stat-bar-fill {
  background: linear-gradient(90deg, #9B93D4, #C4B5FD);
}

/* ── COMPARISON BLOCK ── */
.comparison-container {
  display: flex; position: relative;
  border: 1px solid rgba(0,229,204,0.1);
  border-radius: 8px;
  overflow: hidden;
}
.comparison-left, .comparison-right {
  overflow: hidden; position: relative;
}
.comparison-slider {
  position: absolute; top: 0; bottom: 0;
  width: 4px; left: 50%;
  background: var(--teal);
  cursor: col-resize; z-index: 5;
}
.comparison-slider::after {
  content: ''; position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 20px; height: 40px;
  background: var(--teal); border-radius: 10px;
  opacity: 0.5;
}
.comparison-label {
  position: absolute; top: 8px; left: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 0.1em;
  color: var(--teal); background: rgba(6,13,26,0.7);
  padding: 2px 8px; border-radius: 4px; z-index: 4;
}

/* ── GATING HIERARCHY BLOCK ── */
.gating-tree {
  padding: 12px;
}
.gate-node {
  display: flex; align-items: center;
  padding: 4px 0;
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 4px;
}
.gate-node:hover { background: rgba(0,229,204,0.04); }
.gate-connector {
  border-left: 1px dashed rgba(0,229,204,0.2);
  height: 100%;
}
.gate-content {
  display: flex; align-items: center; gap: 8px;
  flex: 1;
}
.gate-dot {
  width: 8px; height: 8px;
  background: var(--teal); border-radius: 50%;
  flex-shrink: 0;
}
.gate-name {
  font-size: 13px; color: var(--white);
  font-weight: 500;
}
.gate-pct {
  font-family: 'DM Mono', monospace;
  font-size: 12px; color: var(--teal);
}
.gate-count {
  font-family: 'DM Mono', monospace;
  font-size: 11px; color: var(--gray);
}

/* ── ANNOTATION LAYER ── */
.annotation-svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 10;
}

/* ── DRAG-DROP ZONE ── */
.slide.drop-target {
  outline: 3px dashed var(--teal) !important;
  outline-offset: -8px;
  background: rgba(0,229,204,0.03) !important;
}
.slide.drop-target::after {
  content: 'Drop media here';
  position: absolute; bottom: 100px; left: 50%;
  transform: translateX(-50%);
  font-family: 'DM Mono', monospace;
  font-size: 13px; letter-spacing: 0.1em;
  color: var(--teal); opacity: 0.6;
  background: rgba(6,13,26,0.7);
  padding: 8px 20px; border-radius: 8px;
  z-index: 10; pointer-events: none;
}

/* ── AUDIO PLAYER BLOCK ── */
.audio-player-container {
  padding: 16px; border-radius: 10px;
  background: rgba(0,229,204,0.03);
  border: 1px solid rgba(0,229,204,0.1);
}
.audio-filename {
  font-family: 'DM Mono', monospace;
  font-size: 11px; color: var(--gray);
  margin-bottom: 8px; letter-spacing: 0.05em;
}
.audio-waveform {
  width: 100%; height: 60px;
  border-radius: 6px; margin-bottom: 8px;
  background: rgba(0,0,0,0.15);
}
.audio-controls {
  display: flex; align-items: center; gap: 10px;
}
.audio-play-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--teal); border: none;
  color: var(--navy); font-size: 14px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.audio-play-btn:hover { opacity: 0.85; transform: scale(1.08); }
.audio-scrubber {
  flex: 1; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.08);
  cursor: pointer; position: relative;
}
.audio-progress {
  height: 100%; border-radius: 2px;
  background: var(--teal); width: 0%;
  transition: width 0.1s;
}
.audio-time {
  font-family: 'DM Mono', monospace;
  font-size: 11px; color: var(--gray);
  min-width: 80px; text-align: right;
}

/* ── VIDEO PLAYER BLOCK ── */
.video-player-container {
  position: relative; border-radius: 8px; overflow: hidden;
}
.video-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.3);
  transition: opacity 0.2s;
}
.video-overlay.playing { opacity: 0; pointer-events: none; }
.video-play-btn {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(0,229,204,0.9); border: none;
  color: var(--navy); font-size: 24px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(0,229,204,0.3);
}
.video-play-btn:hover { transform: scale(1.1); }

/* ── PDF VIEWER BLOCK ── */
.pdf-viewer-container {
  border-radius: 8px; overflow: hidden;
  border: 1px solid rgba(0,229,204,0.1);
}
.pdf-filename {
  font-family: 'DM Mono', monospace;
  font-size: 11px; color: var(--gray);
  padding: 8px 12px; letter-spacing: 0.05em;
  background: rgba(0,229,204,0.03);
  border-bottom: 1px solid rgba(0,229,204,0.08);
}

/* ── INSERTED TEXT BOX ── */
.inserted-text-box:focus-within {
  border-color: rgba(0,229,204,0.4);
  background: rgba(0,229,204,0.05);
}

/* ── AI DESIGNER CHAT PANEL ── */
.chat-panel {
  position: fixed; right: 0; top: 60px; bottom: 0;
  width: 340px; z-index: 195;
  background: rgba(13,30,53,0.97);
  border-left: 1px solid rgba(0,229,204,0.15);
  backdrop-filter: blur(20px);
  display: flex; flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.3);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.chat-panel.open { transform: translateX(0); }

.chat-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0,229,204,0.1);
}
.chat-title {
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 0.15em;
  color: var(--gray); flex-shrink: 0;
}
.chat-model-select {
  flex: 1; min-width: 0;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: var(--gray-light); font-size: 11px;
  padding: 4px 6px;
  font-family: 'DM Mono', monospace;
  outline: none; cursor: pointer;
}
.chat-model-select:focus { border-color: rgba(0,229,204,0.3); }
.chat-close {
  width: 28px; height: 28px; border: none;
  background: transparent; color: var(--gray);
  font-size: 18px; cursor: pointer; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.chat-close:hover { background: rgba(255,255,255,0.06); color: var(--white); }

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
}

.chat-msg { display: flex; }
.chat-msg-user { justify-content: flex-end; }
.chat-msg-assistant { justify-content: flex-start; }
.chat-msg-system { justify-content: center; }

.chat-bubble {
  max-width: 85%; padding: 8px 12px;
  border-radius: 12px; font-size: 13px;
  line-height: 1.5; word-wrap: break-word;
}
.chat-msg-user .chat-bubble {
  background: var(--teal); color: var(--navy);
  border-bottom-right-radius: 4px;
}
.chat-msg-assistant .chat-bubble {
  background: rgba(255,255,255,0.06);
  color: var(--gray-light);
  border-bottom-left-radius: 4px;
}
.chat-msg-system .chat-bubble {
  background: rgba(255,200,50,0.08);
  color: rgba(255,200,50,0.8);
  font-size: 11px; font-style: italic;
  border-radius: 8px;
}

/* Streaming dots */
.chat-dots span {
  animation: chatDot 1.2s infinite;
  opacity: 0;
}
.chat-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatDot {
  0%, 60% { opacity: 0; }
  30% { opacity: 1; }
}

/* Approval bar */
.chat-approval {
  padding: 12px; border-top: 1px solid rgba(0,229,204,0.1);
  background: rgba(0,229,204,0.03);
}
.chat-approval-summary {
  font-family: 'DM Mono', monospace;
  font-size: 11px; color: var(--teal);
  margin-bottom: 8px;
}
.chat-approval-actions {
  display: flex; gap: 6px;
}
.chat-approve-btn, .chat-tryagain-btn, .chat-reject-btn {
  flex: 1; padding: 6px 0; border-radius: 6px;
  border: 1px solid; font-size: 12px; cursor: pointer;
  font-family: 'Sora', sans-serif; font-weight: 500;
  transition: all 0.15s;
}
.chat-approve-btn {
  background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.3); color: #22c55e;
}
.chat-approve-btn:hover { background: rgba(34,197,94,0.2); }
.chat-tryagain-btn {
  background: rgba(255,200,50,0.08); border-color: rgba(255,200,50,0.2); color: #ffc832;
}
.chat-tryagain-btn:hover { background: rgba(255,200,50,0.15); }
.chat-reject-btn {
  background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.2); color: #ef4444;
}
.chat-reject-btn:hover { background: rgba(239,68,68,0.15); }

.chat-tryagain-input {
  display: flex; gap: 6px; margin-top: 8px;
}
.chat-tryagain-input input {
  flex: 1; padding: 6px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; color: var(--gray-light);
  font-size: 12px; outline: none;
  font-family: 'Sora', sans-serif;
}
.chat-tryagain-input input:focus { border-color: rgba(255,200,50,0.3); }
.chat-tryagain-input button {
  padding: 6px 12px; border-radius: 6px;
  background: rgba(255,200,50,0.12); border: 1px solid rgba(255,200,50,0.3);
  color: #ffc832; cursor: pointer; font-size: 12px;
  font-family: 'Sora', sans-serif;
}

/* Input form */
.chat-input-form {
  display: flex; gap: 6px; padding: 12px;
  border-top: 1px solid rgba(0,229,204,0.1);
}
.chat-input {
  flex: 1; padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; color: var(--white);
  font-size: 13px; outline: none;
  font-family: 'Sora', sans-serif;
}
.chat-input:focus { border-color: rgba(0,229,204,0.3); }
.chat-input::placeholder { color: rgba(255,255,255,0.2); }
.chat-input:disabled { opacity: 0.4; }

.chat-send-btn {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--teal); border: none;
  color: var(--navy); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.chat-send-btn:hover { opacity: 0.85; transform: scale(1.05); }

/* ══════════════════════════════════════════════
   LIGHT MODE OVERRIDES
   ══════════════════════════════════════════════ */
/* Dark mode: override default light panel */
body:not(.light-mode) .slide-manager-panel {
  background: rgba(13,30,53,0.97);
  border-right-color: rgba(0,229,204,0.15);
  box-shadow: 4px 0 24px rgba(0,0,0,0.3);
}
body.light-mode .sm-title { color: #3a4f63; }
body.light-mode .sm-btn { background: rgba(0,133,119,0.08); border-color: rgba(0,133,119,0.2); color: #008577; }
body.light-mode .sm-thumb.active { background: rgba(0,133,119,0.08); border-color: rgba(0,133,119,0.2); }
body.light-mode .sm-thumb-label { color: #1e3347; }
body.light-mode .sm-thumb-num { color: #008577; }
body.light-mode .sm-thumb-btn { border-color: rgba(0,0,0,0.1); color: #3a4f63; }
body.light-mode .sm-collapse { background: rgba(245,247,250,0.97); border-color: rgba(0,0,0,0.1); color: #3a4f63; }
body.light-mode .sm-collapse:hover { color: #008577; background: rgba(0,133,119,0.05); }
body.light-mode .panel-resize-handle:hover,
body.light-mode .panel-resize-handle.dragging { background: #008577; }

body.light-mode .format-toolbar {
  background: rgba(245,247,250,0.97);
  border-color: rgba(0,0,0,0.12);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
body.light-mode .fmt-btn { color: #1e3347; }
body.light-mode .fmt-btn:hover { background: rgba(0,133,119,0.1); color: #008577; }
body.light-mode .fmt-btn.active { background: rgba(0,133,119,0.15); color: #008577; }
body.light-mode .fmt-sep { background: rgba(0,0,0,0.1); }

body.light-mode .comparison-label {
  background: rgba(245,247,250,0.7);
  color: #008577;
}
body.light-mode .block-minimap {
  background: rgba(255,255,255,0.7);
  border-color: rgba(0,133,119,0.3);
}
body.light-mode .gate-node:hover { background: rgba(0,133,119,0.04); }

body.light-mode .content-block[data-block-type="data-table"] th {
  color: #008577; border-bottom-color: rgba(0,133,119,0.2);
  background: rgba(0,133,119,0.03);
}
body.light-mode .content-block[data-block-type="data-table"] td {
  border-bottom-color: rgba(0,0,0,0.05);
  color: #1e3347;
}
body.light-mode .table-filter input {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.12);
  color: #1e3347;
}
body.light-mode .param-slider-container {
  background: rgba(0,133,119,0.03);
  border-color: rgba(0,133,119,0.1);
}
body.light-mode .stat-card-inner {
  background: rgba(0,133,119,0.03);
  border-color: rgba(0,133,119,0.1);
}

body.light-mode .slide.drop-target { outline-color: #008577; background: rgba(0,133,119,0.03) !important; }
body.light-mode .slide.drop-target::after { color: #008577; background: rgba(245,247,250,0.8); }
body.light-mode .audio-player-container { background: rgba(0,133,119,0.03); border-color: rgba(0,133,119,0.1); }
body.light-mode .audio-waveform { background: rgba(0,0,0,0.05); }
body.light-mode .audio-scrubber { background: rgba(0,0,0,0.08); }
body.light-mode .pdf-viewer-container { border-color: rgba(0,0,0,0.1); }
body.light-mode .pdf-filename { background: rgba(0,0,0,0.02); border-bottom-color: rgba(0,0,0,0.06); color: #3a4f63; }

body.light-mode .chat-panel {
  background: rgba(245,247,250,0.97);
  border-left-color: rgba(0,0,0,0.1);
  box-shadow: -4px 0 24px rgba(0,0,0,0.08);
}
body.light-mode .chat-header { border-bottom-color: rgba(0,0,0,0.08); }
body.light-mode .chat-title { color: #3a4f63; }
body.light-mode .chat-model-select { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.12); color: #1e3347; }
body.light-mode .chat-close { color: #3a4f63; }
body.light-mode .chat-close:hover { background: rgba(0,0,0,0.04); color: #0a1628; }
body.light-mode .chat-msg-user .chat-bubble { background: #008577; color: #fff; }
body.light-mode .chat-msg-assistant .chat-bubble { background: rgba(0,0,0,0.04); color: #1e3347; }
body.light-mode .chat-input { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.12); color: #0a1628; }
body.light-mode .chat-input:focus { border-color: rgba(0,133,119,0.3); }
body.light-mode .chat-input::placeholder { color: rgba(0,0,0,0.25); }
body.light-mode .chat-send-btn { background: #008577; color: #fff; }
body.light-mode .chat-approval { background: rgba(0,133,119,0.03); border-top-color: rgba(0,0,0,0.08); }
body.light-mode .chat-approval-summary { color: #008577; }
body.light-mode .chat-input-form { border-top-color: rgba(0,0,0,0.08); }

/* ── PRINT: hide editor UI ── */
@media print {
  .slide-manager-panel, .format-toolbar, .selection-overlay, .chat-panel, .marquee-box, .shortcuts-overlay { display: none !important; }
  .video-overlay, .audio-controls { display: none !important; }
  .find-replace-overlay, .zoom-indicator, .autosave-indicator, .notes-panel { display: none !important; }
}

/* ── Format Toolbar Extensions ── */
.fmt-font-family {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px; color: #ccd; font-size: 11px; padding: 2px 4px;
  font-family: 'Sora', sans-serif; cursor: pointer; max-width: 110px;
}
.fmt-font-family:focus { outline: none; border-color: var(--teal); }
.fmt-font-family option { background: #0d1e35; color: #ccd; }

.fmt-size-combo {
  display: inline-flex; align-items: stretch;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px; overflow: hidden;
}
.fmt-size-combo:focus-within { border-color: var(--teal); }
.fmt-size-input {
  width: 36px; height: 22px;
  background: transparent; border: none;
  color: #ccd; font-size: 11px; padding: 2px 4px;
  font-family: 'Sora', sans-serif; text-align: center;
  -moz-appearance: textfield;
}
.fmt-size-input::-webkit-outer-spin-button,
.fmt-size-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fmt-size-input:focus { outline: none; }
.fmt-size-arrow {
  width: 16px; height: 22px;
  background: transparent; border: none;
  border-left: 1px solid rgba(255,255,255,0.08);
  color: #ccd; font-size: 10px; line-height: 1;
  cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Sora', sans-serif;
}
.fmt-size-arrow:hover { background: rgba(0,229,204,0.12); color: var(--teal); }

.fmt-size-menu {
  position: fixed; z-index: 196;
  background: rgba(13,30,53,0.98);
  border: 1px solid rgba(0,229,204,0.2);
  border-radius: 6px;
  padding: 4px 0;
  min-width: 56px;
  max-height: 260px; overflow-y: auto;
  box-shadow: 0 6px 22px rgba(0,0,0,0.45);
  backdrop-filter: blur(20px);
  display: flex; flex-direction: column;
}
.fmt-size-menu-item {
  background: transparent; border: none;
  color: #ccd; font-size: 12px; font-family: 'Sora', sans-serif;
  padding: 4px 10px; text-align: left;
  cursor: pointer;
}
.fmt-size-menu-item:hover { background: rgba(0,229,204,0.12); color: var(--teal); }

/* ── Find / Replace Overlay ── */
.find-replace-overlay {
  position: fixed; top: 70px; right: 20px; z-index: 300;
  background: rgba(13,30,53,0.97);
  border: 1px solid rgba(0,229,204,0.2);
  border-radius: 10px;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
  padding: 10px; width: 340px;
  display: none; flex-direction: column; gap: 6px;
}
.find-replace-overlay.open { display: flex; }
.find-replace-row {
  display: flex; align-items: center; gap: 6px;
}
.find-replace-overlay input {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; color: var(--white);
  font-size: 12px; padding: 6px 10px;
  font-family: 'Sora', sans-serif; outline: none;
}
.find-replace-overlay input:focus { border-color: rgba(0,229,204,0.4); }
.find-replace-count {
  font-family: 'DM Mono', monospace;
  font-size: 10px; color: var(--gray);
  min-width: 60px; text-align: right;
}
.find-replace-btn {
  padding: 4px 10px; border-radius: 6px;
  background: rgba(0,229,204,0.08);
  border: 1px solid rgba(0,229,204,0.2);
  color: var(--teal); font-size: 11px;
  cursor: pointer; font-family: 'DM Mono', monospace;
  transition: all 0.15s;
}
.find-replace-btn:hover { background: rgba(0,229,204,0.18); }
.find-highlight {
  outline: 2px solid #ffc832 !important;
  outline-offset: 2px;
  box-shadow: 0 0 18px rgba(255,200,50,0.4);
}

/* ── Zoom Indicator ── */
.zoom-indicator {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%);
  background: rgba(13,30,53,0.94);
  border: 1px solid rgba(0,229,204,0.25);
  color: var(--teal);
  font-family: 'DM Mono', monospace;
  font-size: 13px; padding: 6px 14px;
  border-radius: 18px; z-index: 260;
  pointer-events: none;
  opacity: 0; transition: opacity 0.25s;
}
.zoom-indicator.visible { opacity: 1; }

/* ── Grid Overlay ── */
.slide.show-grid {
  background-image:
    linear-gradient(rgba(0,229,204,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,204,0.08) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ── Auto-save Indicator ── */
.autosave-indicator {
  position: fixed; bottom: 16px; left: 16px;
  background: rgba(13,30,53,0.9);
  border: 1px solid rgba(0,229,204,0.2);
  color: rgba(255,255,255,0.6);
  font-family: 'Manrope', 'DM Mono', monospace;
  font-size: 11px; padding: 5px 10px;
  border-radius: 8px; z-index: 255;
  display: none; align-items: center; gap: 6px;
  pointer-events: none;
  opacity: 0; transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s;
}
.autosave-indicator.visible { opacity: 1; transform: translateY(0); }
.autosave-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 4px rgba(34,197,94,0.5);
}

/* ── Notes Panel (speaker notes) ── */
.notes-panel {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: 180px; z-index: 210;
  background: rgba(13,30,53,0.97);
  border-top: 1px solid rgba(0,229,204,0.2);
  backdrop-filter: blur(20px);
  display: flex; flex-direction: column;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
.notes-panel.open { transform: translateY(0); }
.notes-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(0,229,204,0.1);
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 0.12em;
  color: var(--gray);
}
.notes-toggle {
  cursor: pointer; font-size: 18px;
  color: var(--gray); padding: 0 6px;
  transition: color 0.15s;
}
.notes-toggle:hover { color: var(--teal); }
.notes-textarea {
  flex: 1; resize: none;
  background: transparent; border: none;
  color: var(--gray-light); font-size: 13px;
  font-family: 'Sora', sans-serif;
  padding: 12px 16px; outline: none;
  line-height: 1.5;
}
.notes-textarea::placeholder { color: rgba(255,255,255,0.25); }

/* Light mode for new elements */
body.light-mode .fmt-font-family {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.12);
  color: #1e3347;
}
body.light-mode .fmt-font-family option { background: #f5f7fa; color: #1e3347; }
body.light-mode .fmt-size-combo {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.12);
}
body.light-mode .fmt-size-input { color: #1e3347; }
body.light-mode .fmt-size-arrow {
  color: #1e3347;
  border-left-color: rgba(0,0,0,0.08);
}
body.light-mode .fmt-size-arrow:hover { background: rgba(0,133,119,0.1); color: #008577; }
body.light-mode .fmt-size-menu {
  background: rgba(245,247,250,0.98);
  border-color: rgba(0,0,0,0.12);
  box-shadow: 0 6px 22px rgba(0,0,0,0.12);
}
body.light-mode .fmt-size-menu-item { color: #1e3347; }
body.light-mode .fmt-size-menu-item:hover { background: rgba(0,133,119,0.08); color: #008577; }
body.light-mode .find-replace-overlay {
  background: rgba(245,247,250,0.97);
  border-color: rgba(0,0,0,0.12);
  box-shadow: 0 8px 28px rgba(0,0,0,0.15);
}
body.light-mode .find-replace-overlay input {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.12);
  color: #0a1628;
}
body.light-mode .find-replace-btn {
  background: rgba(0,133,119,0.08);
  border-color: rgba(0,133,119,0.2);
  color: #008577;
}
body.light-mode .zoom-indicator,
body.light-mode .autosave-indicator {
  background: rgba(245,247,250,0.94);
  border-color: rgba(0,0,0,0.1);
  color: #1e3347;
}
body.light-mode .notes-panel {
  background: rgba(245,247,250,0.97);
  border-top-color: rgba(0,0,0,0.1);
}
body.light-mode .notes-panel-header { color: #3a4f63; border-bottom-color: rgba(0,0,0,0.08); }
body.light-mode .notes-textarea { color: #1e3347; }

/* ── Slide Sorter View ── */
.slide-manager-panel.sorter-mode {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw !important;
  height: 100vh;
  z-index: 500;
  background: rgba(6, 13, 26, 0.96);
  backdrop-filter: blur(12px);
}
.slide-manager-panel.sorter-mode .sm-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  padding: 24px;
  max-height: calc(100vh - 70px);
  overflow-y: auto;
}
.slide-manager-panel.sorter-mode .sm-thumb {
  aspect-ratio: 16 / 9;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(0, 229, 204, 0.1);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.slide-manager-panel.sorter-mode .sm-thumb:hover {
  transform: scale(1.02);
  border-color: rgba(0, 229, 204, 0.3);
}
.slide-manager-panel.sorter-mode .sm-thumb.active {
  border-color: var(--teal);
  background: rgba(0, 229, 204, 0.04);
}
.slide-manager-panel.sorter-mode .sm-thumb-num {
  font-size: 48px !important;
  font-weight: 700;
  color: rgba(0, 229, 204, 0.3);
}
.slide-manager-panel.sorter-mode .sm-thumb-label {
  font-size: 16px !important;
  font-weight: 600;
  color: #f0f4f8;
}
body.sorter-mode .slides-wrapper,
body.sorter-mode .deck-toolbar,
body.sorter-mode .slide-nav-bar,
body.sorter-mode .deck-nav-arrow,
body.sorter-mode .deck-counter {
  display: none !important;
}
.sm-btn.sm-sorter {
  background: none;
  border: none;
  color: #667;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
}
.sm-btn.sm-sorter:hover { color: var(--teal); }

/* ── Slide Manager Edge Tab (left edge) ── */
/* Sidebar toggle button (only visible when panel closed) */
.sidebar-toggle-btn {
  position: fixed; top: 18px; left: 18px; z-index: 201;
  width: 34px; height: 34px; border-radius: 8px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: rgba(255,255,255,0.5);
  transition: all 0.15s;
}
.sidebar-toggle-btn:hover { color: var(--teal); background: rgba(0,229,204,0.08); border-color: rgba(0,229,204,0.2); }
body.sm-panel-open .sidebar-toggle-btn { display: none; }
body.light-mode .sidebar-toggle-btn { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.08); color: #999; }
body.light-mode .sidebar-toggle-btn:hover { color: #008577; background: rgba(0,133,119,0.06); }

/* ── Notes Panel: push slides up ── */
body.notes-panel-open .slides-wrapper {
  padding-bottom: 160px;
}
body.notes-panel-open .slide-nav-bar {
  bottom: 160px;
}
body.notes-panel-open .deck-counter {
  bottom: 170px;
}

body.notes-panel-open .slides-wrapper {
  height: calc(100vh - 150px);
}
body.notes-panel-open .slide {
  height: calc(100vh - 150px);
  min-height: calc(100vh - 150px);
}

/* ── Slide Manager Footer (Insert button in panel) ── */
.sm-footer {
  padding: 10px;
  border-top: 1px solid rgba(255,255,255,0.05);
  position: relative;
}
.sm-insert-wrap { position: relative; }
.sm-insert-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0, 229, 204, 0.08);
  border: 1px solid rgba(0, 229, 204, 0.2);
  border-radius: 6px;
  color: var(--teal);
  font-family: 'Sora', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.15s;
}
.sm-insert-btn:hover { background: rgba(0, 229, 204, 0.15); }
.sm-insert-btn svg { stroke: currentColor; fill: none; stroke-width: 2; }
.sm-insert-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--dark-card, #0d1e35);
  border: 1px solid rgba(0, 229, 204, 0.15);
  border-radius: 8px;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 5;
}
.sm-insert-menu.open { display: flex; }
.sm-insert-menu .download-opt {
  text-align: left;
  padding: 6px 10px;
  font-size: 12px;
}
body.light-mode .sm-insert-btn {
  background: rgba(0, 133, 119, 0.08);
  border-color: rgba(0, 133, 119, 0.2);
  color: #008577;
}
body.light-mode .sm-insert-menu {
  background: rgba(245, 247, 250, 0.98);
  border-color: rgba(0, 0, 0, 0.1);
}

/* ── Insert Object Button (top-left of slide viewer) ── */
.insert-object-btn {
  position: relative;
  display: flex; align-items: stretch;
  background: rgba(0, 229, 204, 0.08);
  border: 1px solid rgba(0, 229, 204, 0.2);
  border-radius: 8px; overflow: visible;
}
.insert-object-btn .ins-obj-main {
  display: flex; align-items: center; gap: 6px;
  background: transparent; border: none; color: var(--teal);
  padding: 8px 12px; cursor: pointer;
  font-family: 'Sora', sans-serif; font-size: 12px; font-weight: 600; letter-spacing: 0.5px;
}
.insert-object-btn .ins-obj-main:hover { background: rgba(0, 229, 204, 0.12); border-radius: 8px; }
.insert-object-btn .ins-obj-main svg { stroke: currentColor; fill: none; stroke-width: 2; }
.insert-object-btn .insert-object-menu {
  position: absolute; top: calc(100% + 4px); right: 0;
  min-width: 170px; max-height: 70vh; overflow-y: auto;
  background: var(--dark-card, #0d1e35);
  border: 1px solid rgba(0, 229, 204, 0.15);
  border-radius: 8px; padding: 6px;
  display: none; flex-direction: column; gap: 2px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4); z-index: 210;
}
.insert-object-btn .insert-object-menu.open { display: flex; }
.insert-object-btn .insert-object-menu .download-opt { text-align: left; padding: 6px 10px; font-size: 12px; }
/* Insert submenu groups (Image / Video with Upload + AI Generate sub-options) */
.ins-submenu-group { display: flex; flex-direction: column; gap: 1px; }
.ins-submenu-label {
  padding: 6px 10px 3px; font-size: 10px; font-weight: 700;
  color: rgba(255,255,255,0.35); letter-spacing: 0.05em;
  text-transform: uppercase; pointer-events: none;
}
.ins-sub { padding-left: 22px !important; font-size: 11px !important; }
body.light-mode .ins-submenu-label { color: #999; }
body.light-mode .insert-object-btn { background: rgba(0, 133, 119, 0.08); border-color: rgba(0, 133, 119, 0.2); }
body.light-mode .insert-object-btn .ins-obj-main { color: #008577; }
body.light-mode .insert-object-btn .insert-object-menu { background: rgba(245, 247, 250, 0.98); border-color: rgba(0, 0, 0, 0.1); }

/* ══════════════════════════════════════════════
   INSPECTOR PANEL
   ══════════════════════════════════════════════ */
.inspector-panel {
  position: fixed; right: -300px; top: 60px; bottom: 0;
  width: 280px; z-index: 195;
  background: rgba(13,30,53,0.97);
  border-left: 1px solid rgba(0,229,204,0.15);
  backdrop-filter: blur(20px);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: -4px 0 24px rgba(0,0,0,0.3);
  transition: right 0.25s cubic-bezier(0.16,1,0.3,1);
  font-family: 'Manrope', 'Sora', sans-serif;
}
.inspector-panel.open { right: 0; }

.insp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.insp-title {
  font-family: 'Sora', sans-serif;
  font-size: 13px; font-weight: 600; color: #fff;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.insp-close {
  background: none; border: none; color: rgba(255,255,255,0.4);
  font-size: 20px; cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.insp-close:hover { color: #fff; background: rgba(255,255,255,0.05); }

.insp-body {
  flex: 1; overflow-y: auto; padding: 8px 0;
}
.insp-body::-webkit-scrollbar { width: 4px; }
.insp-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.insp-empty {
  padding: 32px 16px; text-align: center;
  color: rgba(255,255,255,0.3); font-size: 13px;
}

.insp-section {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.insp-section-title {
  font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.35);
  text-transform: uppercase; letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.insp-type-badge {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 9999px;
  background: rgba(69,208,189,0.15); color: #45d0bd;
  text-transform: uppercase; letter-spacing: 0.04em;
}

.insp-row {
  display: flex; gap: 8px; margin-bottom: 6px; align-items: center;
}

.insp-field {
  flex: 1; display: flex; align-items: center; gap: 4px;
}
.insp-field label {
  font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.5);
  min-width: 24px; flex-shrink: 0;
}

.insp-field input[type="number"],
.insp-field input[type="text"] {
  width: 100%; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px; color: #fff;
  font-size: 12px; font-family: 'Manrope', sans-serif;
  padding: 5px 6px; outline: none;
  -moz-appearance: textfield;
}
.insp-field input[type="number"]::-webkit-inner-spin-button,
.insp-field input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
.insp-field input:focus {
  border-color: rgba(69,208,189,0.5);
}

.insp-field select {
  width: 100%; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px; color: #fff;
  font-size: 12px; font-family: 'Manrope', sans-serif;
  padding: 5px 6px; outline: none; cursor: pointer;
}
.insp-field select option { background: #1e293b; color: #fff; }

.insp-field input[type="color"] {
  width: 28px; height: 28px; border: none; padding: 0;
  border-radius: 6px; cursor: pointer; flex-shrink: 0;
  background: transparent;
}
.insp-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.insp-field input[type="color"]::-webkit-color-swatch { border-radius: 4px; border: 1px solid rgba(255,255,255,0.15); }

.insp-color-text {
  flex: 1 !important;
  width: 60px !important;
  min-width: 0;
}

.insp-field input[type="range"] {
  flex: 1; height: 4px; -webkit-appearance: none;
  background: rgba(255,255,255,0.1); border-radius: 2px; outline: none;
}
.insp-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: #45d0bd; cursor: pointer;
}

.insp-range-val {
  font-size: 11px; color: rgba(255,255,255,0.5);
  min-width: 32px; text-align: right;
}

.insp-field input[type="checkbox"] {
  width: 16px; height: 16px; cursor: pointer;
  accent-color: #45d0bd;
}

.insp-reset-crop {
  width: 100%; padding: 6px 12px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; color: rgba(255,255,255,0.7);
  font-size: 11px; font-family: 'Manrope', sans-serif;
  cursor: pointer; transition: all 0.15s;
}
.insp-reset-crop:hover:not(:disabled) { background: rgba(69,208,189,0.15); color: #45d0bd; border-color: rgba(69,208,189,0.3); }
.insp-reset-crop:disabled { opacity: 0.3; cursor: not-allowed; }

/* Light mode */
body.light-mode .inspector-panel {
  background: rgba(255,255,255,0.97);
  border-left: 1px solid rgba(0,0,0,0.08);
  box-shadow: -4px 0 24px rgba(0,0,0,0.08);
}
body.light-mode .insp-title { color: #111; }
body.light-mode .insp-close { color: #adadad; }
body.light-mode .insp-close:hover { color: #111; background: rgba(0,0,0,0.04); }
body.light-mode .insp-section { border-bottom-color: rgba(0,0,0,0.05); }
body.light-mode .insp-section-title { color: #adadad; }
body.light-mode .insp-field label { color: #666; }
body.light-mode .insp-field input[type="number"],
body.light-mode .insp-field input[type="text"] {
  background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.1); color: #111;
}
body.light-mode .insp-field select {
  background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.1); color: #111;
}
body.light-mode .insp-field select option { background: #fff; color: #111; }
body.light-mode .insp-field input[type="range"] { background: rgba(0,0,0,0.1); }
body.light-mode .insp-range-val { color: #999; }
body.light-mode .insp-empty { color: #adadad; }

/* ══════════════════════════════════════════════
   CONTEXT MENU (right-click)
   ══════════════════════════════════════════════ */
.ctx-menu {
  display: none;
  position: fixed; z-index: 500;
  min-width: 200px;
  background: rgba(13,30,53,0.97);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  backdrop-filter: blur(20px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  padding: 6px 0;
  font-family: 'Manrope', sans-serif;
  animation: ctxFadeIn 0.12s ease;
}
@keyframes ctxFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
.ctx-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 14px;
  font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.85);
  cursor: pointer; transition: background 0.1s ease;
}
.ctx-item:hover { background: rgba(69,208,189,0.12); color: #fff; }
.ctx-disabled { opacity: 0.3; pointer-events: none; }
.ctx-shortcut {
  font-size: 11px; font-weight: 600;
  color: rgba(255,255,255,0.35);
  margin-left: 24px;
}
.ctx-sep {
  height: 1px; margin: 4px 10px;
  background: rgba(255,255,255,0.07);
}

/* Light mode */
body.light-mode .ctx-menu {
  background: rgba(255,255,255,0.98);
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
body.light-mode .ctx-item { color: #333; }
body.light-mode .ctx-item:hover { background: rgba(69,208,189,0.08); color: #111; }
body.light-mode .ctx-shortcut { color: #adadad; }
body.light-mode .ctx-sep { background: rgba(0,0,0,0.06); }

/* ── METALLIC GLASS CARD STYLING (dark theme) ── */
/* Scoped via [data-theme-mode="dark"] on ancestor OR body:not(.light-mode)
   so glass effects render correctly inside modal/thumbnail previews too. */
body:not(.light-mode) .deck-object[data-has-fill="true"],
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] {
  overflow: hidden;
}
/* Glass top-edge highlight — removed per design system */
/* Glass radial glow — ::after = soft upper-left shine */
body:not(.light-mode) .deck-object[data-has-fill="true"]::after,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"]::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 40% at 30% 0%, rgba(180,240,220,0.07), transparent);
  pointer-events: none;
  z-index: 0;
}
/* Ensure text content stays above glass effects */
body:not(.light-mode) .deck-object[data-has-fill="true"] .obj-text-content,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .obj-text-content {
  position: relative;
  z-index: 1;
}
body:not(.light-mode) .deck-object[data-has-fill="true"] .stat-card-inner,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .stat-card-inner {
  position: relative;
  z-index: 1;
}
/* ── Dark theme fact card (text card with fill) — matches design system ── */
/* Left accent bar */
body:not(.light-mode) .deck-object[data-has-fill="true"],
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] {
  border-left: 2px solid #3dd6a3;
}
body:not(.light-mode) .deck-object[data-has-fill="true"][data-accent-color="purple"],
[data-theme-mode="dark"] .deck-object[data-has-fill="true"][data-accent-color="purple"] {
  border-left-color: #a78bfa;
}
/* fact-tag: first strong = small uppercase label */
body:not(.light-mode) .deck-object[data-has-fill="true"] .obj-text-content strong:first-child,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .obj-text-content strong:first-child {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #3dd6a3;
  display: block;
  margin-bottom: 8px;
}
/* fact-val: body text = 14px / 300 weight */
body:not(.light-mode) .deck-object[data-has-fill="true"] .obj-text-content,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .obj-text-content {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 300;
  line-height: 1.5;
  color: #e8f0f8;
}
/* Inline bold in card body — teal highlight */
body:not(.light-mode) .deck-object[data-has-fill="true"] .obj-text-content strong,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .obj-text-content strong {
  color: #5ee8b5;
  font-weight: 500;
}
/* Stat card: transparent inner when parent has gradient fill */
body:not(.light-mode) .deck-object[data-has-fill="true"] .stat-card-inner,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .stat-card-inner {
  background: transparent;
  border-color: transparent;
}
/* Stat label stays --text-primary (#e8f0f8) per design system, even when
   parent card has its own fill. --text-secondary (#7a9bb5) is for stat-desc. */
body:not(.light-mode) .deck-object[data-has-fill="true"] .stat-label,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .stat-label {
  color: #e8f0f8;
}
body:not(.light-mode) .deck-object[data-has-fill="true"] .stat-desc,
[data-theme-mode="dark"] .deck-object[data-has-fill="true"] .stat-desc {
  color: #7a9bb5;
}

/* ════════════════════════════════════════════
   CLEAN LIGHT — Card overrides
   Scoped via [data-theme-mode="light"] or body.light-mode
════════════════════════════════════════════ */
/* Card text — DM Sans, body weight 300, heading navy */
body.light-mode .deck-object[data-has-fill="true"] .obj-text-content,
[data-theme-mode="light"] .deck-object[data-has-fill="true"] .obj-text-content {
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  color: #64748B;
  line-height: 1.6;
}
/* Card heading (first strong) — mono tag style: small uppercase teal */
body.light-mode .deck-object[data-has-fill="true"] .obj-text-content strong:first-child,
[data-theme-mode="light"] .deck-object[data-has-fill="true"] .obj-text-content strong:first-child {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #14A89F;
  display: block;
  margin-bottom: 8px;
}
/* Inline bold in card body — teal2 highlight */
body.light-mode .deck-object[data-has-fill="true"] .obj-text-content strong,
[data-theme-mode="light"] .deck-object[data-has-fill="true"] .obj-text-content strong {
  color: #14A89F;
  font-weight: 500;
}
/* Clean Light cards — overflow hidden, compact padding */
body.light-mode .deck-object[data-has-fill="true"],
[data-theme-mode="light"] .deck-object[data-has-fill="true"] {
  overflow: hidden;
}
body.light-mode .deck-object[data-object-type="text"][data-has-fill="true"][data-has-text-content="true"],
[data-theme-mode="light"] .deck-object[data-object-type="text"][data-has-fill="true"][data-has-text-content="true"],
body.light-mode .deck-object[data-object-type="text"][data-has-border="true"][data-has-text-content="true"],
[data-theme-mode="light"] .deck-object[data-object-type="text"][data-has-border="true"][data-has-text-content="true"] {
  padding: 14px 18px;
}
body.light-mode .deck-object[data-has-fill="true"]::before,
[data-theme-mode="light"] .deck-object[data-has-fill="true"]::before {
  display: none;
}
body.light-mode .deck-object[data-has-fill="true"]::after,
[data-theme-mode="light"] .deck-object[data-has-fill="true"]::after {
  display: none;
}
