.command-palette-v2 {
  overflow: hidden;
}

/* Anchor to the top edge of where a centered 480px-tall dialog would sit, so the
   top stays put while the content-driven height grows and shrinks. */
[data-component="dialog-v2"]:has(.command-palette-v2) {
  align-items: flex-start;
}

[data-component="dialog-v2"]:has(.command-palette-v2) [data-slot="dialog-container"] {
  width: min(calc(100vw - 24px), 640px);
  height: auto;
  min-height: 280px;
  max-height: min(calc(100vh - 96px), 480px);
  margin-top: max(48px, calc((100vh - 480px) / 2));
  border-radius: 12px;
  background: var(--v2-background-bg-base);
  box-shadow: var(--v2-elevation-floating);
}

.command-palette-v2-body {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.command-palette-v2-search {
  flex-shrink: 0;
  padding: 6px;
}

.command-palette-v2-search [data-component="text-input-v2"] {
  width: 100%;
  height: 36px;
  border-radius: 6px;
  outline: 0;
  background: color-mix(in srgb, var(--v2-background-bg-layer-02) 60%, transparent);
  box-shadow: none;
  transition:
    background-color 120ms ease-in-out,
    box-shadow 120ms ease-in-out;
}

.command-palette-v2-search [data-component="text-input-v2"]:where(:hover):not([data-disabled], [data-invalid]),
.command-palette-v2-search [data-component="text-input-v2"]:where(:focus-within):not([data-disabled], [data-invalid]) {
  background: var(--v2-background-bg-layer-02);
  box-shadow: none;
}

.command-palette-v2-search [data-component="text-input-v2"] [data-slot="text-input-v2-value"] {
  border-radius: 6px;
  background: transparent;
  gap: 8px;
}

.command-palette-v2-search [data-component="text-input-v2"] [data-slot="text-input-v2-leading-icon"] {
  padding-left: 12px;
}

.command-palette-v2-search [data-component="text-input-v2"] [data-slot="text-input-v2-input"] {
  border-radius: 6px;
  background: transparent;
}

.command-palette-v2-scroll {
  min-height: 0;
  flex: 1;
}

.command-palette-v2-results {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 6px 6px 8px;
}

.command-palette-v2-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.command-palette-v2-group-title {
  margin: 6px 0;
  padding: 0 12px;
  color: var(--v2-text-text-muted);
  font-size: 13px;
  font-weight: 440;
  line-height: 16px;
  letter-spacing: -0.04px;
  user-select: none;
}

.command-palette-v2-row {
  display: flex;
  width: 100%;
  height: 36px;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--v2-text-text-base);
  text-align: left;
  cursor: default;
  scroll-margin: 6px 0;
}

.command-palette-v2-row[data-active] {
  background: var(--v2-overlay-simple-overlay-hover);
}

.command-palette-v2-row:focus-visible {
  background: var(--v2-overlay-simple-overlay-hover);
  outline: none;
}

.command-palette-v2-row-main {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 8px;
}

.command-palette-v2-row-icon {
  flex-shrink: 0;
  color: var(--v2-icon-icon-muted);
}

.command-palette-v2-row-text {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.command-palette-v2-title {
  min-width: 0;
  overflow: hidden;
  color: var(--v2-text-text-base);
  font-size: 13px;
  font-weight: 530;
  line-height: 16px;
  letter-spacing: -0.04px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-palette-v2-description,
.command-palette-v2-meta {
  min-width: 0;
  overflow: hidden;
  color: var(--v2-text-text-muted);
  font-size: 13px;
  font-weight: 440;
  line-height: 16px;
  letter-spacing: -0.04px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-palette-v2-meta {
  flex-shrink: 0;
}

.command-palette-v2-file-path {
  display: flex;
  min-width: 0;
  align-items: baseline;
  font-size: 13px;
  line-height: 16px;
  letter-spacing: -0.04px;
}

.command-palette-v2-file-dir {
  min-width: 0;
  overflow: hidden;
  color: var(--v2-text-text-muted);
  font-weight: 440;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-palette-v2-file-name {
  flex-shrink: 0;
  color: var(--v2-text-text-base);
  font-weight: 530;
  white-space: nowrap;
}

.command-palette-v2-state {
  display: grid;
  min-height: 120px;
  place-items: center;
  color: var(--v2-text-text-muted);
  font-size: 13px;
  font-weight: 440;
  line-height: 16px;
  letter-spacing: -0.04px;
}

@media (max-width: 640px) {
  .command-palette-v2-row-text {
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
  }

  .command-palette-v2-description {
    max-width: 100%;
  }
}
