:host {
  display: block;
  width: 100%;
  min-height: 100%;
}

.theme-settings {
  min-width: 0;
}

.theme-settings__workspace-selector {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.theme-settings__workspace-selector--compact {
  gap: 0.35rem;
}

.theme-settings__workspace-selector--mobile {
  display: none;
}

.theme-settings__workspace-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.theme-settings__workspace-tab {
  min-height: 5rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  background: hsl(var(--secondary) / 0.22);
  padding: 0.8rem 0.9rem;
  text-align: left;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

.theme-settings__workspace-tab:hover {
  background: hsl(var(--secondary) / 0.42);
}

.theme-settings__workspace-tab--active {
  border-color: hsl(var(--primary) / 0.45);
  background: hsl(var(--primary) / 0.1);
  box-shadow: inset 0 0 0 1px hsl(var(--primary) / 0.1);
}

.theme-settings__workspace-tab-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: hsl(var(--foreground));
}

.theme-settings__workspace-tab-description {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.74rem;
  line-height: 1.45;
  color: hsl(var(--muted-foreground));
}

.theme-settings__workspace-selector-label {
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}

.theme-settings__workspace-select {
  width: 100%;
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  background: hsl(var(--secondary));
  padding: 0.6rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.theme-settings__workspace-select:focus {
  border-color: hsl(var(--primary) / 0.4);
  box-shadow: 0 0 0 1px hsl(var(--primary) / 0.2);
}

.theme-settings__workspace-selector--compact .theme-settings__workspace-select {
  padding: 0.55rem 0.7rem;
  font-size: 0.84rem;
}

.theme-settings__workspace {
  display: grid;
  align-items: stretch;
  grid-template-columns: minmax(17rem, 22rem) minmax(0, 1fr);
  gap: 0.75rem;
}

.theme-settings__sidebar {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 0.75rem;
}

.theme-settings__main {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 0.75rem;
}

.theme-settings__editor-card {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.theme-settings__editor-panel {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.theme-settings__saved-theme-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.theme-settings__saved-theme-button {
  width: 100%;
  border: 1px solid hsl(var(--border) / 0.8);
  border-radius: 0.5rem;
  background: hsl(var(--secondary) / 0.25);
  padding: 0.75rem;
  text-align: left;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.theme-settings__saved-theme-button:hover {
  background: hsl(var(--secondary) / 0.45);
}

.theme-settings__saved-theme-button--active {
  border-color: hsl(var(--primary) / 0.35);
  background: hsl(var(--primary) / 0.08);
}

.theme-settings__explorer-card {
  display: flex;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  flex-direction: column;
}

.theme-settings__explorer-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.25rem;
}

.theme-json-editor-panel__header {
  min-width: 0;
}

.theme-json-editor-panel__title {
  font-size: 0.85rem;
  font-weight: 700;
  color: hsl(var(--foreground));
}

.theme-json-editor-panel__caption {
  margin-top: 0.2rem;
  font-size: 0.74rem;
  line-height: 1.45;
  color: hsl(var(--muted-foreground));
}

.theme-settings--fullscreen .theme-settings__editor-panel app-theme-json-code-editor {
  display: block;
  min-height: 0;
  flex: 1 1 auto;
}

@media (max-width: 780px) {
  .theme-settings__workspace-tabs {
    display: none;
  }

  .theme-settings__workspace-selector--mobile {
    display: flex;
  }

  .theme-settings__workspace {
    display: flex;
    flex-direction: column;
  }

  .theme-settings__explorer-card {
    max-height: min(28rem, calc(100vh - 10rem));
  }
}
