/* =====================================================
   EduBuilder — Design System & Styles v2
   Palette: #249371 #166049 #124A38 #D2DE8C #3E9089 #92C03E
   ===================================================== */

/* ─── Design Tokens ────────────────────────────────── */
:root {
  /* Brand colors */
  --brand-50: #e8f5ee;
  --brand-100: #c5e6d4;
  --brand-200: #9dd4b8;
  --brand-300: #6ebf9a;
  --brand-400: #4aaf84;
  --brand-500: #249371;
  --brand-600: #166049;
  --brand-700: #124A38;
  --brand-800: #0d3729;
  --brand-900: #08231a;

  /* Accent */
  --accent-lime: #D2DE8C;
  --accent-teal: #3E9089;
  --accent-green: #92C03E;

  /* Neutrals (warm green-gray) */
  --neutral-0: #ffffff;
  --neutral-50: #f6f9f7;
  --neutral-100: #edf3ef;
  --neutral-200: #dae7de;
  --neutral-300: #c0d4c8;
  --neutral-400: #96b5a6;
  --neutral-500: #6d9280;
  --neutral-600: #4d6e5e;
  --neutral-700: #334d42;
  --neutral-800: #1f3028;
  --neutral-900: #111c16;

  /* Semantic */
  --color-text-primary: #1a2e25;
  --color-text-secondary: #4d6e5e;
  --color-text-muted: #8aab9e;
  --color-text-hint: #b0c9bf;
  --color-border: #e0ebe4;
  --color-border-light: #edf3ef;
  --color-surface: #ffffff;
  --color-canvas-bg: #e8eeeb;

  /* Danger */
  --color-danger: #e53e3e;
  --color-danger-light: #fff5f5;
  --color-danger-border: #fcd5d5;

  /* Warning */
  --color-warning: #d97706;
  --color-warning-light: #fffbeb;

  /* Info */
  --color-info: #3b82f6;
  --color-info-light: #eff6ff;

  /* Layout */
  --topbar-height: 52px;
  --left-panel-width: 248px;
  --right-panel-width: 272px;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.13);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.18);
  --shadow-canvas: 0 2px 24px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', 'Fira Code', monospace;

  /* Transitions */
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ─── Reset & Base ─────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--color-canvas-bg);
  user-select: none;
}

/* ─── Topbar ────────────────────────────────────────── */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--topbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-3);
  gap: var(--space-2);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.topbar-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-width: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

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

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

/* App Logo */
.app-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  flex-shrink: 0;
}

.app-logo-mark {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--brand-500), var(--accent-teal));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 2px 6px rgba(36, 147, 113, 0.35);
  flex-shrink: 0;
}

.app-logo-text {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.app-logo-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--brand-700);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.app-logo-sub {
  font-size: 8.5px;
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
}

/* Topbar buttons */
.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 5px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}

.tb-btn:hover {
  background: var(--neutral-100);
  color: var(--color-text-primary);
}

.tb-btn.icon-only {
  padding: 5px 8px;
}

.tb-btn i {
  font-size: 13px;
}

.tb-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.tb-btn.accent {
  background: var(--neutral-100);
  color: var(--brand-600);
  border: 1px solid var(--neutral-200);
}

.tb-btn.accent:hover {
  background: var(--brand-50);
  border-color: var(--brand-200);
}

.tb-btn.primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: white;
  box-shadow: 0 2px 6px rgba(36, 147, 113, 0.30);
}

.tb-btn.primary:hover {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  box-shadow: 0 3px 10px rgba(36, 147, 113, 0.40);
}

/* Viewport buttons */
.preview-viewport-group {
  background: var(--neutral-100);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 1px;
}

.viewport-btn {
  color: var(--color-text-muted);
  border-radius: 4px;
  padding: 4px 8px;
}

.viewport-btn.active {
  background: var(--color-surface);
  color: var(--brand-500);
  box-shadow: var(--shadow-sm);
}

.viewport-btn:hover:not(.active) {
  background: var(--neutral-0);
  color: var(--color-text-primary);
}

/* Project name */
.project-name-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 280px;
}

.project-name-icon {
  font-size: 11px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.project-name-input {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-primary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  outline: none;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  min-width: 120px;
  max-width: 240px;
  user-select: text;
  letter-spacing: -0.02em;
}

.project-name-input:hover {
  background: var(--neutral-100);
  border-color: var(--neutral-200);
}

.project-name-input:focus {
  background: var(--neutral-50);
  border-color: var(--brand-300);
  box-shadow: 0 0 0 3px rgba(36, 147, 113, 0.08);
}

/* Autosave indicator */
.autosave-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
  opacity: 0;
  transition: opacity var(--transition-slow);
}

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

