/* EdenCode — WASM Editor + Test Runner */
.ec-ide {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  background: #1e1e2e;
  color: #cdd6f4;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  overflow: hidden;
}

/* ── Toolbar ── */
.ec-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 36px;
  min-height: 36px;
  background: #181825;
  border-bottom: 1px solid #313244;
}
.ec-project-name {
  font-weight: 600;
  color: #cba6f7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.ec-save-indicator {
  font-size: 16px;
  color: #a6e3a1;
}
.ec-save-indicator.dirty {
  color: #fab387;
}
.ec-toolbar-spacer { flex: 1; }
.ec-wrap-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  color: #cdd6f4; font-size: 12px; user-select: none; cursor: pointer;
  padding: 4px 8px; border: 1px solid #45475a; border-radius: 4px; background: #313244;
}
.ec-wrap-toggle:hover { background: #3b3d52; }
.ec-wrap-toggle input { margin: 0; cursor: pointer; }

.ec-btn {
  background: #313244;
  color: #cdd6f4;
  border: 1px solid #45475a;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}
.ec-btn:hover { background: #45475a; }
.ec-btn-test {
  background: #1e4620;
  border-color: #2d6a30;
  color: #a6e3a1;
}
.ec-btn-test:hover {
  background: #2d6a30;
}
.ec-btn-sm {
  background: none;
  color: #a6adc8;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 14px;
  border-radius: 3px;
}
.ec-btn-sm:hover { background: #313244; color: #cdd6f4; }

/* ── Layout ── */
.ec-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Splitter : poignée de redimensionnement entre panes */
.ec-splitter {
  flex-shrink: 0; background: transparent; position: relative; z-index: 2;
  transition: background 0.15s;
}
.ec-splitter::after {
  content: ''; position: absolute; background: #45475a; transition: background 0.15s;
}
.ec-splitter:hover::after, .ec-splitter:active::after { background: #89b4fa; }
.ec-splitter-v { width: 4px; cursor: ew-resize; }
.ec-splitter-v::after { inset: 0 1px; }
.ec-splitter-h { height: 4px; cursor: ns-resize; }
.ec-splitter-h::after { inset: 1px 0; }
body.ec-resizing-x { cursor: ew-resize !important; user-select: none; }
body.ec-resizing-y { cursor: ns-resize !important; user-select: none; }
body.ec-resizing-x *, body.ec-resizing-y * { pointer-events: none; }
.ec-splitter { pointer-events: auto !important; }

/* Collapse button — bouton commun aux en-têtes de panes */
.ec-collapse-btn { font-size: 10px !important; padding: 2px 6px !important; min-width: 22px; }

/* Pane file-tree repliée : bande verticale 28px avec uniquement le bouton */
.ec-file-tree.collapsed { width: 28px !important; min-width: 28px !important; transition: width 0.15s ease; }
.ec-file-tree.collapsed .ec-tree-header { padding: 8px 2px; border-bottom: none; justify-content: center; }
.ec-file-tree.collapsed .ec-pane-label,
.ec-file-tree.collapsed #ec-new-file,
.ec-file-tree.collapsed .ec-tree-content { display: none; }
.ec-file-tree.collapsed + .ec-splitter-v { display: none; }

/* Pane preview repliée : même principe côté droit */
.ec-preview.collapsed { width: 28px !important; min-width: 28px !important; max-width: 28px !important; transition: width 0.15s ease; }
.ec-preview.collapsed .ec-preview-toolbar { padding: 8px 2px; justify-content: center; border-bottom: none; }
.ec-preview.collapsed .ec-pane-label,
.ec-preview.collapsed #ec-refresh-preview,
.ec-preview.collapsed #ec-device-select,
.ec-preview.collapsed #ec-toggle-orientation,
.ec-preview.collapsed #ec-sim-geo,
.ec-preview.collapsed #ec-sim-shake,
.ec-preview.collapsed iframe,
.ec-preview.collapsed .ec-phonesim-host,
.ec-preview.collapsed .ec-console-panel,
.ec-preview.collapsed .ec-splitter-h { display: none; }
.ec-preview.collapsed + * .ec-splitter-v,
.ec-layout > .ec-splitter-v:has(+ .ec-preview.collapsed) { display: none; }

.ec-file-tree, .ec-preview { transition: width 0.15s ease; }

/* ── File tree ── */
.ec-file-tree {
  width: 220px;
  min-width: 160px;
  max-width: 400px;
  background: #11111b;
  border-right: 1px solid #313244;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ec-tree-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #a6adc8;
  border-bottom: 1px solid #313244;
}
.ec-tree-content {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.ec-tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
  color: #bac2de;
}
.ec-tree-item:hover {
  background: #1e1e2e;
}
.ec-tree-item.active {
  background: #313244;
  color: #cdd6f4;
}
.ec-tree-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.ec-tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* ── Hover action buttons on tree items ── */
.ec-tree-action {
  opacity: 0;
  background: #2d6a30;
  color: #a6e3a1;
  border: none;
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
  transition: opacity 0.1s;
  line-height: 1.4;
}
.ec-tree-item:hover .ec-tree-action {
  opacity: 1;
}
.ec-tree-action:hover {
  background: #3d8a40;
}
.ec-tree-more {
  background: none;
  color: #6c7086;
  font-size: 16px;
  padding: 0 4px;
  line-height: 1;
  letter-spacing: 1px;
}
.ec-tree-more:hover {
  background: #45475a;
  color: #cdd6f4;
}
.ec-ide.ec-light .ec-tree-more {
  color: #9ca0b0;
}
.ec-ide.ec-light .ec-tree-more:hover {
  background: #bcc0cc;
  color: #4c4f69;
}

/* ── Center (tabs + editor) ── */
.ec-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Tabs ── */
.ec-tab-bar {
  display: flex;
  background: #181825;
  border-bottom: 1px solid #313244;
  min-height: 32px;
  overflow-x: auto;
  flex-shrink: 0;
}
.ec-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 32px;
  cursor: pointer;
  border-right: 1px solid #313244;
  color: #6c7086;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ec-tab:hover { color: #bac2de; background: #1e1e2e; }
.ec-tab.active {
  color: #cdd6f4;
  background: #1e1e2e;
  border-bottom: 2px solid #cba6f7;
}
.ec-tab-close {
  font-size: 14px;
  opacity: 0.5;
  padding: 0 2px;
  border-radius: 3px;
}
.ec-tab-close:hover { opacity: 1; background: #45475a; }

/* ── Editor canvas ── */
.ec-editor-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #1e1e2e;
}
.ec-editor-wrap canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
}
.ec-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #585b70;
  font-size: 15px;
  pointer-events: none;
}

/* ── Inline file menu ── */
.ec-tree-more-wrap {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}
.ec-inline-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 50;
  background: #313244;
  border: 1px solid #45475a;
  border-radius: 4px;
  padding: 2px 0;
  min-width: 120px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
}
.ec-inline-menu[hidden] { display: none; }
.ec-inline-menu button {
  display: block;
  width: 100%;
  padding: 5px 12px;
  background: none;
  border: none;
  color: #cdd6f4;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.ec-inline-menu button:hover {
  background: #45475a;
}
.ec-ide.ec-light .ec-inline-menu {
  background: #e6e9ef;
  border-color: #bcc0cc;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.ec-ide.ec-light .ec-inline-menu button {
  color: #4c4f69;
}
.ec-ide.ec-light .ec-inline-menu button:hover {
  background: #ccd0da;
}

/* ── Auto-completion dropdown ── */
.ec-autocomplete {
  position: absolute;
  z-index: 50;
  background: #313244;
  border: 1px solid #45475a;
  border-radius: 4px;
  padding: 2px 0;
  min-width: 150px;
  max-width: 300px;
  max-height: 180px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 13px;
}
.ec-ac-item {
  padding: 4px 10px;
  cursor: pointer;
  color: #cdd6f4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ec-ac-item:hover {
  background: #45475a;
}
.ec-ac-item.selected {
  background: #585b70;
  color: #f5e0dc;
}
.ec-ide.ec-light .ec-autocomplete {
  background: #e6e9ef;
  border-color: #bcc0cc;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.ec-ide.ec-light .ec-ac-item {
  color: #4c4f69;
}
.ec-ide.ec-light .ec-ac-item:hover {
  background: #ccd0da;
}
.ec-ide.ec-light .ec-ac-item.selected {
  background: #bcc0cc;
  color: #4c4f69;
}

/* ── Search bar ── */
.ec-search-bar {
  position: absolute;
  top: 0;
  right: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  background: #313244;
  border: 1px solid #45475a;
  border-top: none;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.ec-search-row,
.ec-replace-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ec-search-bar input {
  background: #1e1e2e;
  color: #cdd6f4;
  border: 1px solid #45475a;
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 13px;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  width: 200px;
  outline: none;
}
.ec-search-bar input:focus {
  border-color: #cba6f7;
}
.ec-search-count {
  font-size: 11px;
  color: #a6adc8;
  min-width: 40px;
  text-align: center;
  white-space: nowrap;
}
.ec-search-count.no-results {
  color: #f38ba8;
}

/* ── Preview ── */
.ec-preview {
  width: 40%;
  min-width: 200px;
  max-width: 800px;
  border-left: 1px solid #313244;
  display: flex;
  flex-direction: column;
  background: #11111b;
}
.ec-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #a6adc8;
  border-bottom: 1px solid #313244;
}
.ec-preview iframe {
  flex: 1;
  border: none;
  background: #fff;
}

/* ── Console panel ── */
.ec-console-panel {
  display: flex;
  flex-direction: column;
  height: 180px;
  min-height: 32px;
  border-top: 1px solid #313244;
  background: #11111b;
  transition: height 0.15s ease;
}
.ec-console-panel.collapsed {
  height: 32px;
}
.ec-console-panel.collapsed .ec-console-logs {
  display: none;
}
.ec-console-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #a6adc8;
  border-bottom: 1px solid #313244;
  flex-shrink: 0;
  cursor: default;
  user-select: none;
}
.ec-console-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
  min-width: 0;
}
.ec-console-badge:empty {
  display: none;
}
.ec-console-badge.error {
  background: #f38ba8;
  color: #11111b;
}
.ec-console-badge.warn {
  background: #fab387;
  color: #11111b;
}
.ec-console-logs {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.5;
}
.ec-console-entry {
  display: flex;
  gap: 8px;
  padding: 2px 12px;
  border-bottom: 1px solid #181825;
  align-items: flex-start;
  word-break: break-word;
}
.ec-console-entry:hover {
  background: #1e1e2e;
}
.ec-console-time {
  color: #585b70;
  flex-shrink: 0;
  font-size: 11px;
}
.ec-console-text {
  color: #cdd6f4;
  white-space: pre-wrap;
}
.ec-console-log .ec-console-text {
  color: #cdd6f4;
}
.ec-console-info .ec-console-text {
  color: #89b4fa;
}
.ec-console-warn {
  background: rgba(250, 179, 135, 0.05);
}
.ec-console-warn .ec-console-text {
  color: #fab387;
}
.ec-console-error {
  background: rgba(243, 139, 168, 0.08);
}
.ec-console-error .ec-console-text {
  color: #f38ba8;
}

