@layer components {
	.ui-button {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: 6px;
		min-height: 28px;
		padding: 4px 10px;
		border: 1px solid transparent;
		border-radius: 4px;
		font: inherit;
		line-height: 1.2;
		cursor: pointer;
		user-select: none;
	}

	.ui-button:hover:not(:disabled) {
		background: var(--vscode-button-hoverBackground, #0e639c);
	}

	.ui-button:disabled {
		opacity: 0.5;
		cursor: not-allowed;
	}

	.ui-button-primary {
		color: var(--vscode-button-foreground, #ffffff);
		background: var(--vscode-button-background, var(--vscode-focusBorder));
	}

	.ui-button-primary:hover:not(:disabled) {
		background: var(--vscode-button-hoverBackground, #0e639c);
	}

	.ui-button-secondary {
		color: var(--vscode-button-secondaryForeground, var(--vscode-foreground));
		background: var(--vscode-button-secondaryBackground, rgba(255, 255, 255, 0.08));
		border-color: var(--vscode-button-border, transparent);
	}

	.ui-button-secondary:hover:not(:disabled) {
		background: var(--vscode-button-secondaryHoverBackground, #4a4d51);
	}

	.ui-button-danger {
		color: var(--vscode-errorForeground, #f48771);
		background: transparent;
		border-color: color-mix(in srgb, var(--vscode-errorForeground, #f48771) 45%, transparent);
	}

	.ui-button-danger:hover:not(:disabled) {
		background: color-mix(in srgb, var(--vscode-errorForeground, #f48771) 14%, transparent);
	}

	.ui-button-compact {
		min-height: 24px;
		padding: 3px 8px;
		font-size: 12px;
	}

	.ui-input,
	.ui-textarea {
		width: 100%;
		padding: 8px 10px;
		border: 1px solid var(--vscode-input-border, var(--vscode-panel-border));
		border-radius: 4px;
		background: var(--vscode-input-background, rgba(255, 255, 255, 0.06));
		color: var(--vscode-input-foreground, var(--vscode-foreground));
		font: inherit;
	}

	.ui-textarea {
		line-height: 1.5;
		resize: vertical;
	}

	.ui-input:focus,
	.ui-textarea:focus {
		outline: 1px solid var(--vscode-focusBorder, #007fd4);
		outline-offset: 1px;
	}

	.ui-input-readonly,
	.ui-input[readonly] {
		opacity: 0.7;
		cursor: not-allowed;
	}

	.ui-input-disabled,
	.ui-input:disabled {
		opacity: 0.6;
		cursor: not-allowed;
	}

	.ui-tab {
		border: none;
		color: var(--vscode-tab-inactiveForeground, var(--vscode-foreground));
		background: transparent;
	}

	.ui-tab:hover {
		color: var(--vscode-tab-activeForeground, var(--vscode-foreground));
	}

	.ui-tab-active {
		color: var(--vscode-tab-activeForeground, var(--vscode-foreground));
	}

	.ui-badge {
		display: inline-flex;
		align-items: center;
		padding: 2px 8px;
		border-radius: 999px;
		font-size: 11px;
		font-weight: 500;
		text-transform: uppercase;
		letter-spacing: 0.04em;
	}

	.ui-panel-entry {
		border: 1px solid var(--vscode-panel-border);
		border-radius: 4px;
		background-color: var(--vscode-sideBar-background);
	}

	.ui-empty-state {
		display: flex;
		flex-direction: column;
		gap: 6px;
		color: var(--vscode-descriptionForeground);
	}

	.ui-editor-shell {
		height: 100%;
		min-height: 0;
		display: flex;
		flex-direction: column;
		overflow: hidden;
		background: var(--vscode-editor-background);
	}

	.ui-editor-header {
		display: flex;
		align-items: flex-start;
		justify-content: space-between;
		gap: 12px;
		min-height: 35px;
		padding: 0 12px;
		border-bottom: 1px solid var(--vscode-panel-border);
		background: var(--vscode-tab-activeBackground);
	}

	.ui-editor-tab-current {
		display: inline-flex;
		max-width: 100%;
		align-items: center;
		gap: 6px;
		overflow: hidden;
		padding: 6px 12px;
		border-radius: 4px 4px 0 0;
		background: var(--vscode-tab-activeBackground);
		color: var(--vscode-tab-activeForeground);
	}

	.ui-editor-actions {
		display: flex;
		align-items: center;
		justify-content: flex-end;
		gap: 8px;
		flex-wrap: wrap;
	}

	.ui-toolbar {
		display: flex;
		align-items: center;
		gap: 12px;
		min-height: 32px;
	}

	.ui-toolbar-group {
		display: flex;
		align-items: center;
		gap: 8px;
		min-width: 0;
	}

	.ui-field-stack {
		display: flex;
		flex-direction: column;
		gap: 6px;
		min-width: 0;
	}

	.ui-field-stack > label,
	.ui-field-label {
		font-size: 11px;
		font-weight: 500;
		color: var(--vscode-descriptionForeground);
		text-transform: uppercase;
		letter-spacing: 0.5px;
	}

	.ui-field-grid-2,
	.ui-field-grid-3 {
		display: grid;
		gap: 16px;
	}

	.ui-dropdown-menu {
		background: var(--vscode-dropdown-background, var(--vscode-sideBar-background));
		border: 1px solid var(--vscode-dropdown-border, var(--vscode-panel-border));
		border-radius: 6px;
		box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
		overflow: hidden;
	}

	.ui-dropdown-item {
		display: flex;
		align-items: flex-start;
		gap: 10px;
		width: 100%;
		padding: 10px 12px;
		border: none;
		background: transparent;
		color: var(--vscode-dropdown-foreground, var(--vscode-foreground));
		cursor: pointer;
		text-align: left;
		transition: background 0.1s;
	}

	.ui-dropdown-item:hover:not(:disabled) {
		background: var(--vscode-list-hoverBackground, #2a2d2e);
	}

	.ui-dropdown-item:disabled {
		opacity: 0.5;
		cursor: not-allowed;
	}

	.ui-section-card {
		border: 1px solid var(--vscode-panel-border);
		border-radius: 8px;
		background: color-mix(in srgb, var(--vscode-editor-background) 84%, var(--vscode-input-background));
	}

	.btn-base {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: 6px;
		min-height: 28px;
		padding: 4px 10px;
		border: 1px solid transparent;
		border-radius: 4px;
		font: inherit;
		line-height: 1.2;
		cursor: pointer;
		user-select: none;
	}

	.btn-theme-primary {
		color: var(--vscode-button-foreground, #ffffff);
		background: var(--vscode-button-background, var(--vscode-focusBorder));
	}

	.btn-theme-primary:hover {
		background: var(--vscode-button-hoverBackground, #0e639c);
	}

	.btn-theme-danger {
		color: var(--vscode-errorForeground, #f48771);
		background: transparent;
		border-color: color-mix(in srgb, var(--vscode-errorForeground, #f48771) 45%, transparent);
	}

	.btn-theme-danger:hover {
		background: color-mix(in srgb, var(--vscode-errorForeground, #f48771) 14%, transparent);
	}

	.panel-entry {
		border: 1px solid var(--vscode-panel-border);
		border-radius: 4px;
		background-color: var(--vscode-sideBar-background);
	}

	.monaco-host {
		min-width: 0;
		min-height: 0;
		overflow: hidden;
	}
}

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

	.ui-field-grid-3 {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
	}
}