.autosave-indicator.saving {
  color: var(--brand-500);
}

.autosave-indicator i {
  font-size: 11px;
}

/* ─── App Layout ────────────────────────────────────── */
#app-layout {
  display: flex;
  height: 100vh;
  padding-top: var(--topbar-height);
  padding-bottom: 22px;
  overflow: hidden;
}

/* ─── Left Panel ────────────────────────────────────── */
#left-panel {
  width: var(--left-panel-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--brand-900);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.panel-header {
  flex-shrink: 0;
  padding: var(--space-3) var(--space-3) var(--space-2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  color: rgba(255, 255, 255, 0.45);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

.panel-title i {
  font-size: 11px;
  color: var(--accent-lime);
  opacity: 0.8;
}

.search-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.25);
  font-size: 11px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 7px 28px 7px 28px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-sans);
  font-size: 12px;
  outline: none;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.search-input:focus {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(210, 222, 140, 0.30);
  box-shadow: 0 0 0 3px rgba(210, 222, 140, 0.08);
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  font-size: 11px;
  padding: 2px;
}

.search-clear:hover {
  color: rgba(255, 255, 255, 0.7);
}

/* Block library scroll */
.block-library-scroll {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) var(--space-2) var(--space-6);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.block-library-scroll::-webkit-scrollbar {
  width: 4px;
}

.block-library-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.block-library-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

/* Block category */
.block-category {
  margin-bottom: var(--space-2);
}

.block-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-2) var(--space-1);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.block-category-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.block-category-title {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.block-category-title i {
  font-size: 10px;
}

.block-category-toggle {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.25);
  transition: transform var(--transition-fast);
}

.block-category.collapsed .block-category-toggle {
  transform: rotate(-90deg);
}

.block-category.collapsed .block-category-items {
  display: none;
}

/* Block items */
.block-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-sm);
  cursor: grab;
  transition: background var(--transition-fast);
  border: 1px solid transparent;
}

.block-item:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.06);
}

.block-item:active {
  cursor: grabbing;
}

.block-item.dragging {
  opacity: 0.5;
}

.block-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent-lime);
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: background var(--transition-fast);
}

.block-item:hover .block-item-icon {
  background: rgba(210, 222, 140, 0.12);
  border-color: rgba(210, 222, 140, 0.15);
}

.block-item-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.80);
  line-height: 1.2;
}

.block-item-sub {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.30);
  margin-top: 1px;
  line-height: 1.2;
}

/* Panel footer */
.panel-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-3);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.22);
}

.panel-footer i {
  font-size: 11px;
}

.block-count-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.35);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 100px;
}

/* ─── Canvas Area ────────────────────────────────────── */
#canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-canvas-bg);
}

/* Canvas toolbar strip */
#canvas-toolbar {
  flex-shrink: 0;
  height: 38px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.canvas-toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.canvas-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
}

.canvas-info-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-500);
}

.canvas-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--color-text-muted);
}

.canvas-sep {
  color: var(--color-text-hint);
  font-size: 11px;
}

.canvas-block-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
}

.canvas-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 11px;
  color: var(--color-text-muted);
}

.canvas-breadcrumb .bc-sep {
  color: var(--color-text-hint);
}

.canvas-breadcrumb .bc-item {
  font-weight: 600;
  color: var(--brand-600);
}

.canvas-action-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  font-size: 11px;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.canvas-action-btn:hover {
  background: var(--neutral-100);
  color: var(--color-text-primary);
}

.canvas-action-btn.active {
  background: var(--brand-50);
  color: var(--brand-500);
}

/* Canvas scroll */
#canvas-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-8) var(--space-6);
  scrollbar-width: thin;
  scrollbar-color: var(--neutral-300) transparent;
}

#canvas-scroll::-webkit-scrollbar {
  width: 6px;
}

#canvas-scroll::-webkit-scrollbar-track {
  background: transparent;
}

#canvas-scroll::-webkit-scrollbar-thumb {
  background: var(--neutral-300);
  border-radius: 4px;
}

#canvas-scroll.show-grid {
  background-image: radial-gradient(circle, var(--neutral-300) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* Canvas wrapper */
#canvas-wrapper {
  margin: 0 auto;
  background: var(--color-surface);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow-canvas);
  transition: max-width var(--transition-slow);
  max-width: 960px;
  min-height: 400px;
}