/* ── Scrollbar ── */
.ec-tree-content::-webkit-scrollbar,
.ec-tab-bar::-webkit-scrollbar,
.ec-console-logs::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.ec-tree-content::-webkit-scrollbar-track,
.ec-tab-bar::-webkit-scrollbar-track,
.ec-console-logs::-webkit-scrollbar-track {
  background: transparent;
}
.ec-tree-content::-webkit-scrollbar-thumb,
.ec-tab-bar::-webkit-scrollbar-thumb,
.ec-console-logs::-webkit-scrollbar-thumb {
  background: #45475a;
  border-radius: 3px;
}

/* ══════════════════════════════════════════════════════════════ */
/*  LIGHT THEME — Catppuccin Latte                               */
/* ══════════════════════════════════════════════════════════════ */

.ec-ide.ec-light {
  background: #eff1f5;
  color: #4c4f69;
}
.ec-ide.ec-light .ec-toolbar {
  background: #e6e9ef;
  border-color: #ccd0da;
}
.ec-ide.ec-light .ec-project-name {
  color: #8839ef;
}
.ec-ide.ec-light .ec-save-indicator {
  color: #40a02b;
}
.ec-ide.ec-light .ec-save-indicator.dirty {
  color: #fe640b;
}
.ec-ide.ec-light .ec-btn {
  background: #ccd0da;
  color: #4c4f69;
  border-color: #bcc0cc;
}
.ec-ide.ec-light .ec-btn:hover {
  background: #bcc0cc;
}
.ec-ide.ec-light .ec-btn-test {
  background: #d4edda;
  border-color: #40a02b;
  color: #40a02b;
}
.ec-ide.ec-light .ec-btn-sm {
  color: #6c6f85;
}
.ec-ide.ec-light .ec-btn-sm:hover {
  background: #ccd0da;
  color: #4c4f69;
}

