.plugin-page-layout {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
}

.plugin-page-header {
  flex-shrink: 0;
  border-bottom: 1px solid var(--ms-color-border);
  background: var(--app-shell-slot-center-background, var(--ms-app-shell-slot-center-background, var(--ms-color-page-background)));
  padding: var(--ms-space-3) var(--ms-space-5);
}

.plugin-page-header__inner {
  display: flex;
  min-height: 72px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ms-space-3);
}

.plugin-page-header__copy {
  min-width: 0;
}

.plugin-page-header__title-row {
  display: flex;
  align-items: center;
  gap: var(--ms-space-2);
}

.plugin-page-header__actions {
  display: flex;
  align-items: center;
  gap: var(--ms-space-2);
}

.plugin-page-tab-bar {
  flex-shrink: 0;
  border-bottom: 1px solid var(--ms-color-border);
  padding: var(--ms-space-2) var(--ms-space-5);
}

.plugin-page-scroll-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
}

.plugin-page-scroll-body[data-padded="true"] {
  padding: var(--ms-space-4);
}

.plugin-page-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--ms-space-3);
}

.plugin-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(0 0 0 / 40%);
}

@media (min-width: 768px) {
  .plugin-page-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .plugin-page-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.plugin-dialog-surface {
  width: 100%;
  max-width: 28rem;
  padding: 20px;
  box-shadow: var(--ms-shadow-lg);
}

.plugin-dialog-title {
  margin: 0 0 4px;
  color: var(--ms-color-foreground);
  font-size: var(--ms-text-body);
  font-weight: 600;
  line-height: var(--ms-leading-body);
}

.plugin-dialog-description {
  margin: 0 0 var(--ms-space-4);
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-label);
  line-height: var(--ms-leading-label);
}

.plugin-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--ms-space-2);
}

.plugin-card-surface {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  transition: border-color var(--ms-duration-fast) var(--ms-easing-standard);
}

.plugin-card-surface[data-spacing="compact"] {
  gap: var(--ms-space-2);
}

.plugin-card-surface:hover {
  border-color: color-mix(in srgb, var(--ms-color-primary) 50%, transparent);
}

.plugin-card-header,
.plugin-card-footer,
.plugin-marketplace-toolbar {
  display: flex;
  align-items: center;
  gap: var(--ms-space-2);
}

.plugin-card-header {
  align-items: flex-start;
  justify-content: space-between;
}

.plugin-card-copy {
  min-width: 0;
}

.plugin-card-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

.plugin-card-title {
  margin: 0;
  overflow: hidden;
  color: var(--ms-color-foreground);
  font-size: var(--ms-text-body);
  font-weight: 600;
  line-height: var(--ms-leading-body);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plugin-card-meta,
.plugin-card-description,
.plugin-card-id,
.plugin-card-download-meta {
  color: var(--ms-color-muted-foreground);
}

.plugin-card-meta {
  margin: 2px 0 0;
  font-size: var(--ms-text-label);
  line-height: var(--ms-leading-label);
}

.plugin-card-description {
  margin: 0;
  font-size: var(--ms-text-label);
  line-height: 20px;
}

.plugin-card-footer {
  margin-top: auto;
  justify-content: space-between;
  padding-top: 4px;
}

.plugin-card-id {
  margin: 0;
  max-width: 160px;
  overflow: hidden;
  font-family: var(--ms-font-mono);
  font-size: var(--ms-text-caption);
  line-height: var(--ms-leading-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plugin-card-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.plugin-card-download-meta {
  margin-left: auto;
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: var(--ms-text-caption);
  line-height: var(--ms-leading-caption);
}

.plugin-marketplace-toolbar {
  margin-bottom: var(--ms-space-4);
}

.plugin-search-field {
  position: relative;
  width: 100%;
  max-width: 24rem;
}

.plugin-search-field__icon {
  pointer-events: none;
  position: absolute;
  top: 50%;
  left: 10px;
  display: flex;
  transform: translateY(-50%);
  color: var(--ms-color-muted-foreground);
}

.plugin-search-input {
  padding-left: 2rem;
  font-size: var(--ms-text-body);
  line-height: var(--ms-leading-body);
}

.plugin-file-input {
  display: none;
}

.plugin-button-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
}

.plugin-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--ms-space-2);
}

.plugin-empty-state {
  min-width: 0;
}

.plugin-empty-state[data-layout="marketplace"] {
  height: 320px;
}

.plugin-state-banner {
  flex-shrink: 0;
  border-right-width: 0;
  border-left-width: 0;
  border-top-width: 0;
  border-radius: 0;
  padding: 8px 20px;
  font-size: var(--ms-text-label);
}