#canvas-wrapper.vp-tablet {
  max-width: 768px;
}

#canvas-wrapper.vp-mobile {
  max-width: 390px;
}

#canvas-wrapper.full-width {
  max-width: 100%;
}

/* Empty state */
#canvas-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px var(--space-8) 100px;
  pointer-events: none;
}

#canvas-empty.hidden {
  display: none;
}

.empty-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: rgba(36, 147, 113, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-5);
}

.empty-icon {
  font-size: 26px;
  color: var(--brand-500);
  opacity: 0.5;
}

.empty-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--brand-700);
  margin-bottom: var(--space-2);
  letter-spacing: -0.02em;
}

.empty-sub {
  font-size: 13px;
  color: var(--color-text-muted);
  text-align: center;
  line-height: 1.6;
  margin-bottom: var(--space-5);
}

.empty-hints {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  justify-content: center;
}

.empty-hint-chip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: rgba(36, 147, 113, 0.08);
  color: var(--brand-600);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}

.empty-cta {
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(36, 147, 113, 0.35);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.empty-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(36, 147, 113, 0.45);
}

/* ─── Canvas Blocks ──────────────────────────────────── */
.canvas-block {
  position: relative;
  cursor: pointer;
  outline: none;
}

.canvas-block:hover>.block-controls {
  opacity: 1;
}

.canvas-block.selected>.block-controls {
  opacity: 1;
}

/* Selection ring */
.canvas-block.selected::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--brand-500);
  pointer-events: none;
  z-index: 10;
}

.canvas-block:hover:not(.selected)::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px dashed rgba(36, 147, 113, 0.35);
  pointer-events: none;
  z-index: 10;
}

/* Block controls (floating toolbar) */
.block-controls {
  position: absolute;
  top: -34px;
  right: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--brand-700);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 4px 6px;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 20;
  pointer-events: none;
}

.canvas-block.selected>.block-controls,
.canvas-block:hover>.block-controls {
  pointer-events: all;
}

.block-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  padding: 0 var(--space-2);
  max-width: 100px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.block-ctrl-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.60);
  border-radius: 4px;
  font-size: 11px;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.block-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.block-ctrl-btn.danger:hover {
  background: rgba(229, 62, 62, 0.25);
  color: #fc8181;
}

.block-ctrl-btn-sep {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 2px;
}

/* Drag handle */
.block-drag-handle {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: grab;
  color: rgba(255, 255, 255, 0.40);
  border-radius: 4px;
  font-size: 11px;
  transition: color var(--transition-fast);
}

.block-drag-handle:hover {
  color: rgba(255, 255, 255, 0.80);
}

.block-drag-handle:active {
  cursor: grabbing;
}

/* Drag states */
.canvas-block.is-dragging {
  opacity: 0.3;
}

.canvas-block.drag-over-before::before {
  content: '';
  position: absolute;
  top: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--brand-500);
  border-radius: 2px;
  z-index: 30;
  box-shadow: 0 0 8px rgba(36, 147, 113, 0.6);
}

.canvas-block.drag-over-after::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--brand-500);
  border-radius: 2px;
  z-index: 30;
  box-shadow: 0 0 8px rgba(36, 147, 113, 0.6);
}

/* Insert indicator between blocks */
.insert-indicator {
  height: 3px;
  margin: 0;
  background: var(--brand-500);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(36, 147, 113, 0.6);
  display: none;
}

.insert-indicator.visible {
  display: block;
}

/* Drop zone for containers */
.drop-zone-area {
  min-height: 64px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), border-color var(--transition-fast);
  border: 2px dashed transparent;
}

.drop-zone-area.drop-zone-hover {
  background: rgba(36, 147, 113, 0.06);
  border-color: rgba(36, 147, 113, 0.35);
}

.drop-zone-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  gap: var(--space-2);
  color: var(--color-text-hint);
  font-size: 12px;
  padding: var(--space-4);
}

.drop-zone-placeholder i {
  font-size: 18px;
  opacity: 0.4;
}

/* Inline editing */
[data-editable] {
  transition: outline var(--transition-fast);
}

[data-editable].editable-hover {
  outline: 1px dashed rgba(36, 147, 113, 0.4);
  cursor: text;
}

[data-editable][contenteditable="true"] {
  outline: 2px solid var(--brand-500);
  border-radius: 2px;
  cursor: text;
}

