/* ── MagicPath migrated: Project IDE ── */
.page-project--ide {
  display:flex;
  flex-direction:column;
  height:100vh;

}

.page-project--ide .home-lead {
  max-width:none;
  font-size:var(--text-14);
}

.page-project--ide { overflow:hidden; }

.dep-banner {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 24px;
  background:var(--color-earth-100);
  border-bottom:1px solid var(--color-earth-450);
}

.dep-banner strong { font-size:var(--text-13); color:var(--color-earth-1200); }
.dep-banner p { margin:4px 0 0; font-size:var(--text-13); color:var(--muted); }
.dep-banner code { background:var(--color-earth-250); border:none; }

.sidebar--dark {
  width:220px;
  min-width:200px;
  flex:0 0 220px;
  flex-shrink:0;
  min-height:0;
  background:var(--sidebar-dark);
  border-right:1px solid var(--sidebar-border);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

.sidebar-header--dark {
  padding:14px 16px;
  border-bottom:1px solid var(--sidebar-border);
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
}

.sidebar-title {
  margin:0;
  font-size:var(--text-11);
  font-weight:600;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:var(--color-neutral-500);
}

.sidebar-meta {
  margin:2px 0 0;
  font-size:var(--text-11);
  color:var(--color-neutral-550);
}

.status-dot--ide {
  width:6px;
  height:6px;
  margin-top:4px;
  background:var(--success);
  box-shadow:none;
}

.status-dot--ide.is-busy {
  background:var(--warning);
  animation:status-pulse 1.1s ease-in-out infinite;
}

.sidebar-search {
  padding:10px 12px;
  border-bottom:1px solid var(--sidebar-border);
}

.sidebar-main-hint {
  margin:6px 0 0;
  padding:0 2px;
  font-size:var(--text-11);
  line-height:1.4;
  color:var(--color-neutral-400);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.sidebar-main-hint--auto {
  color:var(--color-earth-850);
}

.file-search--dark {
  margin:0;
  padding:6px 10px;
  font-size:var(--text-12);
  background:var(--color-blue-750);
  border:1px solid var(--sidebar-border);
  border-radius:var(--radius-xs);
  color:var(--color-neutral-300);
}

.file-search--dark:focus {
  border-color:var(--primary);
  outline:none;
}

.file-tree--dark {
  flex:1;
  min-height:0;
  overflow-x:hidden;
  overflow-y:auto;
  padding:8px;
  color:var(--color-neutral-400);
  font-family:Inter, Segoe UI, Arial, sans-serif;
  scrollbar-width:thin;
  scrollbar-color:var(--color-blue-450) transparent;
}

.sidebar-view-tab:hover { color:var(--color-neutral-250); }
.sidebar-view-tab.is-active { color:var(--color-neutral-150); border-bottom-color:var(--color-earth-850); }

.document-outline {
  flex:1;
  min-height:0;
  overflow:auto;
  padding:8px;
}

.document-outline__empty {
  margin:12px;
  color:var(--color-neutral-750);
  font-size:var(--text-11);
  line-height:1.5;
}

.document-outline__item {
  display:block;
  width:100%;
  padding:6px 8px 6px calc(8px + var(--outline-level) * 12px);
  overflow:hidden;
  color:var(--color-neutral-350);
  background:transparent;
  border:0;
  border-radius:var(--radius-xs);
  text-align:left;
  text-overflow:ellipsis;
  white-space:nowrap;
  font:var(--text-12)/1.35 Inter, Segoe UI, sans-serif;
  cursor:pointer;
}

.document-outline__item:hover { color:white; background:var(--alpha-surface-6-5); }

.project-search { flex:1; min-height:0; overflow:auto; padding:8px; color:var(--color-neutral-350); font:var(--text-12)/1.35 Inter, Segoe UI, sans-serif; }
.project-search[hidden] { display:none; }
.project-search__form .file-search { width:100%; }
.project-search__options { display:flex; align-items:center; gap:10px; margin:6px 0; }
.project-search__options label { display:flex; align-items:center; gap:4px; }
.project-search__status { margin:6px 0; color:var(--color-neutral-750); font-size:var(--text-11); }
.project-search__results,
.project-search__results ul { margin:0; padding:0; list-style:none; }
.project-search__results > li { margin-bottom:8px; }
.project-search__results strong { display:block; padding:4px 0; color:var(--color-blue-150); word-break:break-all; }
.project-search__hit { display:block; width:100%; padding:4px 6px; overflow:hidden; color:inherit; background:transparent; border:0; border-radius:var(--radius-xs); text-align:left; text-overflow:ellipsis; white-space:nowrap; font:var(--text-11)/1.4 "JetBrains Mono", monospace; cursor:pointer; }
.project-search__hit:hover,
.project-search__hit:focus-visible { color:white; background:var(--alpha-surface-6-5); }
.project-search__hit span { display:inline-block; min-width:3ch; margin-right:6px; color:var(--color-neutral-750); }
.project-search__hit mark { color:var(--color-neutral-1000); background:var(--color-earth-850); border-radius:var(--radius-xs); }

.file-tree--dark::-webkit-scrollbar {
  width:6px;
}

.file-tree--dark::-webkit-scrollbar-thumb {
  background:var(--color-blue-450);
  border-radius:var(--radius-xs);
}

.file-tree--dark::-webkit-scrollbar-track {
  background:transparent;
}

.file-tree__root-label {
  margin:0 0 8px;
  padding:0 8px;
  font-size:var(--text-11);
  font-weight:600;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:var(--color-neutral-550);
}

.file-tree__root-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:4px;
  margin-bottom:8px;
  padding:0 4px 0 0;
}

.file-tree__root-row .file-tree__root-label {
  margin:0;
  flex:1;
  min-width:0;
}

.tree-summary__body {
  display:flex;
  align-items:center;
  gap:6px;
  min-width:0;
  flex:1;
}

.tree-leading {
  width:10px;
  flex-shrink:0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.tree-file-row__body {
  display:flex;
  align-items:center;
  gap:6px;
  flex:1;
  min-width:0;
}

.tree-file-row--compile-main {
  background:var(--alpha-warm-12);
}

.tree-main-pin {
  position:relative;
  flex-shrink:0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:10px;
  height:16px;
  margin:0;
  padding:0;
  border:none;
  border-radius:var(--radius-xs);
  background:transparent;
  color:var(--color-neutral-850);
  cursor:pointer;
  opacity:0.45;
  transition:opacity .15s, color .15s, background .15s;
}

.tree-main-pin::after {
  content:"";
  position:absolute;
  inset:-5px -4px;
}

.tree-file-row:hover .tree-main-pin,
.tree-main-pin.is-pinned,
.tree-main-pin.is-auto-hint {
  opacity:1;
}

.tree-main-pin:hover {
  background:var(--color-blue-450);
  color:var(--color-earth-850);
}

.tree-main-pin.is-pinned {
  color:var(--color-earth-850);
  background:var(--alpha-warm-20);
}

.tree-main-pin.is-auto-hint:not(.is-pinned) {
  color:var(--color-neutral-400);
  opacity:0.85;
}

.tree-main-pin.is-auto-hint:not(.is-pinned) .tree-main-pin__icon {
  stroke-dasharray:2 2;
}

.tree-main-pin__icon {
  display:block;
}

.tree-node-menu {
  position:relative;
  flex-shrink:0;
  opacity:0;
  transition:opacity .15s;
}

.tree-directory:hover > details > summary .tree-node-menu,
.tree-file:hover .tree-node-menu,
.tree-node-menu.is-open,
.file-tree__root-row:hover .tree-node-menu {
  opacity:1;
}

.tree-menu-panel {
  position:absolute;
  right:0;
  top:calc(100% + 4px);
  z-index:var(--z-sticky);
  min-width:168px;
  background:var(--color-blue-600);
  border:1px solid var(--color-blue-450);
  border-radius:var(--radius-sm);
  padding:4px;
  box-shadow:0 8px 24px var(--alpha-shadow-35);
}

.tree-menu-item {
  display:block;
  width:100%;
  text-align:left;
  border:none;
  background:transparent;
  color:var(--color-neutral-300);
  font-size:var(--text-12);
  padding:6px 10px;
  border-radius:var(--radius-xs);
  cursor:pointer;
  font-family:inherit;
}

.tree-menu-item:hover {
  background:var(--color-blue-450);
}

.tree-menu-item--danger { color:var(--color-red-200); }

.tree-menu-item--danger:hover {
  background:var(--alpha-danger-12);
}

.tree-menu-form { margin:0; }

.file-tree--dark .tree-list {
  display:grid;
  gap:1px;
}

.file-tree--dark .tree-children,
.file-tree--dark .tree-children--dark {
  margin-left:12px;
  padding-left:8px;
  border-left:1px solid var(--color-blue-450);
}

.file-tree--dark details > summary {
  list-style:none;
}

.file-tree--dark details > summary::-webkit-details-marker {
  display:none;
}

.file-tree--dark .tree-summary,
.file-tree--dark .tree-summary--dark {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:4px;
  padding:4px 4px 4px 8px;
  border-radius:var(--radius-xs);
  font-size:var(--text-12);
  font-weight:500;
  color:var(--color-neutral-400);
  background:transparent;
  min-width:0;
  cursor:pointer;
  user-select:none;
}

.file-tree--dark .tree-summary:hover,
.file-tree--dark .tree-summary--dark:hover {
  background:var(--color-blue-600);
  color:var(--color-neutral-300);
}

.file-tree--dark .tree-directory.contains-active > details > .tree-summary,
.file-tree--dark .tree-directory.contains-active > details > .tree-summary--dark {
  color:var(--color-neutral-300);
  font-weight:600;
  background:transparent;
}

.file-tree--dark .tree-directory details[open] > .tree-summary .tree-chevron,
.file-tree--dark .tree-directory details[open] > .tree-summary .tree-chevron--dark {
  transform:rotate(90deg);
}

.file-tree--dark .tree-chevron,
.file-tree--dark .tree-chevron--dark {
  width:10px;
  flex-shrink:0;
  font-size:var(--text-11);
  color:var(--color-neutral-500);
  text-align:center;
}

.tree-children--dark {
  border-left-color:var(--color-blue-450);
  margin-left:12px;
  padding-left:8px;
}

.tree-summary--dark:hover { background:var(--color-blue-600); }

.tree-chevron--dark { color:var(--color-neutral-500); font-size:var(--text-11); }

.tree-icon-svg {
  flex-shrink:0;
  display:block;
}

.file-tree--dark .tree-file {
  margin:0;
  min-width:0;
}

.file-tree--dark .tree-file-link--dark,
.file-tree--dark .tree-file-link--static,
.file-tree--dark .tree-file-row {
  display:flex;
  align-items:center;
  gap:4px;
  width:100%;
  min-width:0;
  padding:4px 4px 4px 8px;
  border-radius:var(--radius-xs);
  font-size:var(--text-12);
  font-family:inherit;
  color:var(--color-neutral-400);
  text-decoration:none;
  background:transparent;
  border:none;
  box-shadow:none;
}

.file-tree--dark .tree-file-row {
  padding:0 4px 0 0;
}

.file-tree--dark .tree-file-link--dark:hover,
.file-tree--dark .tree-file-row:hover {
  background:var(--color-blue-600);
  color:var(--color-neutral-300);
}

.file-tree--dark .tree-file.active > .tree-file-link--dark,
.file-tree--dark .tree-file.active > .tree-file-row,
.file-tree--dark .tree-file-row--active {
  background:var(--color-blue-450);
  color:var(--color-neutral-50);
  box-shadow:none;
}

/* Resources (PDF, images, data…) open in the file viewer: a little dimmer than editable files, same hover. */
.file-tree--dark .tree-file.resource > .tree-file-row:not(:hover) {
  color:var(--color-neutral-550);
}

.file-tree--dark .tree-name {
  flex:1;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-family:inherit;
}

.tree-file-link--dark {
  display:flex;
  align-items:center;
  gap:8px;
  padding:4px 8px;
  border-radius:var(--radius-xs);
  font-size:var(--text-12);
  color:var(--color-neutral-400);
  text-decoration:none;
  border:none;
}

.tree-file-link--dark:hover { background:var(--color-blue-600); }

.tree-file.active > .tree-file-link--dark {
  background:var(--color-blue-450);
  color:var(--color-neutral-50);
}

.tree-active-mark {
  width:2px;
  height:12px;
  background:var(--primary);
  border-radius:var(--radius-xs);
  margin-left:auto;
  flex-shrink:0;
}

.file-tree--dark.is-loading {
  opacity:.72;
  pointer-events:none;
}

.sidebar-footer--dark {
  padding:10px 12px 12px;
  border-top:1px solid var(--sidebar-border);
}

.mini-section--dark summary { padding:8px 12px; }
.mini-section--dark input {
  background:var(--color-blue-750);
  border:1px solid var(--sidebar-border);
  color:var(--color-neutral-300);
  font-size:var(--text-12);
  margin-bottom:8px;
}

.sidebar-action {
  width:100%;

}

.editor-area--ide {
  flex:1 1 0%;
  min-width:0;
  min-height:0;
  height:100%;
  width:auto;
  align-self:stretch;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  position:relative;
  z-index:var(--z-base);
  background:var(--color-blue-700);

}

.ide-topbar {
  display:flex;
  align-items:stretch;
  justify-content:space-between;
  gap:12px;
  width:100%;
  flex-shrink:0;
  min-height:38px;
  background:var(--editor-chrome);
  border-bottom:1px solid var(--editor-border);
}

.ide-topbar__tabs {
  display:flex;
  align-items:stretch;
  min-width:0;
  overflow-x:auto;
}

.ide-topbar__actions {
  display:flex;
  align-items:center;
  gap:10px;
  padding-right:16px;
  flex-shrink:0;
}

.ide-tab {
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 16px;
  border-right:1px solid var(--editor-border);
  border-top:2px solid var(--primary);
  background:var(--editor-bg);
}

.ide-tab--ghost {
  opacity:.45;
  border-top-color:transparent;
  background:transparent;
}

.ide-tab__plus {
  font-family:var(--font-mono);
  font-size:var(--text-11);
  color:var(--color-neutral-500);
}

.ide-tab__name {
  font-size:var(--text-12);
  font-family:var(--font-mono);
  color:var(--color-neutral-250);
}

button.ide-tab__name,
button.ide-tab__name:hover { padding:0; background:transparent; border:0; cursor:pointer; white-space:nowrap; }
.ide-tab__close:disabled:hover { background:transparent; }
.ide-tab:not(.ide-tab--active):not(.ide-tab--ghost) { border-top-color:transparent; background:transparent; }
.ide-tab:not(.ide-tab--active) .ide-tab__name { color:var(--color-neutral-550); }
.ide-tab__close { padding:0 2px; color:var(--color-neutral-550); background:transparent; border:0; border-radius:var(--radius-xs); font-size:var(--text-14); line-height:1; cursor:pointer; }
.ide-tab__close:hover:not(:disabled),
.ide-tab__close:focus-visible { color:var(--color-neutral-50); background:var(--alpha-surface-10); }
.ide-tab__close:disabled { opacity:.35; cursor:default; }

.ide-tab__icon {
  width:13px;
  height:13px;
  border-radius:var(--radius-xs);
  border:1px solid var(--color-blue-200);
  background:var(--alpha-info-20);
}

.ide-toolbar__actions {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:4px;
}

.ide-tool {
  width:26px;
  height:26px;
  display:grid;
  place-items:center;
  border:none;
  padding:0;
  background:transparent;
  border-radius:var(--radius-xs);
  font-size:var(--text-13);
  font-family:inherit;
  color:var(--color-neutral-500);
  cursor:pointer;
  transition:background .15s, color .15s;
}

.ide-tool:disabled {
  opacity:0.35;
  cursor:not-allowed;
}

.ide-tool:disabled:hover {
  background:transparent;
  color:var(--color-neutral-750);
}

.ide-tool:hover {
  background:var(--color-blue-650);
  color:var(--color-neutral-300);
}

.ide-tool-sep {
  width:1px;
  height:18px;
  background:var(--editor-border);
  margin:0 4px;
}

.ide-toolbar__meta {
  flex:1;
  display:flex;
  align-items:center;

  justify-content:flex-end;
  font-family:var(--font-mono);
}

.ide-save-status {
  color:var(--color-neutral-550);
  font-size:var(--text-11);
  white-space:nowrap;
}

.ide-save-status[data-state="saving"] { color:var(--color-earth-950); }
.ide-save-status[data-state="dirty"] { color:var(--color-neutral-450); }
.ide-save-status[data-state="error"],
.ide-save-status[data-state="conflict"] { color:var(--color-red-200); cursor:pointer; }
.ide-save-status[data-state="live"] { color:var(--success); }
.ide-save-status[data-state="collab"] { color:var(--color-earth-950); cursor:pointer; }
.ide-save-status[tabindex]:focus-visible { outline:2px solid var(--editor-special); outline-offset:2px; border-radius:var(--radius-xs); }

.editor-search {
  position:absolute;
  z-index:var(--z-sticky);
  top:84px;
  right:18px;
  display:flex;
  align-items:center;
  gap:4px;
  max-width:calc(100% - 36px);
  padding:7px;
  background:var(--color-blue-650);
  border:1px solid var(--color-blue-400);
  border-radius:var(--radius-sm);
  box-shadow:0 8px 28px var(--alpha-shadow-25);
}

.editor-search[hidden] { display:none; }
.editor-search [hidden] { display:none; }
.editor-search input { width:150px; padding:6px 8px; color:var(--color-neutral-200); background:var(--color-blue-750); border:1px solid var(--color-blue-400); border-radius:var(--radius-xs); font-size:var(--text-11); }
.editor-search input:focus { outline:1px solid var(--color-earth-850); border-color:var(--color-earth-850); }
.editor-search button { min-width:28px; height:28px; padding:0 7px; color:var(--color-neutral-350); background:transparent; border:1px solid transparent; border-radius:var(--radius-xs); font-size:var(--text-11); cursor:pointer; }
.editor-search button:hover,
.editor-search button.is-active { color:white; background:var(--color-blue-400); border-color:var(--color-blue-400); }
.editor-search__count { min-width:62px; color:var(--color-neutral-550); font-size:var(--text-11); text-align:center; }

.ide-syntax-status {
  font-size:var(--text-11);
  font-weight:600;
  letter-spacing:.04em;
  text-transform:uppercase;
  padding:2px 8px;
  border-radius:var(--radius-xs);
  background:var(--color-red-450);
  color:var(--color-earth-1000);
  border:1px solid var(--color-red-450);
}

.ide-meta {
  font-size:var(--text-11);
  font-family:var(--font-mono);
  color:var(--color-neutral-550);
}

.ide-worker-status {
  display:inline-flex;
  align-items:center;
  gap:5px;
  font-size:var(--text-11);
  font-family:var(--font-mono);
  font-weight:600;
  letter-spacing:.04em;
  text-transform:uppercase;
  padding:2px 7px;
  border-radius:var(--radius-xs);
  border:1px solid transparent;
  user-select:none;
}

.ide-worker-status[hidden] { display:none; }

.ide-worker-status__dot {
  width:6px;
  height:6px;
  border-radius:var(--radius-round);
  flex-shrink:0;
}

.ide-worker-status--active {
  background:var(--alpha-success-12);
  color:var(--color-green-150);
  border-color:var(--alpha-success-35);
}

.ide-worker-status--active .ide-worker-status__dot {
  background:var(--color-green-150);
  box-shadow:0 0 6px var(--alpha-success-55);
}

.ide-worker-status--local {
  background:var(--alpha-info-10);
  color:var(--color-neutral-400);
  border-color:var(--alpha-info-25);
}

.ide-worker-status--local .ide-worker-status__dot {
  background:var(--color-neutral-400);
}

.ide-worker-status--busy .ide-worker-status__dot {
  animation:ide-worker-pulse .85s ease-in-out infinite;
}

@keyframes ide-worker-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.82); }
}