.plugin-state-banner .app-state-message__content {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
}

.plugin-tab-group {
  width: fit-content;
}

.plugin-tab-button {
  gap: 0.375rem;
  font-size: var(--ms-text-body);
  font-weight: 500;
  line-height: var(--ms-leading-body);
}

.plugin-tab-count {
  margin-left: 0.375rem;
  padding: 0 6px;
  font-size: var(--ms-text-caption);
  line-height: var(--ms-leading-caption);
}

.plugin-inline-meta {
  padding: 0 6px;
  font-size: var(--ms-text-caption);
  line-height: var(--ms-leading-caption);
}

.plugin-banner-dismiss-action {
  margin-left: auto;
}

.plugin-status-meta {
  flex-shrink: 0;
  padding: 0 8px;
  white-space: nowrap;
  font-size: var(--ms-text-label);
  line-height: var(--ms-leading-label);
}

.plugin-tag-meta {
  padding: 0 6px;
  font-size: var(--ms-text-caption);
  line-height: var(--ms-leading-caption);
}

.plugin-tone-text {
  min-width: 0;
}

.plugin-tool-root {
  --tool-page-background: var(--app-shell-slot-center-background, var(--ms-app-shell-slot-center-background, var(--ms-color-page-background)));
  display: flex;
  height: 100%;
  flex-direction: column;
  background: var(--tool-page-background);
}

.plugin-tool-native-layout {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.plugin-tool-main {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px;
}

.plugin-tool-form-stack {
  width: 100%;
  max-width: 46rem;
  margin-inline: auto;
  display: grid;
  gap: 12px;
}

.plugin-tool-field {
  display: flex;
  flex-direction: column;
  gap: var(--ms-space-1);
}

.plugin-tool-field__label {
  color: var(--ms-color-foreground);
  font-size: var(--ms-text-label);
  font-weight: 500;
  line-height: var(--ms-leading-label);
}

.plugin-tool-field__description {
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-caption);
  line-height: var(--ms-leading-caption);
}

.plugin-tool-surface,
.plugin-tool-muted-surface {
  --ui-surface-border: color-mix(in srgb, var(--ms-color-border) 64%, transparent);
  --ui-surface-background: var(--ms-color-surface);
  padding: 12px;
}

.plugin-tool-info-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--ms-space-3);
  margin-bottom: 12px;
  border-radius: var(--ms-radius-sm);
  background: color-mix(in srgb, var(--ms-color-muted) 16%, transparent);
  padding: 10px;
}

.plugin-tool-info-copy {
  min-width: 0;
}

.plugin-tool-version-meta {
  flex: 0 0 auto;
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-label);
  line-height: var(--ms-leading-label);
}

.plugin-tool-resource-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--ms-space-3);
}

.plugin-tool-field-stack {
  display: grid;
  gap: 10px;
}

.plugin-tool-action-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--ms-color-border) 42%, transparent);
  padding-top: 10px;
}

.plugin-tool-inline-resource {
  gap: var(--ms-space-1);
  font-size: var(--ms-text-caption);
}

.plugin-tool-icon-button {
  color: var(--ms-color-muted-foreground);
}

.plugin-tool-icon-button:hover {
  color: var(--ms-color-foreground);
}

.plugin-tool-result-title {
  margin-bottom: var(--ms-space-2);
  color: var(--ms-color-muted-foreground);
  font-family: var(--ms-font-sans);
  font-size: var(--ms-text-tiny);
  font-weight: 600;
  letter-spacing: 0;
  line-height: var(--ms-leading-caption);
  text-transform: uppercase;
}

.plugin-tool-state-message {
  display: block;
  font-size: var(--ms-text-label);
}

.plugin-tool-state-message .plugin-tool-result-title {
  color: inherit;
}

.plugin-tool-code-block {
  padding: 0;
  overflow-wrap: anywhere;
  color: inherit;
  font-size: var(--ms-text-label);
}

.plugin-tool-loading-state,
.plugin-tool-not-found-state {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
}

.plugin-tool-not-found-state {
  flex-direction: column;
  gap: var(--ms-space-3);
  text-align: center;
}

.plugin-tool-not-found-state__title {
  color: var(--ms-color-foreground);
  font-size: var(--ms-text-body);
  font-weight: 500;
  line-height: var(--ms-leading-body);
}

.plugin-tool-webview-frame {
  min-height: 0;
  flex: 1 1 auto;
}

.plugin-tool-iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