/* Inline toolbar */
.inline-toolbar {
  position: fixed;
  z-index: 9999;
  background: var(--brand-800);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 2px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.inline-toolbar button {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.65);
  border-radius: 4px;
  font-size: 12px;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.inline-toolbar button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.inline-toolbar-sep {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.10);
  margin: 0 2px;
}

/* Container blocks */
.canvas-block-container {
  background: var(--neutral-50);
}

/* ─── Right Panel ────────────────────────────────────── */
#right-panel {
  width: var(--right-panel-width);
  flex-shrink: 0;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Props empty state */
.props-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  text-align: center;
}

.props-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--neutral-50);
  border: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  color: var(--color-text-hint);
  font-size: 20px;
}

.props-empty-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
}

.props-empty-sub {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

.props-shortcuts {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--neutral-50);
  border: 1px solid var(--color-border-light);
}

.shortcut-item span {
  font-size: 11px;
  color: var(--color-text-muted);
}

kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  background: var(--neutral-100);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

/* Props panel */
#props-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.props-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3);
  background: var(--neutral-50);
  border-bottom: 1px solid var(--color-border-light);
}

.props-header-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.props-block-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(36, 147, 113, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-500);
  font-size: 13px;
  flex-shrink: 0;
}

.props-block-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.props-block-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.props-block-type {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.props-close-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-hint);
  border-radius: 4px;
  font-size: 11px;
  transition: background var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}

.props-close-btn:hover {
  background: var(--neutral-100);
  color: var(--color-text-primary);
}

/* Quick actions */
.props-quick-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border-light);
  background: var(--neutral-50);
}

.qa-btn {
  flex: 1;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 12px;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.qa-btn:hover {
  background: var(--neutral-100);
  border-color: var(--neutral-300);
  color: var(--color-text-primary);
}

.qa-btn.danger {
  color: var(--color-danger);
}

.qa-btn.danger:hover {
  background: var(--color-danger-light);
  border-color: var(--color-danger-border);
}

/* Props tabs */
.props-tabs {
  flex-shrink: 0;
  display: flex;
  border-bottom: 1px solid var(--color-border-light);
}

.props-tab {
  flex: 1;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.props-tab i {
  font-size: 11px;
}

.props-tab:hover {
  color: var(--color-text-primary);
}

.props-tab.active {
  color: var(--brand-600);
  border-bottom-color: var(--brand-500);
}

/* Props body */
.props-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3);
  user-select: text;
  scrollbar-width: thin;
  scrollbar-color: var(--neutral-200) transparent;
}

.props-body::-webkit-scrollbar {
  width: 4px;
}

.props-body::-webkit-scrollbar-track {
  background: transparent;
}

.props-body::-webkit-scrollbar-thumb {
  background: var(--neutral-200);
  border-radius: 4px;
}

/* Prop groups (accordions) */
.prop-group {
  margin-bottom: var(--space-2);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.prop-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  background: var(--neutral-50);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.prop-group-header:hover {
  background: var(--neutral-100);
}

.prop-group-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.prop-group-title i {
  font-size: 10px;
  color: var(--brand-500);
}

.prop-group-toggle {
  font-size: 10px;
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
}

.prop-group.collapsed .prop-group-toggle {
  transform: rotate(-90deg);
}

.prop-group.collapsed .prop-group-body {
  display: none;
}

.prop-group-body {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Individual prop field */
.prop-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.prop-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: -0.01em;
}

/* Form controls */
.prop-input {
  width: 100%;
  padding: 6px 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--color-text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.prop-input:focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px rgba(36, 147, 113, 0.10);
}

.prop-input::placeholder {
  color: var(--color-text-hint);
}

.prop-textarea {
  min-height: 72px;
  resize: vertical;
  line-height: 1.5;
}

.prop-select {
  width: 100%;
  padding: 6px 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--color-text-primary);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.prop-select:focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px rgba(36, 147, 113, 0.10);
}

/* Range slider */
.prop-range-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.prop-range {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  background: var(--neutral-200);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.prop-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brand-500);
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.prop-range:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(36, 147, 113, 0.20);
}

.prop-range-val {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-secondary);
  min-width: 28px;
  text-align: right;
}

/* Color picker */
.prop-color-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.prop-color-swatch {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.prop-color-swatch input[type="color"] {
  position: absolute;
  inset: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  border: none;
  background: none;
  cursor: pointer;
  opacity: 0;
}

.prop-color-swatch-preview {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

/* Toggle/checkbox */
.prop-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.prop-toggle {
  position: relative;
  width: 34px;
  height: 20px;
  flex-shrink: 0;
}

.prop-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.prop-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--neutral-200);
  border-radius: 20px;
  transition: background var(--transition-base);
}