.code-editor {
  flex:1 1 0%;
  width:100%;
  min-width:0;
  min-height:0;
  height:100%;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  align-self:stretch;

}

.code-editor textarea,
.code-editor__highlight,
.code-editor__spacer { font-size:var(--editor-user-font-size); }

.code-editor.is-wrapped textarea,
.code-editor.is-wrapped .code-editor__highlight,
.code-editor.is-wrapped .code-editor__spacer {
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}

.editor-completions {
  position:absolute;
  z-index:var(--z-sticky);
  left:72px;
  top:54px;
  width:min(360px, calc(100% - 92px));
  max-height:270px;
  overflow-y:auto;
  padding:4px;
  background:var(--color-blue-700);
  border:1px solid var(--color-blue-400);
  border-radius:var(--radius-xs);
  box-shadow:0 10px 32px var(--alpha-shadow-35);
}

.editor-completions[hidden] { display:none; }
.editor-completions__item { display:flex; justify-content:space-between; gap:12px; width:100%; padding:7px 9px; color:var(--color-neutral-200); background:transparent; border:0; border-radius:var(--radius-xs); text-align:left; font:var(--text-12)/1.25 var(--font-mono); cursor:pointer; }
.editor-completions__item small { color:var(--color-neutral-550); font:var(--text-11)/1.25 Inter, sans-serif; }
.editor-completions__item:hover,
.editor-completions__item.is-active { background:var(--color-blue-450); color:white; }

