form {
	margin: 0;
}

form + pre.comment {
	margin-top: 30px;
}

form > p {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 5px;
}

input[type="checkbox"], input[type="radio"] {
	cursor: pointer;
	margin: 2px 0;
	margin-inline-end: 5px;
	position: relative;
}

.right input[type="checkbox"], .right input[type="radio"] {
	margin-inline-start: 5px;
	margin-inline-end: 0;
}

input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible {
	outline-offset: 1px;
	border-radius: 0.5px;
}

input[type="number"] {
	-moz-appearance: textfield;
}

input[type="file"] {
	cursor: pointer;
}

input[type="file"]:focus-visible {
	outline-offset: 1px;
	border-radius: calc(var(--input-border-radius) / 2);
}

input::-webkit-inner-spin-button {
	-webkit-appearance: none;
}

input.required {
	border-color: var(--required-border);
}

input.maxlength {
	border-color: var(--required-border);
}

input::placeholder {
	color: var(--input-text);
	opacity: 0.4;
}

.input, select, textarea {
	padding: 4px 6px;
	border: 1px solid var(--input-border);
	border-radius: var(--input-border-radius);
	background: var(--input-bg);
	color: var(--input-text);
	font-size: 100%;
	max-width: 100%;
}

textarea {
	position: relative;
	/* We have to use top, because baseline alignment does not work on Chrome as expected. */
	vertical-align: top;
	margin-top: -5px;
	font-family: var(--font-family);
	line-height: 1.4;
}

select {
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}

select:not([size]) {
	padding-inline-end: 18px;
	background: var(--input-bg) var(--select-arrow) right center no-repeat;
	background-size: 16px;
}

.rtl select:not([size]) {
	background-position: left center;
}

label {
	display: inline-block;
	padding: 5px 0 3px;
	cursor: pointer;
	/* Firefox tuning to make labels height the same as buttons/inputs. */
	line-height: 1.357;
}

label.disabled {
	opacity: 0.3;
	filter: saturate(0);
	pointer-events: none;
}

label input[type="checkbox"], label input[type="radio"] {
	margin-top: 0;
	margin-bottom: 0;
}

.labels {
	display: inline-flex;
	flex-wrap: wrap;
	column-gap: 0.5rem;
}

* + .labels, *:not(label) + label {
	margin-inline-start: 0.3rem;
}

/* Note: pre.jush is used also as an input field for JSON column type. */
pre.jush {
	padding: 4px 6px !important;
	border: 1px solid var(--input-border) !important;
	border-radius: var(--input-border-radius);
	background: var(--input-bg);
	font-family: var(--font-family-mono);
	font-size: calc(var(--font-size-mono) * 100% / 14);
	font-variant-ligatures: none;
}

.sqlarea {
	position: inherit;
	width: 100%;
}

.input-hint {
	position: relative;
	padding-left: 1.3em;
	display: block;
	margin-top: 3px;
	color: var(--note-text);
}

.input-hint:before {
	content: "↳ ";
	position: absolute;
	left: 0;
}

.button:focus-visible, .input:focus-visible, select:focus-visible, textarea:focus-visible, pre.jush:focus-visible {
	outline-width: 1px;
	border-color: var(--link-text) !important;
}

.button, input[type="file"]::file-selector-button {
	padding: 4px 10px;
	border: 1px solid var(--button-border);
	border-radius: var(--input-border-radius);
	background: var(--button-bg);
	color: var(--button-text);
	font-size: 100%;
	cursor: pointer;
}

.button:hover, input[type="file"]::file-selector-button:hover,
.button:active, input[type="file"]::file-selector-button:active {
	background-color: var(--button-bg-hover);
	border-color: var(--button-border-hover);
	color: var(--button-text-hover);
}

.button:disabled, input[type="file"]:disabled::file-selector-button {
	opacity: 0.3;
	filter: saturate(0);
	pointer-events: none;
}

.button .icon {
	margin-inline-end: 0.25em;
	opacity: 0.85;
	margin-top: -4px;
	margin-bottom: -1px;
}

.button .icon:first-child {
	margin-inline-start: -2px;
}

.button .icon.solo {
	margin-inline-end: -2px;
	opacity: 1;
}

a.button {
	display: inline-block;
	line-height: normal;
}

.button.light {
	border: none;
	padding: 5px;
	background: transparent;
	color: var(--link-text);
}

.button.light:hover, .button.light:active {
	color: var(--link-text-hover);
}

.button.light:focus-visible {
	outline-width: 2px;
}

.button.default {
	background-color: var(--button-default-bg);
	border-color: var(--button-default-border);
	color: var(--button-default-text);
}

.button.default:hover, .button.default:active {
	background-color: var(--button-default-bg-hover);
	border-color: var(--button-default-border-hover);
	color: var(--button-default-text-hover);
}

.button.default:focus-visible {
	outline-width: 2px;
	outline-offset: 1px;
	border-radius: calc(var(--input-border-radius) / 2);
}