.prop-toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  bottom: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base);
}

.prop-toggle input:checked+.prop-toggle-slider {
  background: var(--brand-500);
}

.prop-toggle input:checked+.prop-toggle-slider::before {
  transform: translateX(14px);
}

/* Rich text editor in panel */
.prop-richtext-wrapper {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.prop-richtext-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  padding: 4px 6px;
  background: var(--neutral-50);
  border-bottom: 1px solid var(--color-border-light);
}

.prop-richtext-toolbar button {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-secondary);
  border-radius: 4px;
  font-size: 11px;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.prop-richtext-toolbar button:hover {
  background: var(--neutral-200);
  color: var(--color-text-primary);
}

.toolbar-sep {
  width: 1px;
  height: 14px;
  background: var(--color-border);
  margin: 0 2px;
}

.prop-richtext-editor {
  padding: var(--space-3);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-text-primary);
  min-height: 80px;
  outline: none;
}

.prop-richtext-editor:focus {
  box-shadow: 0 0 0 2px var(--brand-500) inset;
}

/* List editor */
.prop-list-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.prop-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.prop-list-drag {
  color: var(--color-text-hint);
  font-size: 13px;
  cursor: grab;
  flex-shrink: 0;
  user-select: none;
  line-height: 1;
}

.prop-list-input {
  flex: 1;
}

.prop-list-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: none;
  cursor: pointer;
  font-size: 11px;
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.prop-list-btn.delete:hover {
  background: var(--color-danger-light);
  border-color: var(--color-danger-border);
  color: var(--color-danger);
}

.prop-list-add {
  width: 100%;
  padding: var(--space-2);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-600);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.prop-list-add:hover {
  background: var(--brand-50);
  border-color: var(--brand-300);
}

/* Key-value editor */
.prop-keyvalue-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.prop-keyvalue-item {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  background: var(--neutral-50);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.prop-keyvalue-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.prop-keyvalue-key {
  flex: 1;
}

.prop-keyvalue-value {
  width: 100%;
  min-height: 48px;
  resize: vertical;
}

/* Table editor */
.prop-table-wrapper {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.prop-table-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--neutral-50);
  border-bottom: 1px solid var(--color-border-light);
}

.prop-table-toolbar button {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 8px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-surface);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.prop-table-toolbar button:hover {
  background: var(--neutral-100);
}

.prop-table-container {
  overflow-x: auto;
}

.prop-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.prop-table th,
.prop-table td {
  border: 1px solid var(--color-border-light);
  padding: var(--space-1) var(--space-2);
}

.prop-table th {
  background: var(--neutral-50);
}

.prop-table-header-input,
.prop-table-cell-input {
  width: 100%;
  border: none;
  background: none;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--color-text-primary);
  outline: none;
}

.prop-table-actions {
  width: 28px;
  text-align: center;
}

.prop-table-btn-delete {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-hint);
  font-size: 11px;
  transition: color var(--transition-fast);
}

.prop-table-btn-delete:hover {
  color: var(--color-danger);
}

/* Icon picker */
.prop-icon-current {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--neutral-50);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
  font-size: 12px;
  color: var(--color-text-secondary);
}

.prop-icon-search {
  position: relative;
  margin-bottom: var(--space-2);
}

.prop-icon-input {
  width: 100%;
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 12px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.prop-icon-input:focus {
  border-color: var(--brand-400);
}

.prop-icon-grid {
  max-height: 180px;
  overflow-y: auto;
}

.prop-icon-category {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  padding: var(--space-2) 0 var(--space-1);
}

.prop-icon-items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.prop-icon-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  cursor: pointer;
  font-size: 12px;
  color: var(--color-text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.prop-icon-btn:hover {
  background: var(--brand-50);
  color: var(--brand-600);
  border-color: var(--brand-200);
}

.prop-icon-btn.active {
  background: var(--brand-500);
  color: white;
  border-color: var(--brand-500);
}

/* ─── Context Menu ───────────────────────────────────── */
.context-menu {
  position: fixed;
  z-index: 9990;
  background: var(--brand-800);
  border-radius: var(--radius-md);
  padding: var(--space-1);
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 180px;
}

.ctx-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.ctx-item i {
  font-size: 12px;
  width: 14px;
  text-align: center;
}

.ctx-item kbd {
  margin-left: auto;
  font-size: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.40);
  padding: 1px 5px;
  border-radius: 3px;
}

.ctx-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.95);
}