.pdf-preview-card {
  margin-bottom:14px;
  overflow:hidden;
  background:var(--color-blue-650);
  border:1px solid var(--color-earth-650);
  border-radius:var(--radius-sm);
}

.pdf-preview-card[hidden] { display:none; }

.pdf-viewer__toolbar input { padding:3px 6px; color:var(--color-neutral-900); background:white; border:1px solid var(--color-earth-750); border-radius:var(--radius-xs); font:inherit; font-weight:500; text-decoration:none; cursor:pointer; }
.pdf-viewer__toolbar button:hover,
.pdf-viewer__toolbar button:focus-visible { color:var(--color-blue-700); background:var(--color-earth-400); }
.pdf-viewer__toolbar input[type="number"] { width:4.2em; cursor:text; }
.pdf-viewer__toolbar [aria-pressed="true"] { color:var(--color-neutral-50); background:var(--color-neutral-900); }
.pdf-viewer__sep { width:1px; height:16px; background:var(--color-earth-750); }
.pdf-viewer__status { margin:0; padding:0 8px; color:var(--color-red-300); font-size:var(--text-11); }
.pdf-viewer__status:empty { display:none; }
.pdf-viewer__pages { position:relative; height:460px; overflow:auto; padding:12px; background:var(--color-neutral-250); resize:vertical; }
.pdf-viewer__page { position:relative; margin:0 auto 12px; background:var(--color-neutral-50); box-shadow:0 1px 4px var(--alpha-shadow-25); }
.pdf-viewer__page canvas { display:block; }
.pdf-viewer.is-inverted .pdf-viewer__page canvas { filter:invert(1) hue-rotate(180deg); }
.pdf-viewer__highlight { position:absolute; z-index:var(--z-raised); background:var(--alpha-warning-45); border:1px solid var(--color-earth-850); border-radius:var(--radius-xs); pointer-events:none; }
.pdf-viewer__highlight.is-approximate { background:var(--alpha-warning-20); border-style:dashed; }
.pdf-viewer__selection { position:absolute; z-index:var(--z-raised); width:12px; height:12px; margin:-6px 0 0 -6px; border:2px solid var(--color-red-300); border-radius:var(--radius-round); background:var(--alpha-surface-70); pointer-events:none; }
.workspace--ide.is-pdf-only .pdf-viewer__pages { height:calc(100vh - 260px); }