/* File tree */
.ec-ide.ec-light .ec-file-tree {
  background: #e6e9ef;
  border-color: #ccd0da;
}
.ec-ide.ec-light .ec-tree-header {
  color: #6c6f85;
  border-color: #ccd0da;
}
.ec-ide.ec-light .ec-tree-item {
  color: #5c5f77;
}
.ec-ide.ec-light .ec-tree-item:hover {
  background: #dce0e8;
}
.ec-ide.ec-light .ec-tree-item.active {
  background: #ccd0da;
  color: #4c4f69;
}

/* Tabs */
.ec-ide.ec-light .ec-tab-bar {
  background: #e6e9ef;
  border-color: #ccd0da;
}
.ec-ide.ec-light .ec-tab {
  color: #9ca0b0;
  border-color: #ccd0da;
}
.ec-ide.ec-light .ec-tab:hover {
  color: #5c5f77;
  background: #eff1f5;
}
.ec-ide.ec-light .ec-tab.active {
  color: #4c4f69;
  background: #eff1f5;
  border-bottom-color: #8839ef;
}
.ec-ide.ec-light .ec-tab-close:hover {
  background: #bcc0cc;
}

/* Editor */
.ec-ide.ec-light .ec-editor-wrap {
  background: #eff1f5;
}

/* Search bar */
.ec-ide.ec-light .ec-search-bar {
  background: #ccd0da;
  border-color: #bcc0cc;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.ec-ide.ec-light .ec-search-bar input {
  background: #eff1f5;
  color: #4c4f69;
  border-color: #bcc0cc;
}
.ec-ide.ec-light .ec-search-bar input:focus {
  border-color: #8839ef;
}
.ec-ide.ec-light .ec-search-count {
  color: #6c6f85;
}
.ec-ide.ec-light .ec-search-count.no-results {
  color: #d20f39;
}

/* Preview */
.ec-ide.ec-light .ec-preview {
  background: #e6e9ef;
  border-color: #ccd0da;
}
.ec-ide.ec-light .ec-preview-toolbar {
  color: #6c6f85;
  border-color: #ccd0da;
}

/* Console */
.ec-ide.ec-light .ec-console-panel {
  background: #e6e9ef;
  border-color: #ccd0da;
}
.ec-ide.ec-light .ec-console-toolbar {
  color: #6c6f85;
  border-color: #ccd0da;
}
.ec-ide.ec-light .ec-console-entry {
  border-color: #dce0e8;
}
.ec-ide.ec-light .ec-console-entry:hover {
  background: #dce0e8;
}
.ec-ide.ec-light .ec-console-log .ec-console-text {
  color: #4c4f69;
}
.ec-ide.ec-light .ec-console-info .ec-console-text {
  color: #1e66f5;
}
.ec-ide.ec-light .ec-console-warn {
  background: rgba(223, 142, 29, 0.08);
}
.ec-ide.ec-light .ec-console-warn .ec-console-text {
  color: #df8e1d;
}
.ec-ide.ec-light .ec-console-error {
  background: rgba(210, 15, 57, 0.08);
}
.ec-ide.ec-light .ec-console-error .ec-console-text {
  color: #d20f39;
}
.ec-ide.ec-light .ec-console-time {
  color: #9ca0b0;
}

/* Scrollbar light */
.ec-ide.ec-light .ec-tree-content::-webkit-scrollbar-thumb,
.ec-ide.ec-light .ec-tab-bar::-webkit-scrollbar-thumb,
.ec-ide.ec-light .ec-console-logs::-webkit-scrollbar-thumb {
  background: #bcc0cc;
}