.ctx-item.danger {
  color: #fc8181;
}

.ctx-item.danger:hover {
  background: rgba(229, 62, 62, 0.15);
  color: #feb2b2;
}

.ctx-sep {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: var(--space-1);
}

/* ─── Modals ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border-light);
  max-height: 90vh;
  width: 100%;
}

.modal-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-border-light);
  background: var(--neutral-50);
}

.modal-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.modal-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.modal-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

.modal-icon-wrap {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(36, 147, 113, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-500);
  font-size: 14px;
}

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-muted);
  border-radius: 6px;
  font-size: 13px;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.modal-close:hover {
  background: var(--neutral-100);
  color: var(--color-text-primary);
}

/* Traffic lights */
.modal-traffic-lights {
  display: flex;
  gap: var(--space-2);
  margin-right: var(--space-2);
}

.tl {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.tl.red {
  background: #ef4444;
  cursor: pointer;
}

.tl.yellow {
  background: #f59e0b;
}

.tl.green {
  background: #22c55e;
}

/* Preview modal */
.modal-preview-box {
  max-width: 1100px;
  height: 88vh;
}

.modal-preview-stage {
  flex: 1;
  display: flex;
  align-items: stretch;
  background: var(--color-canvas-bg);
  overflow: hidden;
  padding: var(--space-4);
}

#preview-frame {
  flex: 1;
  border: none;
  background: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-canvas);
  transition: max-width var(--transition-slow);
  margin: 0 auto;
}

.modal-viewport-btns {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--neutral-100);
  border-radius: var(--radius-sm);
}

.mv-btn {
  width: 28px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-muted);
  border-radius: 4px;
  font-size: 12px;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.mv-btn:hover {
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.mv-btn.active {
  background: var(--color-surface);
  color: var(--brand-500);
  box-shadow: var(--shadow-sm);
}

/* Code modal */
.modal-code-box {
  max-width: 920px;
  height: 82vh;
}

.code-output-wrap {
  flex: 1;
  overflow: auto;
  background: var(--brand-900);
  padding: var(--space-5);
}

#code-output {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: rgba(210, 222, 140, 0.85);
  white-space: pre;
  user-select: text;
}

/* Small modal */
.modal-sm {
  max-width: 380px;
  padding: var(--space-6);
  text-align: center;
  border-radius: var(--radius-xl);
}

.confirm-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin: 0 auto var(--space-4);
}

.confirm-icon-wrap.warning {
  background: #fffbeb;
  color: var(--color-warning);
}

.confirm-icon-wrap.danger {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.confirm-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
  letter-spacing: -0.02em;
}

.confirm-sub {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: var(--space-3);
}

.btn-secondary {
  flex: 1;
  padding: 10px var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--neutral-100);
}

.btn-primary {
  flex: 1;
  padding: 10px var(--space-4);
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(36, 147, 113, 0.30);
  transition: box-shadow var(--transition-fast);
}

.btn-primary:hover {
  box-shadow: 0 5px 16px rgba(36, 147, 113, 0.40);
}

/* Template modal */
.modal-templates-box {
  max-width: 720px;
  max-height: 80vh;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  padding: var(--space-5);
  overflow-y: auto;
}

.template-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.template-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-300);
  box-shadow: var(--shadow-md);
}

.template-thumb {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.template-info {
  padding: var(--space-3);
  border-top: 1px solid var(--color-border-light);
}

.template-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 2px;
}

.template-desc {
  font-size: 11px;
  color: var(--color-text-muted);
}

/* ─── Toast ───────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  pointer-events: none;
}

.toast-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-5);
  border-radius: var(--radius-md);
  background: var(--brand-800);
  color: white;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transform: translateY(10px);
  opacity: 0;
  transition: transform var(--transition-base), opacity var(--transition-base);
}

.toast-item.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-item.success i {
  color: var(--accent-lime);
}

.toast-item.error {
  background: #7f1d1d;
}

.toast-item.error i {
  color: #fca5a5;
}

.toast-item.info i {
  color: #93c5fd;
}

.toast-item i {
  font-size: 13px;
  flex-shrink: 0;
}

/* ─── Utility ─────────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* Scrollbars global */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--neutral-200) transparent;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--neutral-200);
  border-radius: 4px;
}

/* Focus ring for accessibility */
:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}