.diagnostic-link--error { color:var(--color-red-300); }
.diagnostic-link--warning { color:var(--color-earth-1200); }
.diagnostic-link--typesetting { color:var(--color-neutral-900); }
.diagnostic-summary { margin:0 0 8px; font-size:var(--text-12); }
.diagnostic-badge { display:inline-block; min-width:18px; margin-left:6px; padding:0 5px; border-radius:var(--radius); color:var(--color-neutral-50); background:var(--color-earth-1200); font-size:var(--text-11); line-height:18px; text-align:center; }
.diagnostic-badge[data-severity="error"] { background:var(--color-red-300); }
.diagnostic-badge[hidden] { display:none; }

.editor-form .code-editor {
  flex:1 1 0%;
  min-height:0;
}

/* CodeMirror engine (latex-codemirror-editor.js): the textarea canvas stays only as the form field. */
.code-editor--cm > .code-editor__scroll { display:none; }
.code-editor--cm > .cm-editor { flex:1 1 0%; min-height:0; }
.code-editor--cm > .cm-editor.cm-focused { outline:none; }
/* Live co-editing: remote caret name label (background is the person's colour from the ticket). */
.code-editor--cm .cm-editor .cm-ySelectionInfo {
  font-family:Inter, Segoe UI, Arial, sans-serif;
  font-size:var(--text-11);
  line-height:1.4;
  color:var(--color-neutral-50);
  padding:0 4px;
  border-radius:var(--radius-xs) var(--radius-xs) var(--radius-xs) 0;
  top:-1.4em;
  text-shadow:0 0 2px var(--alpha-shadow-55);
}

