/* Script workspace — full-viewport editor shell */
body.script-editor-page {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Manrope', system-ui, sans-serif;
  background: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(99, 102, 241, 0.18), transparent 55%),
    linear-gradient(165deg, #0c0e14 0%, #12151e 45%, #0a0c11 100%);
  color: #e8eaef;
}

.script-editor-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 12, 18, 0.85);
  backdrop-filter: blur(12px);
}

.script-editor-top h1 {
  margin: 0;
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.script-editor-sub {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: rgba(232, 234, 239, 0.55);
  max-width: 36rem;
  line-height: 1.35;
}

.script-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.script-editor-toolbar label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(232, 234, 239, 0.45);
  display: block;
  margin-bottom: 0.15rem;
}

.script-editor-field {
  display: flex;
  flex-direction: column;
}

.script-editor-field select {
  min-width: 14rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 24, 34, 0.95);
  color: #e8eaef;
  font-size: 0.85rem;
}

.script-editor-actions {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e8eaef;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.04);
}

#editorStatus {
  font-size: 0.8rem;
  color: rgba(182, 190, 204, 0.9);
  padding: 0.35rem 0.5rem;
  min-width: 8rem;
}

#editorStatus.dirty {
  color: #fbbf24;
}

#editorStatus.error {
  color: #f87171;
}

#editorStatus.ok {
  color: #34d399;
}

.workspace-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0.75rem;
  padding: 0.75rem;
}

.scripts-panel {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(20, 23, 31, 0.75);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.scripts-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.scripts-panel-head h2 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.scripts-head-actions {
  display: flex;
  gap: 0.35rem;
}

.scripts-head-actions .btn-ghost {
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
}

.scripts-list {
  padding: 0.35rem;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.script-item {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: #e8eaef;
  border-radius: 8px;
  text-align: left;
  padding: 0.5rem 0.55rem;
  cursor: pointer;
}

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

.script-item.active {
  border-color: rgba(99, 102, 241, 0.95);
  background: rgba(99, 102, 241, 0.2);
}

.script-item-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
}

.script-item-meta {
  font-size: 0.66rem;
  color: rgba(232, 234, 239, 0.6);
  margin-top: 0.2rem;
}

.editor-shell {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.active-script-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: rgba(232, 234, 239, 0.78);
  padding: 0 0.2rem;
}

#editorHost {
  flex: 1;
  min-height: 400px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

@media (max-width: 920px) {
  .workspace-layout {
    grid-template-columns: 1fr;
  }

  .scripts-panel {
    max-height: 220px;
  }
}
