/* ================================================================== */
/* Panel headers — S2 Title/XS style                                  */
/* ================================================================== */
.panel-header {
  display: flex;
  align-items: center;
  padding: var(--s2-spacing-100) var(--s2-spacing-300);
  background: var(--s2-bg-layer-1);
  border-bottom: 1px solid var(--s2-border-subtle);
  font-size: var(--s2-font-size-50);
  font-weight: 700;
  color: var(--s2-content-tertiary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ================================================================== */
/* Terminal panel — clean, minimal chrome                              */
/* ================================================================== */
.terminal-panel {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--s2-bg-layer-1);
}
.terminal-panel__view {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--s2-bg-sunken);
  padding-bottom: 5px;
}
.terminal-panel__mount {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.terminal-panel__terminal-host {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}
/* xterm.js overrides */
.terminal-panel__terminal-host .xterm {
  padding: 0;
}
.terminal-panel__terminal-host .xterm-viewport {
  background-color: var(--s2-bg-sunken) !important;
}
.terminal-panel__terminal-host .xterm-viewport::-webkit-scrollbar {
  width: 6px;
}
.terminal-panel__terminal-host .xterm-viewport::-webkit-scrollbar-thumb {
  background: var(--s2-gray-300);
  border-radius: 3px;
}
.terminal-panel__preview {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: var(--s2-spacing-200);
  background: var(--s2-bg-sunken);
}
.terminal-panel__preview.terminal-panel__preview--visible {
  display: flex;
  flex-direction: column;
}
.terminal-panel__preview-item {
  display: flex;
  flex-direction: column;
  gap: var(--s2-spacing-100);
}
.terminal-panel__preview-item + .terminal-panel__preview-item {
  margin-top: var(--s2-spacing-200);
}
.terminal-panel__preview-label {
  color: var(--s2-content-tertiary);
  font-size: var(--s2-font-size-50);
  font-family: var(--s2-font-mono);
}
.terminal-panel__preview-media {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: min(100%, 520px);
  object-fit: contain;
  border-radius: var(--s2-radius-default);
  background: var(--s2-bg-sunken);
  border: 1px solid var(--s2-border-subtle);
}
.terminal-panel__empty-state {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s2-spacing-400);
  color: var(--s2-content-disabled);
  font-size: var(--s2-font-size-75);
}

/* ================================================================== */
/* File browser — S2 Tree View pattern                                */
/* ================================================================== */
/* File browser header — toolbar with title + actions */
.file-browser__header {
  display: flex;
  align-items: center;
  height: 32px;
  min-height: 32px;
  padding: 0 var(--s2-spacing-200);
  border-bottom: 1px solid var(--s2-border-subtle);
  flex-shrink: 0;
  gap: var(--s2-spacing-100);
}
.file-browser__header-title {
  font-size: var(--s2-font-size-50);
  font-weight: 700;
  color: var(--s2-content-tertiary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex: 1;
}
.file-browser__header-btn {
  background: transparent;
  border: none;
  color: var(--s2-content-tertiary);
  cursor: pointer;
  width: 24px;
  height: 24px;
  border-radius: var(--s2-radius-s);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition:
    background var(--s2-transition-default),
    color var(--s2-transition-default);
}
.file-browser__header-btn:hover {
  background: var(--s2-gray-200);
  color: var(--s2-content-default);
}
.file-browser__header-btn svg {
  width: 14px;
  height: 14px;
}
.file-browser__header-btn--active {
  color: var(--s2-content-default);
  background: var(--s2-gray-300);
}
.file-browser__header-btn--active:hover {
  background: var(--s2-gray-300);
}
.file-browser__header-btn:disabled {
  color: var(--s2-content-disabled);
  cursor: default;
}
.file-browser__header-btn:disabled:hover {
  background: transparent;
  color: var(--s2-content-disabled);
}

.file-browser {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.file-browser__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--s2-spacing-50) 0;
  font-family: var(--s2-font-mono);
  font-size: var(--s2-font-size-75);
}
.file-browser__item {
  display: flex;
  align-items: center;
  gap: var(--s2-spacing-50);
  padding: 3px var(--s2-spacing-100);
  color: var(--s2-content-default);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: var(--s2-radius-s);
  margin: 0 var(--s2-spacing-50);
  transition: background var(--s2-transition-default);
}
.file-browser__item:hover {
  background: var(--s2-bg-elevated);
}
.file-browser__item--selected {
  background: var(--s2-bg-elevated);
  box-shadow: inset 2px 0 0 var(--s2-accent);
}
.file-browser__item--selected:hover {
  background: var(--s2-bg-elevated);
}
.file-browser__item--selected.file-browser__item--copy-flash {
  background: color-mix(in srgb, var(--s2-positive) 20%, transparent);
}
.file-browser__arrow {
  width: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--s2-content-tertiary);
}
.file-browser__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: var(--s2-content-tertiary);
}
.file-browser__name {
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-browser__size {
  margin-left: auto;
  color: var(--s2-content-tertiary);
  font-size: var(--s2-font-size-50);
  flex-shrink: 0;
  padding-left: var(--s2-spacing-100);
}
.file-browser__action-btn {
  background: transparent;
  border: none;
  color: var(--s2-content-tertiary);
  cursor: pointer;
  font-size: 9px;
  padding: 2px var(--s2-spacing-75);
  border-radius: var(--s2-radius-pill);
  flex-shrink: 0;
  line-height: 1.2;
  font-family: var(--s2-font-mono);
  font-weight: 600;
  letter-spacing: 0.05em;
  transition: all var(--s2-transition-default);
  opacity: 0;
}
.file-browser__item:hover .file-browser__action-btn {
  opacity: 1;
}
.file-browser__action-btn:hover {
  background: var(--s2-accent);
  color: #fff;
}
.file-browser__action-btn:active {
  transform: scale(0.92);
}
.file-browser__action-btn:disabled {
  opacity: 0;
  cursor: not-allowed;
}

/* ================================================================== */
/* Memory panel                                                       */
/* ================================================================== */
.memory-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.memory-panel__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--s2-spacing-100);
  font-family: var(--s2-font-mono);
  font-size: var(--s2-font-size-75);
  height: 100%;
}
.memory-panel__section {
  margin-bottom: var(--s2-spacing-300);
}
.memory-panel__section-header {
  font-weight: 700;
  font-family: var(--s2-font-family);
  color: var(--slicc-cone);
  margin-bottom: var(--s2-spacing-100);
  padding-bottom: var(--s2-spacing-50);
  border-bottom: 1px solid var(--s2-border-subtle);
  font-size: var(--s2-font-size-75);
}
.memory-panel__memory-content {
  white-space: pre-wrap;
  color: var(--s2-content-default);
  line-height: 1.5;
  background: var(--s2-bg-sunken);
  padding: var(--s2-spacing-100);
  border-radius: var(--s2-radius-default);
}