.code-editor__scroll {
  flex:1 1 0%;
  width:100%;
  min-width:0;
  min-height:0;
  height:100%;
  overflow:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  background:var(--editor-bg);
  scrollbar-color:var(--editor-border) var(--editor-chrome);
  scrollbar-width:thin;
}

.code-editor__scroll::-webkit-scrollbar {
  width:10px;
  height:10px;
}

.code-editor__scroll::-webkit-scrollbar-thumb {
  background:var(--editor-border);
  border-radius:var(--radius-xs);
  border:2px solid var(--editor-bg);
}

.code-editor__scroll::-webkit-scrollbar-track {
  background:var(--editor-chrome);
}

.code-editor__canvas {
  display:inline-grid;
  grid-template-columns:auto minmax(0, 1fr);
  align-items:start;
  min-width:100%;
  vertical-align:top;
}

.code-editor__gutter {
  position:sticky;
  left:0;
  z-index:var(--z-overlay);
  min-width:var(--editor-gutter-width);
  padding:var(--editor-code-padding) 10px var(--editor-code-padding) 12px;
  text-align:right;
  font-family:var(--font-mono);
  font-size:var(--editor-code-font-size);
  line-height:var(--editor-code-line-height-px);
  color:var(--editor-muted);
  background:var(--editor-gutter-bg, var(--editor-bg));
  border-right:1px solid var(--editor-border);
  user-select:none;
}