/* ═══ Mobile polish (Eden Vanilla v2) ═══ */
@media (max-width: 640px) {
  .ec-layout { flex-direction: column; }
  .ec-file-tree {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    max-height: 180px;
    border-right: none !important;
    border-bottom: 1px solid var(--border-color, #333);
    flex-shrink: 0;
  }
  .ec-center { min-height: 240px; flex: 1; }
  .ec-toolbar { flex-wrap: wrap; gap: 4px !important; padding: 6px 8px !important; }
  .ec-project-name { max-width: 120px; font-size: 12px !important; }
  .ec-btn { padding: 5px 8px !important; font-size: 12px !important; }
  .ec-tab { font-size: 12px !important; padding: 4px 10px !important; }
  .ec-console-panel { max-height: 30vh !important; }
}

/* Avoid iOS zoom on focus */
@media (max-width: 480px) {
  .ec-ide input, .ec-ide textarea, .ec-ide select { font-size: 16px !important; }
}

/* ═══ Mobile contextual nav (Eden Vanilla v2) ═══ */
.ec-mobile-nav { display: none; }

@media (max-width: 640px) {
  .ec-ide { display: flex; flex-direction: column; height: 100%; }
  .ec-layout { flex: 1; min-height: 0; flex-direction: column !important; }

  /* Hide panes by default when mobile-pane attribute is set */
  .ec-ide[data-mobile-pane] .ec-file-tree,
  .ec-ide[data-mobile-pane] .ec-center,
  .ec-ide[data-mobile-pane] .ec-preview {
    display: none !important;
  }
  /* Show active pane */
  .ec-ide[data-mobile-pane="files"] .ec-file-tree {
    display: flex !important;
    flex: 1;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    max-height: none !important;
    border: none !important;
  }
  .ec-ide[data-mobile-pane="code"] .ec-center {
    display: flex !important;
    flex: 1;
    min-height: 0;
  }
  .ec-ide[data-mobile-pane="preview"] .ec-preview {
    display: flex !important;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    border-left: none !important;
  }

  /* Mobile nav */
  .ec-mobile-nav {
    display: flex !important;
    flex-shrink: 0;
    height: 52px;
    background: var(--bg-primary, #0f0f14);
    border-top: 1px solid var(--border-color, #333);
    z-index: 50;
  }
  .ec-mnav-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary, #999);
    font-size: 10px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px;
    transition: color 0.15s;
  }
  .ec-mnav-btn:active { background: rgba(255,255,255,0.06); }
  .ec-mnav-btn.active {
    color: var(--accent-primary, #4da6ff);
    border-top: 2px solid var(--accent-primary, #4da6ff);
    margin-top: -2px;
  }
  .ec-mnav-icon { font-size: 18px; line-height: 1; }
  .ec-mnav-label { font-size: 10px; font-weight: 500; }
}

/* ═══ Preview pane — mobile fine-tuning ═══ */
@media (max-width: 640px) {
  /* Compact toolbar: hide less useful buttons */
  .ec-toolbar { padding: 6px 10px !important; gap: 4px !important; }
  .ec-btn-test, #ec-fullscreen { display: none !important; }
  .ec-project-name { flex: 1; max-width: none !important; }

  /* Preview layout: iframe fills, console collapsible + smaller default */
  .ec-ide[data-mobile-pane="preview"] .ec-preview {
    display: flex !important; flex-direction: column; flex: 1; min-height: 0;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    border-left: none !important;
  }
  .ec-ide[data-mobile-pane="preview"] #ec-preview-iframe {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    width: 100% !important;
    height: auto !important;
    border: 0 !important;
    background: #fff;
  }
  .ec-ide[data-mobile-pane="preview"] .ec-console-panel {
    flex: 0 0 auto;
    max-height: 160px !important;
    border-top: 1px solid var(--border-color, #333);
  }
  /* Allow user to minimize console (existing #ec-toggle-console already does this via its JS) */

  /* Files pane: ensure tree fills */
  .ec-ide[data-mobile-pane="files"] .ec-tree-content { flex: 1; overflow-y: auto; }
}


/* ── Shell input row (EPM + echo) ───────────────────────────────────── */
.ec-console-input-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.25);
  flex-shrink: 0;
}
.ec-console-panel.collapsed .ec-console-input-row { display: none; }
.ec-console-ps1 {
  color: #22c55e; font-family: var(--font-mono, monospace);
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.ec-console-input-row input {
  flex: 1; background: transparent; border: none;
  color: var(--text-primary, #e5e5e5);
  font-family: var(--font-mono, monospace); font-size: 12px;
  outline: none; padding: 2px 0;
}
.ec-ide.ec-light .ec-console-input-row { background: rgba(0,0,0,0.04); border-top-color: rgba(0,0,0,0.08); }
.ec-ide.ec-light .ec-console-ps1 { color: #059669; }

/* ── File tree : drag & drop visual cues ───────────────────────────── */
.ec-tree-item[draggable="true"] { cursor: grab; }
.ec-tree-item.ec-dragging { opacity: 0.5; cursor: grabbing; }
.ec-tree-item.ec-drop-target {
  background: rgba(34,197,94,0.18);
  outline: 1px dashed #22c55e;
  outline-offset: -2px;
}
.ec-tree-content {
  min-height: 100%;
}
/* Extra header buttons : resserrer le spacing */
.ec-tree-header .ec-btn-sm { padding: 2px 6px; font-size: 13px; line-height: 1; }

/* ── Modal prompt/confirm (remplace browser prompt/confirm) ─────────── */
.ec-modal-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  animation: ec-modal-fade 0.15s ease-out;
}
@keyframes ec-modal-fade { from { opacity: 0; } to { opacity: 1; } }
.ec-modal {
  background: #1e1e2e; color: #cdd6f4;
  border: 1px solid #313244; border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  min-width: 380px; max-width: 520px;
  font-family: inherit;
  animation: ec-modal-pop 0.18s ease-out;
}
@keyframes ec-modal-pop { from { transform: translateY(-10px) scale(0.98); } to { transform: none; } }
.ec-modal-head {
  padding: 14px 18px 10px;
  font-size: 14px; font-weight: 600;
  border-bottom: 1px solid #313244;
}
.ec-modal-body {
  padding: 14px 18px;
  font-size: 13px; line-height: 1.5;
}
.ec-modal-body b { color: #f5e0dc; font-weight: 600; }
.ec-modal-input {
  width: 100%; margin-top: 10px;
  padding: 8px 10px;
  background: #11111b; color: #cdd6f4;
  border: 1px solid #45475a; border-radius: 6px;
  font-family: var(--font-mono, monospace); font-size: 13px;
  outline: none;
}
.ec-modal-input:focus { border-color: #89b4fa; box-shadow: 0 0 0 2px rgba(137,180,250,0.2); }
.ec-modal-actions {
  padding: 10px 18px 14px;
  display: flex; justify-content: flex-end; gap: 8px;
  border-top: 1px solid #313244;
}
.ec-modal-actions .ec-btn {
  padding: 6px 14px;
  background: #313244; color: #cdd6f4;
  border: 1px solid #45475a; border-radius: 6px;
  font-size: 12px; font-weight: 500; cursor: pointer;
}
.ec-modal-actions .ec-btn:hover { background: #45475a; }
.ec-modal-actions .ec-modal-confirm {
  background: #89b4fa; color: #11111b; border-color: #89b4fa;
}
.ec-modal-actions .ec-modal-confirm:hover { background: #a6c8ff; }
/* Light theme */
.ec-ide.ec-light ~ .ec-modal-overlay .ec-modal,
body.ec-light .ec-modal {
  background: #fff; color: #1e1e2e; border-color: #dce0e8;
}
body.ec-light .ec-modal-input { background: #f8f9fa; color: #1e1e2e; border-color: #dce0e8; }

/* ── Header arbre : boutons d'action homogènes + espacement régulier ─── */
.ec-tree-header { padding: 8px 10px; gap: 8px; }
.ec-tree-header .ec-pane-label { flex: 1; min-width: 0; }
.ec-tree-header-actions {
  display: flex; align-items: center; gap: 2px;
}
/* Style unifié pour les boutons icône (header + ailleurs) */
.ec-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0;
  background: transparent; border: 1px solid transparent; border-radius: 5px;
  color: #a6adc8; cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.ec-icon-btn:hover { background: #313244; color: #cdd6f4; border-color: #45475a; }
.ec-icon-btn:active { transform: translateY(1px); }
.ec-icon-btn svg { display: block; }
/* Séparateur visuel avant le bouton collapse */
.ec-tree-header-actions .ec-collapse-btn { margin-left: 6px; }
.ec-tree-header-actions .ec-collapse-btn::before {
  content: ''; display: block; position: absolute;
  width: 1px; height: 16px; background: #313244;
  margin-left: -7px; margin-top: 5px;
}
.ec-tree-header-actions .ec-collapse-btn { position: relative; }

/* Light theme overrides */
.ec-ide.ec-light .ec-icon-btn { color: #6c6f85; }
.ec-ide.ec-light .ec-icon-btn:hover { background: #e6e9ef; color: #4c4f69; border-color: #bcc0cc; }
.ec-ide.ec-light .ec-tree-header-actions .ec-collapse-btn::before { background: #dce0e8; }

/* ── Menu inline (dropdown par item) : icônes alignées, bouton "danger" ──── */
.ec-inline-menu { min-width: 170px; padding: 4px 0; border-radius: 6px; }
.ec-inline-menu button {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  transition: background 0.1s ease;
}
.ec-inline-menu button svg {
  flex-shrink: 0; opacity: 0.75;
}
.ec-inline-menu button:hover svg { opacity: 1; }
.ec-inline-menu button.ec-danger { color: #f38ba8; }
.ec-inline-menu button.ec-danger:hover { background: rgba(243,139,168,0.12); color: #f38ba8; }
.ec-ide.ec-light .ec-inline-menu button.ec-danger { color: #d20f39; }
.ec-ide.ec-light .ec-inline-menu button.ec-danger:hover { background: rgba(210,15,57,0.1); color: #d20f39; }

/* Quand la colonne file-tree est repliée, on cache la barre d'actions */
.ec-file-tree.collapsed .ec-tree-header-actions { display: none; }

/* Même repliée, on veut pouvoir déplier : garde le bouton collapse visible */
.ec-file-tree.collapsed .ec-tree-header-actions {
  display: flex;
}
.ec-file-tree.collapsed .ec-tree-header-actions > *:not(.ec-collapse-btn) {
  display: none;
}
.ec-file-tree.collapsed .ec-tree-header-actions .ec-collapse-btn::before {
  display: none;
}

/* ── Fix overlap header label ↔ icons sur panes étroits ────────────── */
.ec-tree-header {
  gap: 6px;
}
.ec-tree-header .ec-pane-label {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ec-tree-header-actions {
  flex-shrink: 0;
}
/* Icônes un peu plus compactes pour libérer de la place */
.ec-icon-btn { width: 22px; height: 22px; border-radius: 4px; }
.ec-icon-btn svg { width: 13px; height: 13px; }

/* ── Tab : icône œil pour basculer preview (image / markdown) ─────── */
.ec-tab-preview {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; margin-left: 4px;
  border-radius: 4px; cursor: pointer;
  color: #a6adc8; opacity: 0.7;
  transition: opacity 0.12s ease, background 0.12s ease;
}
.ec-tab-preview:hover { opacity: 1; background: rgba(255,255,255,0.08); }
.ec-tab.active .ec-tab-preview { color: #cdd6f4; opacity: 0.85; }
.ec-tab-preview svg { pointer-events: none; display: block; }
.ec-ide.ec-light .ec-tab-preview { color: #6c6f85; }
.ec-ide.ec-light .ec-tab-preview:hover { background: rgba(0,0,0,0.06); }

/* ── Overlay preview (image ou markdown rendu) : couvre l'éditeur ───── */
.ec-editor-wrap { position: relative; }
.ec-file-preview {
  position: absolute; inset: 0; z-index: 20;
  background: #1e1e2e;
  overflow: auto;
  display: flex; align-items: flex-start; justify-content: center;
}
.ec-file-preview[hidden] { display: none; }
.ec-ide.ec-light .ec-file-preview { background: #eff1f5; }

/* Image preview : centré, fond damier pour transparence */
.ec-fp-image {
  width: 100%; min-height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; box-sizing: border-box;
  background-color: #1e1e2e;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,0.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.04) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.04) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.04) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.ec-fp-image img, .ec-fp-image svg {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.ec-ide.ec-light .ec-fp-image { background-color: #eff1f5; }

/* Markdown rendu : typographie lisible */
.ec-fp-md {
  max-width: 880px; width: 100%;
  padding: 32px 40px;
  color: #cdd6f4; font-size: 15px; line-height: 1.7;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ec-fp-md h1, .ec-fp-md h2, .ec-fp-md h3, .ec-fp-md h4 { color: #cdd6f4; font-weight: 700; margin: 24px 0 12px; }
.ec-fp-md h1 { font-size: 28px; border-bottom: 1px solid #313244; padding-bottom: 10px; }
.ec-fp-md h2 { font-size: 22px; }
.ec-fp-md h3 { font-size: 18px; }
.ec-fp-md h1:first-child, .ec-fp-md h2:first-child, .ec-fp-md h3:first-child { margin-top: 0; }
.ec-fp-md p  { margin: 10px 0; }
.ec-fp-md a  { color: #89b4fa; }
.ec-fp-md ul, .ec-fp-md ol { margin: 10px 0; padding-left: 28px; }
.ec-fp-md li { margin: 4px 0; }
.ec-fp-md code { background: #11111b; color: #f5e0dc; padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono, monospace); font-size: 13px; }
.ec-fp-md pre { background: #11111b; border: 1px solid #313244; border-radius: 8px; padding: 14px 16px; overflow-x: auto; margin: 14px 0; }
.ec-fp-md pre code { background: none; padding: 0; font-size: 13px; line-height: 1.5; }
.ec-fp-md blockquote { border-left: 3px solid #89b4fa; background: rgba(137,180,250,0.08); padding: 10px 18px; margin: 14px 0; border-radius: 0 6px 6px 0; color: #a6adc8; }
.ec-fp-md table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.ec-fp-md th, .ec-fp-md td { padding: 8px 14px; border: 1px solid #313244; text-align: left; }
.ec-fp-md th { background: #313244; font-weight: 700; color: #cdd6f4; }
.ec-fp-md hr { border: none; border-top: 1px solid #313244; margin: 20px 0; }
.ec-fp-md img { max-width: 100%; border-radius: 6px; margin: 12px 0; }

.ec-ide.ec-light .ec-fp-md { color: #4c4f69; }
.ec-ide.ec-light .ec-fp-md h1 { border-bottom-color: #ccd0da; }
.ec-ide.ec-light .ec-fp-md h1, .ec-ide.ec-light .ec-fp-md h2, .ec-ide.ec-light .ec-fp-md h3, .ec-ide.ec-light .ec-fp-md h4 { color: #4c4f69; }
.ec-ide.ec-light .ec-fp-md a { color: #1e66f5; }
.ec-ide.ec-light .ec-fp-md code { background: #dce0e8; color: #d20f39; }
.ec-ide.ec-light .ec-fp-md pre { background: #dce0e8; border-color: #ccd0da; }
.ec-ide.ec-light .ec-fp-md blockquote { border-left-color: #1e66f5; background: rgba(30,102,245,0.08); color: #6c6f85; }
.ec-ide.ec-light .ec-fp-md th, .ec-ide.ec-light .ec-fp-md td { border-color: #ccd0da; }
.ec-ide.ec-light .ec-fp-md th { background: #dce0e8; }
.ec-ide.ec-light .ec-fp-md hr { border-top-color: #ccd0da; }

/* ── Mermaid diagrams inline dans le preview markdown ─────────────── */
.ec-fp-md .mermaid {
  display: flex; justify-content: center;
  margin: 16px 0; padding: 16px;
  background: #11111b; border: 1px solid #313244; border-radius: 8px;
  overflow-x: auto;
}
.ec-fp-md .mermaid svg { max-width: 100%; height: auto; }
.ec-ide.ec-light .ec-fp-md .mermaid { background: #dce0e8; border-color: #ccd0da; }

/* ── Host du plugin edenphonesim dans le pane preview ─────────────── */
.ec-phonesim-host {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
/* Petit select de device dans la toolbar preview */
.ec-device-select {
  background: #313244;
  color: #cdd6f4;
  border: 1px solid #45475a;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11px;
  cursor: pointer;
  outline: none;
}
.ec-device-select:hover { background: #45475a; }
.ec-ide.ec-light .ec-device-select {
  background: #e6e9ef; color: #4c4f69; border-color: #bcc0cc;
}

/* ── Picker geolocation (presets) ────────────────────────────────── */
.ec-geo-presets {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.ec-geo-preset {
  padding: 6px 12px;
  background: #313244; color: #cdd6f4;
  border: 1px solid #45475a; border-radius: 6px;
  font-size: 12px; cursor: pointer;
  transition: background 0.1s ease;
}
.ec-geo-preset:hover { background: #45475a; border-color: #89b4fa; }

/* ══════════════════════════════════════════════════════════════
   Mobile tabs (< 768px) — Fichiers / Editeur / Apercu / Console
   ══════════════════════════════════════════════════════════════ */
.ec-mobile-tabs { display: none; }

@media (max-width: 767px) {
  .ec-ide {
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    height: 100%;
  }
  .ec-mobile-tabs {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #181825;
    border-top: 1px solid #313244;
    z-index: 1000;
  }
  .ec-mobile-tabs .ec-mtab {
    flex: 1;
    background: none;
    border: none;
    color: #6c7086;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 10px;
    cursor: pointer;
    padding: 4px 0;
    -webkit-tap-highlight-color: transparent;
  }
  .ec-mobile-tabs .ec-mtab.is-active { color: #cba6f7; }
  .ec-mobile-tabs .ec-mtab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
  }
  .ec-mobile-tabs .ec-mtab-icon svg {
    width: 20px; height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  /* Layout fills viewport minus toolbar+tabs nav */
  .ec-layout {
    position: relative !important;
    overflow: hidden;
    height: 100% !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }
  .ec-splitter { display: none !important; }

  /* Panes: absolute fill their parent layout */
  .ec-file-tree,
  .ec-center,
  .ec-preview {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    height: auto !important;
    display: none !important;
    border: none !important;
  }
  .ec-file-tree.ec-mobile-active,
  .ec-center.ec-mobile-active,
  .ec-preview.ec-mobile-active {
    display: flex !important;
    flex-direction: column !important;
  }

  /* File tree: tree-content must fill remaining space */
  .ec-file-tree.ec-mobile-active .ec-tree-content {
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }

  /* Preview tab: preview visible, console hidden */
  .ec-preview.ec-mobile-preview-only .ec-console-panel { display: none !important; }
  .ec-preview.ec-mobile-preview-only .ec-phonesim-host {
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }

  /* Console tab: preview elements hidden, console fills entirely */
  .ec-preview.ec-mobile-console-only .ec-preview-toolbar,
  .ec-preview.ec-mobile-console-only .ec-phonesim-host,
  .ec-preview.ec-mobile-console-only .ec-splitter { display: none !important; }
  .ec-preview.ec-mobile-console-only .ec-console-panel {
    flex: 1 1 auto !important;
    height: auto !important;
    min-height: 0 !important;
    border-top: none !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .ec-preview.ec-mobile-console-only .ec-console-panel.collapsed {
    height: auto !important;
  }
  .ec-preview.ec-mobile-console-only .ec-console-panel.collapsed .ec-console-logs {
    display: flex !important;
  }
  .ec-preview.ec-mobile-console-only .ec-console-logs {
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }

  .ec-toolbar { overflow-x: auto; }
}


/* ══════════════════════════════════════════════════════════════
   Mobile tabs fix — force active panes to fill remaining height
   Symptom: onglets Fichiers + Console laissaient un gros vide en bas
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .ec-file-tree.ec-mobile-active,
  .ec-center.ec-mobile-active,
  .ec-preview.ec-mobile-active {
    height: 100% !important;
  }
  .ec-file-tree.ec-mobile-active .ec-tree-content {
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }
  .ec-preview.ec-mobile-console-only .ec-console-panel {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    border-top: none !important;
  }
  .ec-preview.ec-mobile-console-only .ec-console-logs {
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }
}


/* ══════════════════════════════════════════════════════════════
   Edencode body-class fallback
   :has(.ec-ide) not supported on older Safari → use body class
   set by plugin.js at renderIDE time
   ══════════════════════════════════════════════════════════════ */
body.edencode-mounted .eden-content {
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}
body.edencode-mounted .eden-bottom-nav {
  display: none !important;
}




/* ══════════════════════════════════════════════════════════════
   Mobile pane sizing override
   position:absolute + top/bottom:0 + height:100% ne resolvait pas
   (percentage indeterminate sur certains navigateurs).
   On passe ec-layout en flex-column et panes en flex:1.
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .ec-layout {
    flex-direction: column !important;
  }
  .ec-file-tree,
  .ec-center,
  .ec-preview {
    position: static !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    height: auto !important;
    flex: 0 0 auto !important;
  }
  .ec-file-tree.ec-mobile-active,
  .ec-center.ec-mobile-active,
  .ec-preview.ec-mobile-active {
    flex: 1 1 0 !important;
    min-height: 0 !important;
  }
}


/* ══════════════════════════════════════════════════════════════
   Override legacy max-height:180px from @media (max-width: 640px)
   qui capait .ec-file-tree malgré mes flex:1 et height:100%.
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .ec-file-tree,
  .ec-center,
  .ec-preview {
    max-height: none !important;
  }
}


/* Override legacy max-height: 160px / 30vh !important sur console-panel */
@media (max-width: 767px) {
  .ec-preview.ec-mobile-console-only .ec-console-panel {
    max-height: none !important;
  }
  .ec-preview.ec-mobile-preview-only .ec-console-panel,
  .ec-preview.ec-mobile-active .ec-console-panel {
    max-height: none !important;
  }
}


/* ══════════════════════════════════════════════════════════════
   Toolbar burger menu (mobile)
   Regroupe Word wrap / Formater / Tests / Sauvegarder / Plein ecran / Craft
   dans un dropdown ouvert par bouton burger.
   ══════════════════════════════════════════════════════════════ */
.ec-toolbar-burger { display: none; }
.ec-toolbar-actions { display: flex; align-items: center; gap: 8px; }

@media (max-width: 767px) {
  .ec-toolbar { position: relative; overflow: visible !important; }
  .ec-toolbar-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid #45475a;
    border-radius: 4px;
    color: #cdd6f4;
    cursor: pointer;
    padding: 4px 10px;
    font-size: 18px;
    line-height: 1;
    height: 28px;
  }
  .ec-toolbar-burger:hover { background: #313244; }
  .ec-toolbar-actions {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 6px;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 8px;
    background: #181825;
    border: 1px solid #45475a;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.45);
    z-index: 200;
    min-width: 180px;
  }
  .ec-toolbar-actions.is-open { display: flex; }
  .ec-toolbar-actions > .ec-btn,
  .ec-toolbar-actions > .ec-wrap-toggle,
  .ec-toolbar-actions > #craft-toggle-btn {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
    padding: 8px 12px;
    border-radius: 4px;
    margin: 0;
  }
  .ec-toolbar-actions > .ec-wrap-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #cdd6f4;
    font-size: 13px;
    background: #313244;
    border: 1px solid #45475a;
  }
}


/* ══════════════════════════════════════════════════════════════
   Versions modal — historique git du projet
   ══════════════════════════════════════════════════════════════ */
.ec-vm-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ec-vm {
  background: #1e1e2e;
  color: #cdd6f4;
  border: 1px solid #45475a;
  border-radius: 8px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.ec-vm-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #313244;
  background: #181825;
}
.ec-vm-title { font-weight: 600; color: #cba6f7; flex: 0 0 auto; }
.ec-vm-status { flex: 1; color: #a6adc8; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ec-vm-close {
  background: transparent; border: none; color: #cdd6f4;
  cursor: pointer; font-size: 18px; line-height: 1;
  padding: 4px 8px; border-radius: 4px;
}
.ec-vm-close:hover { background: #313244; }

.ec-vm-tabs {
  display: flex;
  border-bottom: 1px solid #313244;
  background: #181825;
}
.ec-vm-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: #6c7086;
  cursor: pointer;
  padding: 10px 12px;
  font-size: 12px;
  border-bottom: 2px solid transparent;
}
.ec-vm-tab:hover { color: #cdd6f4; }
.ec-vm-tab.is-active { color: #cba6f7; border-bottom-color: #cba6f7; }

.ec-vm-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ec-vm-pane {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  padding: 12px 16px;
  gap: 8px;
}
.ec-vm-pane.is-active { display: flex; }

.ec-vm-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}
.ec-vm-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #11111b;
  border: 1px solid #313244;
  border-radius: 6px;
}
.ec-vm-item.is-current { border-color: #cba6f7; background: #1e1e2e; }
.ec-vm-item-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ec-vm-msg { color: #cdd6f4; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ec-vm-meta { color: #6c7086; font-size: 11px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ec-vm-meta code { background: #313244; color: #fab387; padding: 1px 5px; border-radius: 3px; font-size: 11px; }
.ec-vm-author { color: #a6adc8; }
.ec-vm-date { color: #6c7086; }

.ec-vm-restore, .ec-vm-checkout {
  flex: 0 0 auto;
  background: #313244; color: #cdd6f4;
  border: 1px solid #45475a; border-radius: 4px;
  padding: 6px 10px; cursor: pointer; font-size: 12px;
}
.ec-vm-restore:hover, .ec-vm-checkout:hover:not(:disabled) { background: #45475a; }
.ec-vm-checkout:disabled { opacity: 0.5; cursor: default; }

.ec-vm-empty { color: #6c7086; padding: 20px; text-align: center; font-size: 12px; }

.ec-vm-row { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.ec-vm-row-end { justify-content: flex-end; }
.ec-vm-input {
  flex: 1 1 auto;
  background: #11111b; color: #cdd6f4;
  border: 1px solid #45475a; border-radius: 4px;
  padding: 8px 10px; font-size: 13px;
  outline: none;
}
.ec-vm-input:focus { border-color: #cba6f7; }
.ec-vm-textarea {
  background: #11111b; color: #cdd6f4;
  border: 1px solid #45475a; border-radius: 4px;
  padding: 8px 10px; font-size: 13px;
  resize: vertical; outline: none;
  font-family: inherit;
}
.ec-vm-textarea:focus { border-color: #cba6f7; }
.ec-vm-label { color: #a6adc8; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.ec-vm-hint { flex: 1; color: #a6adc8; font-size: 11px; text-align: left; }
.ec-vm-more { align-self: center; margin-top: 8px; }

@media (max-width: 767px) {
  .ec-vm-overlay { padding: 0; align-items: stretch; }
  .ec-vm { max-width: none; max-height: none; height: 100%; border-radius: 0; }
  .ec-vm-tab { font-size: 11px; padding: 12px 4px; }
  .ec-vm-restore, .ec-vm-checkout { padding: 8px 12px; font-size: 13px; }
  .ec-vm-msg { white-space: normal; }
}


/* Override : bouton submit du commit en pleine largeur, undeniably visible */
.ec-vm-submit {
  display: block !important;
  width: 100% !important;
  padding: 12px 16px !important;
  background: #cba6f7 !important;
  color: #1e1e2e !important;
  border: none !important;
  border-radius: 6px !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  cursor: pointer !important;
  margin-top: 8px !important;
  font-family: inherit;
  line-height: 1.2;
  flex-shrink: 0;
}
.ec-vm-submit:hover { background: #b894e0 !important; }
.ec-vm-submit:disabled { opacity: 0.5 !important; cursor: default !important; }


/* mobile only : hint en flex-column ne doit pas grandir verticalement
   (sinon vide entre textarea et bouton plein-largeur). Desktop garde son layout. */
@media (max-width: 767px) {
  .ec-vm-pane > .ec-vm-hint { flex: 0 0 auto !important; }
}


/* ══════════════════════════════════════════════════════════════
   Split editor — 2 panes vertical
   ══════════════════════════════════════════════════════════════ */
.ec-panes {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.ec-pane {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  position: relative;
}
.ec-pane:not(:last-child) {
  border-right: 1px solid #313244;
}
.ec-pane.is-active::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: #cba6f7;
  pointer-events: none;
  z-index: 5;
}
.ec-pane-header {
  display: flex;
  align-items: stretch;
  background: #181825;
  border-bottom: 1px solid #313244;
  min-height: 32px;
}
.ec-pane-header .ec-tab-bar {
  flex: 1;
  border-bottom: none;
  min-height: 32px;
}
.ec-pane-split-btn,
.ec-pane-close-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-left: 1px solid #313244;
  color: #a6adc8;
  cursor: pointer;
  padding: 0 12px;
  font-size: 14px;
  line-height: 1;
}
.ec-pane-split-btn:hover,
.ec-pane-close-btn:hover {
  background: #313244;
  color: #cdd6f4;
}
.ec-tab-move {
  margin: 0 4px;
  padding: 2px 4px;
  cursor: pointer;
  opacity: 0.6;
  font-size: 11px;
}
.ec-tab-move:hover { opacity: 1; background: #313244; border-radius: 3px; }

@media (max-width: 767px) {
  /* Mobile : split desactive (espace insuffisant) */
  .ec-pane-split-btn { display: none !important; }
  .ec-tab-move { display: none !important; }
  .ec-panes {
    flex-direction: column;
  }
  .ec-pane:not(:last-child) {
    border-right: none;
    border-bottom: 1px solid #313244;
  }
}


/* Drag-and-drop visual feedback */
.ec-tab.is-dragging { opacity: 0.4; }
.ec-pane.is-drop-target {
  outline: 2px dashed #cba6f7;
  outline-offset: -4px;
  background: rgba(203, 166, 247, 0.05);
}


/* Split editor : tabs ne se compressent pas, tab-bar scrollable horizontalement */
.ec-pane-header { overflow: hidden; }
.ec-pane-header .ec-tab-bar { overflow-x: auto; overflow-y: hidden; }
.ec-pane .ec-tab { flex-shrink: 0 !important; min-width: 100px; max-width: 240px; }
.ec-pane .ec-tab .ec-tab-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}


/* Force les tabs a NE PAS se compresser meme dans un pane etroit */
.ec-pane .ec-pane-header { min-width: 0; flex-shrink: 0; }
.ec-pane .ec-pane-header .ec-tab-bar {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  display: flex !important;
  flex-wrap: nowrap !important;
}
.ec-pane .ec-tab {
  flex: 0 0 auto !important;
  min-width: 100px !important;
  max-width: 240px !important;
  white-space: nowrap !important;
  flex-direction: row !important;
}
.ec-pane .ec-tab > .ec-tab-name {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
}
.ec-pane .ec-tab > .ec-tab-close,
.ec-pane .ec-tab > .ec-tab-move,
.ec-pane .ec-tab > .ec-tab-preview {
  flex-shrink: 0 !important;
}


/* Tabs ultra-agressif : surcharge tout */
.ec-pane > .ec-pane-header {
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  overflow: hidden !important;
}
.ec-pane > .ec-pane-header > .ec-tab-bar {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
}
.ec-pane > .ec-pane-header > .ec-tab-bar > .ec-tab {
  flex: 0 0 auto !important;
  min-width: 110px !important;
  max-width: 220px !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  white-space: nowrap !important;
  padding: 0 10px !important;
  box-sizing: border-box !important;
}
.ec-pane > .ec-pane-header > .ec-tab-bar > .ec-tab > .ec-tab-name {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
.ec-pane > .ec-pane-header > .ec-tab-bar > .ec-tab > .ec-tab-close,
.ec-pane > .ec-pane-header > .ec-tab-bar > .ec-tab > .ec-tab-move,
.ec-pane > .ec-pane-header > .ec-tab-bar > .ec-tab > .ec-tab-preview {
  flex: 0 0 auto !important;
  margin-left: 4px !important;
}


/* Tabs : nom plus de place, icones secondaires en hover seulement (comme VS Code) */
.ec-pane .ec-tab {
  min-width: 140px !important;
  padding: 0 8px 0 12px !important;
}
.ec-pane .ec-tab .ec-tab-move,
.ec-pane .ec-tab .ec-tab-preview {
  opacity: 0 !important;
  transition: opacity 0.12s ease !important;
  margin-left: 2px !important;
  width: 14px !important;
  height: 14px !important;
  font-size: 11px !important;
  line-height: 14px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.ec-pane .ec-tab:hover .ec-tab-move,
.ec-pane .ec-tab:hover .ec-tab-preview,
.ec-pane .ec-tab.active .ec-tab-move,
.ec-pane .ec-tab.active .ec-tab-preview {
  opacity: 0.7 !important;
}
.ec-pane .ec-tab .ec-tab-move:hover,
.ec-pane .ec-tab .ec-tab-preview:hover,
.ec-pane .ec-tab .ec-tab-close:hover {
  opacity: 1 !important;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}
.ec-pane .ec-tab .ec-tab-close {
  margin-left: 4px !important;
}


/* Console : modes plein ecran + flottante */
.ec-console-mode-btn {
  font-size: 14px !important;
  line-height: 1 !important;
  padding: 2px 7px !important;
}
.ec-console-panel.is-console-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999 !important;
  border-radius: 0 !important;
  margin: 0 !important;
}
.ec-console-panel.is-console-detached {
  position: fixed !important;
  z-index: 9000 !important;
  border-radius: 8px !important;
  border: 1px solid #45475a !important;
  box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  resize: both !important;
  overflow: hidden !important;
  min-width: 400px !important;
  min-height: 200px !important;
}
.ec-console-panel.is-console-detached .ec-console-toolbar {
  cursor: move;
  user-select: none;
}

@media (max-width: 767px) {
  /* Mobile : la console est deja un onglet plein ecran via les tabs mobiles */
  .ec-console-mode-btn { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   STANDALONE EDITOR — un fichier, pas d'arborescence (action openStandalone).
   Convention EdenALOS : règles CSS pour la fenêtre flottante créée via
   Eden.shell.createFloatingWindow({ className: 'ec-standalone-window' }).
   Sans ces règles, winEl n'a pas position:fixed ni flex column, et bodyEl
   n'a pas flex:1 → canvas client_height()=0 → WASM init drawing buffer 0×0.
   ═══════════════════════════════════════════════════════════════════════════ */
.ec-standalone-window {
  position: fixed;
  display: flex;
  flex-direction: column;
  background: rgba(10, 12, 18, 0.97);
  border: 1px solid rgba(88, 200, 255, 0.14);
  border-radius: 12px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55), 0 0 24px rgba(88, 200, 255, 0.10);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #e8edf3;
}
.ec-standalone-window.ec-standalone-window-maximized {
  border-radius: 0;
  box-shadow: none;
}
.ec-standalone-window-titlebar {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid #2a3140;
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}
.ec-standalone-window-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 6px;
}
.ec-standalone-window-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-height: 0;
  overflow: hidden;
  position: relative;
  background: #0a0c12;
  padding: 0;
}