.code-editor__gutter-lines {
  margin:0;
  padding:0;
  font:inherit;
  line-height:inherit;
  white-space:normal;
  background:transparent;
  border:none;
}

.code-editor__code {
  position:relative;
  min-width:0;
  min-height:100%;
  height:100%;
}

.editor-area--ide .code-editor__gutter {
  border-right-color:var(--editor-border);
}

.code-editor__highlight {
  position:absolute;
  top:0;
  left:0;
  width:100%;
  min-height:100%;
  margin:0;
  padding:var(--editor-code-padding);
  font-family:var(--font-mono);
  font-size:var(--editor-code-font-size);
  line-height:var(--editor-code-line-height-px);
  white-space:pre;
  word-break:normal;
  overflow-wrap:normal;
  tab-size:var(--editor-tab-size);
  -moz-tab-size:var(--editor-tab-size);
  box-sizing:border-box;

  background:transparent;
  pointer-events:none;
  border:none;
  overflow:visible;
  contain:layout style;
}

.code-editor__highlight .code-line,
.code-editor__highlight .code-line span {
  tab-size:inherit;
  -moz-tab-size:inherit;
  letter-spacing:inherit;
  font-family:inherit;
  font-size:inherit;
  line-height:inherit;
}

.gutter-line {
  display:block;
  width:100%;
  vertical-align:top;
  box-sizing:border-box;
  height:var(--editor-code-line-height-px);
  line-height:var(--editor-code-line-height-px);
}

.gutter-line--active {
  color:var(--editor-text);
  opacity:1;
}

.gutter-line--error {
  color:var(--color-red-200);
  font-weight:600;
}

.editor-area--ide .code-editor__highlight .code-line--error {
  background:var(--alpha-danger-12);
  box-shadow:inset 3px 0 0 var(--color-red-200);
  margin-left:calc(-1 * var(--editor-code-padding, 16px));
  margin-right:calc(-1 * var(--editor-code-padding, 16px));
  padding-left:calc(var(--editor-code-padding, 16px) - 3px);
  padding-right:var(--editor-code-padding, 16px);
}

.code-editor__highlight {
  color:var(--editor-text);
}

.code-editor__highlight .tok-comment {
  color:var(--editor-comment);
}

.code-editor__highlight .tok-command {
  color:var(--editor-command);
  font-weight:400;
}

.code-editor__highlight .tok-env {
  color:var(--editor-env);
}

.code-editor__highlight .tok-option {
  color:var(--editor-option);
}

.code-editor__highlight .tok-special {
  color:var(--editor-special);
}

.code-editor__highlight .tok-bracket {
  color:var(--editor-bracket);
}

.code-editor__highlight .tok-argument {
  color:var(--editor-argument);
}

.code-editor__highlight .tok-cite,
.code-editor__highlight .tok-ref {
  color:var(--editor-cite);
}

.code-editor__highlight .tok-math {
  color:var(--editor-math);
}

.code-editor__highlight .tok-bracket-match {
  background:var(--editor-bracket-match);
  border-radius:var(--radius-xs);
}

.code-editor__highlight .tok-bracket-match--edge {
  background:var(--editor-bracket-edge);
  outline:1px solid var(--alpha-info-35);
  border-radius:var(--radius-xs);
}

.code-editor__highlight .code-line {
  display:block;
  width:100%;
  vertical-align:top;
  box-sizing:border-box;
  height:var(--editor-code-line-height-px);
  line-height:var(--editor-code-line-height-px);
}

.code-editor__spacer {
  position:absolute;
  top:0;
  left:0;
  width:100%;
  visibility:hidden;
  pointer-events:none;
  margin:0;
  padding:var(--editor-code-padding);
  font-family:var(--font-mono);
  font-size:var(--editor-code-font-size);
  line-height:var(--editor-code-line-height-px);
  white-space:pre;
  word-break:normal;
  overflow-wrap:normal;
  tab-size:var(--editor-tab-size);
  -moz-tab-size:var(--editor-tab-size);
  box-sizing:border-box;
  min-height:0;
}

.code-editor textarea {
  position:absolute;
  top:0;
  left:0;
  width:100%;
  min-width:100%;
  min-height:100%;
  padding:var(--editor-code-padding);
  margin:0;
  font-family:var(--font-mono);
  font-size:var(--editor-code-font-size);
  line-height:var(--editor-code-line-height-px);
  background:transparent;
  color:transparent;
  -webkit-text-fill-color:transparent;
  caret-color:var(--editor-text);
  border:none;
  resize:none;
  tab-size:var(--editor-tab-size);
  -moz-tab-size:var(--editor-tab-size);
  overflow:hidden;
  z-index:var(--z-overlay);
  pointer-events:auto;
  user-select:text;
  -webkit-user-select:text;
  cursor:text;
  white-space:pre;
  word-break:normal;
  overflow-wrap:normal;
  box-sizing:border-box;
  scrollbar-width:none;
  -ms-overflow-style:none;
}

.code-editor textarea::-webkit-scrollbar {
  display:none;
}

.code-editor__caret-mirror {
  position:fixed;
  left:-10000px;
  top:0;
  opacity:0;
  pointer-events:none;
  z-index:var(--z-background);
  margin:0;
  border:0;
  resize:none;
  overflow:hidden;
}

.code-editor textarea::selection {
  background:var(--alpha-info-42);
  color:transparent;
  -webkit-text-fill-color:transparent;
}

.code-editor textarea::-moz-selection {
  background:var(--alpha-info-42);
  color:transparent;
}

/* Modo escritura: debe ir DESPUÉS de los estilos transparentes del textarea */
.code-editor.code-editor--typing .code-editor__highlight {
  visibility:hidden;
  opacity:0;
}

.code-editor.code-editor--typing textarea {
  color:var(--editor-text);
  -webkit-text-fill-color:var(--editor-text);
  background:var(--editor-bg);
}

.code-editor.code-editor--typing textarea::selection {
  background:var(--alpha-info-42);
  color:var(--editor-text);
  -webkit-text-fill-color:var(--editor-text);
}

.code-editor.code-editor--typing textarea::-moz-selection {
  background:var(--alpha-info-42);
  color:var(--editor-text);
}

.compile-panel--collapsible {
  display:flex;
  flex-direction:row-reverse;
  flex:0 0 40px;
  width:40px;
  min-width:40px;
  max-width:40px;
  flex-shrink:0;
  align-self:stretch;
  min-height:0;
  background:var(--surface);
  border-left:1px solid var(--line);
  border-right:none;
  overflow:hidden;
  position:relative;
  z-index:var(--z-raised);
}

.compile-panel--collapsible.is-open {
  flex:0 0 360px;
  width:360px;
  min-width:360px;
  max-width:360px;
}

.compile-panel__drawer {
  flex:1 1 auto;
  min-width:0;
  min-height:0;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

.compile-panel__drawer > .compile-panel__body {
  flex:1 1 0%;
  min-height:0;
  overflow-y:auto;
}

.compile-panel__toggle {
  width:40px;
  height:40px;
  border:none;
  border-bottom:1px solid var(--line);
  background:transparent;
  color:var(--muted);
  cursor:pointer;
  padding:0;
}

.compile-panel__chevron {
  display:inline-block;
  font-size:var(--text-16);
  transition:transform .25s;
}

.compile-panel--collapsible.is-open .compile-panel__chevron {
  transform:rotate(180deg);
}

.compile-panel__status {
  width:7px;
  height:7px;
  border-radius:var(--radius-round);
  background:var(--color-neutral-750);
  margin-top:16px;
}

.compile-panel__status.is-ok { background:var(--success); }
.compile-panel__status.is-error { background:var(--danger); }
.compile-panel__status.is-busy { background:var(--warning); animation:status-pulse 1.1s ease-in-out infinite; }

.compile-panel__label {
  margin-top:10px;
  font-size:var(--text-11);
  font-weight:600;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:var(--muted);
  writing-mode:vertical-rl;
  transform:rotate(180deg);
  user-select:none;
}

.compile-panel--collapsible .compile-panel__header {
  padding:20px;
  flex-shrink:0;
  border-bottom:1px solid var(--line);
}

.compile-panel--collapsible .compile-panel__body {
  padding:0 20px 20px;
}

.hint--warm {
  background:transparent;
  border:none;
  padding:0;
  color:var(--muted);
  font-size:var(--text-12);
  line-height:1.6;
}

.log--ide {
  background:var(--sidebar-dark);
  color:var(--editor-muted);
  font-family:var(--font-mono);
  font-size:var(--text-11);
  border-radius:var(--radius);
  max-height:208px;
}

.compile-button--secondary {
  width:100%;
  margin-top:8px;
}

/* ── MagicPath: IDE editor chrome ── */


.ide-meta-sep {
  width:1px;
  height:14px;
  background:var(--editor-border);
  margin:0 4px;
}

.ide-toolbar__meta {
  gap:4px;
}

.page-project--ide .dep-banner {
  flex-shrink:0;
}

/* ── MagicPath: compile panel (light) ── */
.compile-panel--ide.compile-panel {
  background:var(--color-neutral-50);
  border-left:1px solid var(--line);
  border-right:none;
  padding:0;
}

.compile-panel--ide .compile-panel__header h2 {
  margin:0;
  font-size:var(--text-15);
  font-weight:600;
  color:var(--ink);
}

.compile-panel--ide .compile-panel__header p {
  margin:4px 0 0;
  font-size:var(--text-12);
  color:var(--muted);
}

.compile-panel--ide .compile-panel__body {
  padding:0;
}

.compile-panel--ide .compile-panel__section {
  padding:16px 20px;
  border-bottom:1px solid var(--line);
}

.compile-panel--ide .section-label--compact {
  margin:0 0 12px;
}

.compile-panel--ide .status-grid {
  margin:0;
}

.compile-panel--ide input:not([type="file"]):not([type="checkbox"]),
.compile-panel--ide select {
  width:100%;
  margin-bottom:14px;
  padding:8px 12px;
  font-size:var(--text-13);
  color:var(--ink);
  background:var(--bg);
  border:1px solid var(--line);
  border-radius:var(--radius);
}

.compile-panel--ide input:focus,
.compile-panel--ide select:focus {
  border-color:var(--primary);
  box-shadow:0 0 0 3px var(--alpha-warm-10);
  outline:none;
}

.compile-panel--ide .field-checkbox {
  display:flex;
  align-items:flex-start;
  gap:8px;
  margin:0 0 10px;
  font-size:var(--text-12);
  line-height:1.45;
  color:var(--color-neutral-850);
  cursor:pointer;
}

.compile-panel--ide .field-checkbox input {
  margin:2px 0 0;
  width:auto;
}

.compile-panel--ide .compile-button--secondary {
  margin-top:0;

}

.compile-panel--ide .hint--warm {
  margin:12px 0 0;
}

.compile-panel--ide .hint--compile-main {
  margin:6px 0 12px;
  font-size:var(--text-11);
  line-height:1.45;
}

.compile-panel--ide .hint--compile-main code {
  font-size:var(--text-11);
}

.compile-panel--ide .compile-panel__section--log .muted {
  padding:0;
  margin:0;
}

.compile-panel--ide .compile-panel__section--log .log-toolbar {
  margin-bottom:8px;
}

.compile-panel--ide .log--ide {
  margin:0 20px 20px;
  max-height:180px;
}

.compile-panel--ide .compile-panel__drawer > .compile-panel__body > *:not(.compile-panel__section):not(.compile-progress) {
  padding-left:20px;
  padding-right:20px;
}

.compile-panel--ide .compile-progress {
  margin:16px 20px 0;
  height:2px;
  border-radius:var(--radius-pill);
  overflow:hidden;
}

@media (max-width: 900px) {


  .sidebar--dark {
    width:100%;
    min-width:0;
    max-height:40vh;
  }

  .editor-area--ide {
    min-height:50vh;
  }

  .compile-panel--collapsible,
.compile-panel--collapsible.is-open {
    flex:0 0 auto;
    width:100%;
    min-width:0;
    max-width:none;
  }

  .compile-panel--collapsible {
    flex-direction:column-reverse;
  }



  .compile-panel--collapsible.is-open .compile-panel__drawer {
    width:100%;
    max-height:50vh;
  }



  .compile-panel__label {
    writing-mode:horizontal-tb;
    transform:none;
    margin:0 0 0 8px;
  }
}

/* Shared selectors and responsive variants, in original cascade order. */
.workspace--ide {
  display:flex;
  flex:1;
  width:100%;
  min-width:0;
  min-height:0;
  border-top:none;
  background:var(--bg);
  align-items:stretch;
}

.sidebar-view-tabs {

  grid-template-columns:1fr 1fr;
  padding:6px 8px 0;
  border-bottom:1px solid var(--sidebar-border);
}

.sidebar-view-tab {

  color:var(--color-neutral-550);
  background:transparent;
  border:0;
  border-bottom:2px solid transparent;
  font:600 var(--text-11)/1 Inter, Segoe UI, sans-serif;
  letter-spacing:.08em;
  text-transform:uppercase;
  cursor:pointer;
}

.tree-file-row {
  display:flex;
  align-items:center;
  gap:4px;
  padding:4px 4px 4px 8px;
  border-radius:var(--radius-xs);
  min-width:0;
}

.tree-file-link__anchor {
  display:flex;
  align-items:center;
  gap:6px;
  min-width:0;
  flex:1;
  color:inherit;
  text-decoration:none;
}

.tree-summary--dark {
  padding:4px 8px;
  font-size:var(--text-12);
  color:var(--color-neutral-400);
  border-radius:var(--radius-xs);
}

.mini-section--dark {
  background:var(--color-blue-650);
  border:1px solid var(--sidebar-border);
  border-radius:var(--radius-xs);
  color:var(--color-neutral-400);
  font-size:var(--text-12);
}

@media (max-width: 900px) {
.workspace--ide {
    flex-direction:column;
    height:auto;
    min-height:0;
  }
}

@media (min-width: 901px) {
.workspace--ide .sidebar--dark { flex:0 0 var(--sidebar-width, 220px); width:var(--sidebar-width, 220px); min-width:0; }
}

@media (min-width: 901px) {
.workspace--ide.is-sidebar-hidden .sidebar--dark { display:none; }
}

.tree-file-row { min-height:28px; padding-block:0; }

.tree-file-link__anchor { align-self:stretch; min-height:28px; }

.tree-summary--dark { min-height:28px; padding-block:2px; }

.sidebar-view-tabs { display:flex; flex-wrap:wrap; gap:0 4px; }

.sidebar-view-tab { flex:1 0 auto; padding:8px 6px; }

.mini-section--dark { padding:0; margin-bottom:6px; }

.page-home .project-filter {
  box-sizing:border-box;
  width:100%;

  margin:0;
  padding:0 12px;
  border:1px solid var(--ctl-border);
  border-radius:var(--radius);
  background:var(--surface);
  color:var(--ink);
  font-size:var(--text-14);
  text-transform:none;
  letter-spacing:0;
}

.page-home .project-filter { height:var(--ctl-h); }





@media (max-width: 900px) {
.workspace--ide { overflow-y:auto; overscroll-behavior-y:contain; }
}

@media (max-width: 900px) {
.workspace--ide .sidebar--dark { flex:0 0 auto; max-height:45vh; overflow-y:auto; border-right:0; border-bottom:1px solid var(--sidebar-border); }
}

@media (max-width: 900px) {
.workspace--ide.is-sidebar-hidden .sidebar--dark { display:none; }
}



@media (pointer: coarse) {
.page-home .project-filter { min-height:var(--tap-min); }
}
