/**
 * autoMHatic Partner Application Router
 * Scoped, theme-neutral styles. Override the variables below to match brand.
 */

.amh-router {
	--amh-accent: #0b5c8a;
	--amh-accent-hover: #094a70;
	--amh-text: #16212b;
	--amh-muted: #5c6b78;
	--amh-border: #d3dbe2;
	--amh-bg: #ffffff;
	--amh-radius: 8px;
	--amh-focus: rgba(11, 92, 138, 0.18);

	box-sizing: border-box;
	max-width: 520px;
	color: var(--amh-text);
	font-size: 16px;
	line-height: 1.45;
	text-align: left;
}

.amh-router *,
.amh-router *::before,
.amh-router *::after {
	box-sizing: border-box;
}

.amh-router__heading {
	margin: 0 0 18px;
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.3;
	color: var(--amh-text);
}

.amh-router__field {
	margin-bottom: 18px;
}

.amh-router__field.is-disabled {
	opacity: 0.55;
}

.amh-router__label {
	display: block;
	margin-bottom: 6px;
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--amh-text);
}

.amh-router__select,
.amh-router__input {
	width: 100%;
	padding: 11px 13px;
	font-size: 1rem;
	font-family: inherit;
	line-height: 1.4;
	color: var(--amh-text);
	background-color: var(--amh-bg);
	border: 1px solid var(--amh-border);
	border-radius: var(--amh-radius);
	appearance: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.amh-router__select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235c6b78' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 13px center;
	padding-right: 36px;
}

.amh-router__select:focus,
.amh-router__input:focus {
	outline: none;
	border-color: var(--amh-accent);
	box-shadow: 0 0 0 3px var(--amh-focus);
}

.amh-router__input:disabled {
	background-color: #f4f6f8;
	cursor: not-allowed;
}

.amh-router__combo {
	position: relative;
}

.amh-router__list {
	position: absolute;
	z-index: 999;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	max-height: 340px;
	margin: 0;
	padding: 4px;
	overflow-y: auto;
	list-style: none;
	background: var(--amh-bg);
	border: 1px solid var(--amh-border);
	border-radius: var(--amh-radius);
	box-shadow: 0 8px 24px rgba(22, 33, 43, 0.12);
}

.amh-router__list[hidden] {
	display: none;
}

.amh-router__option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 9px 11px;
	margin: 0;
	font-size: 0.9375rem;
	border-radius: 6px;
	cursor: pointer;
}

.amh-router__option:hover {
	background-color: #eef4f8;
}

.amh-router__option.is-active {
	background-color: var(--amh-accent);
	color: #ffffff;
}

.amh-router__option.is-active .amh-router__option-tag {
	color: #ffffff;
	background: rgba(255, 255, 255, 0.22);
}

.amh-router__option--general.is-active {
	color: #ffffff;
}

.amh-router__option-name {
	flex: 1 1 auto;
	min-width: 0;
	overflow-wrap: break-word;
}

.amh-router__option-tag {
	flex: 0 0 auto;
	padding: 2px 8px;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--amh-muted);
	background: #f1f4f7;
	border-radius: 999px;
}

.amh-router__option--general {
	/* Pinned to the bottom of the list so the escape hatch is always reachable,
	   however many matches there are. */
	position: sticky;
	bottom: -4px;
	z-index: 1;
	margin-top: 4px;
	padding-top: 11px;
	font-weight: 600;
	color: var(--amh-accent);
	background: var(--amh-bg);
	border-top: 1px solid var(--amh-border);
	border-radius: 0 0 6px 6px;
}

.amh-router__note {
	padding: 9px 11px;
	font-size: 0.875rem;
	color: var(--amh-muted);
}

.amh-router__help {
	margin: 6px 0 0;
	font-size: 0.8125rem;
	color: var(--amh-muted);
}

.amh-router__error {
	margin: 0 0 14px;
	padding: 10px 12px;
	font-size: 0.875rem;
	color: #8a1c1c;
	background: #fdf0f0;
	border: 1px solid #f2cfcf;
	border-radius: var(--amh-radius);
}

.amh-router__error[hidden] {
	display: none;
}

.amh-router__submit,
.amh-router__trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 22px;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	color: #ffffff;
	background-color: var(--amh-accent, #0b5c8a);
	border: 0;
	border-radius: var(--amh-radius, 8px);
	cursor: pointer;
	transition: background-color 0.15s ease, opacity 0.15s ease;
}

.amh-router__trigger {
	--amh-accent: #0b5c8a;
}

.amh-router__submit {
	width: 100%;
}

.amh-router__submit:hover:not(:disabled),
.amh-router__trigger:hover {
	background-color: var(--amh-accent-hover, #094a70);
}

.amh-router__submit:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.amh-router__submit.is-loading {
	opacity: 0.75;
}

.amh-router__empty {
	font-size: 0.9375rem;
	color: #5c6b78;
}

/* ------------------------------------------------------------------ modal */

.amh-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.amh-modal[hidden] {
	display: none;
}

.amh-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(16, 24, 32, 0.55);
}

.amh-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 600px;
	max-height: calc(100vh - 40px);
	/* dvh accounts for mobile browser chrome; ignored where unsupported. */
	max-height: calc(100dvh - 40px);
	/* Reserve height so the results list has room to open below the input without
	   the dialog itself having to scroll. This is the whole point of the pop-up:
	   pick a partner without moving. */
	min-height: 620px;
	min-height: min(620px, calc(100vh - 40px));
	min-height: min(620px, calc(100dvh - 40px));
	padding: 32px;
	overflow-y: auto;
	background: #ffffff;
	border-radius: 12px;
	box-shadow: 0 18px 50px rgba(16, 24, 32, 0.28);
}

.amh-modal__close {
	position: absolute;
	top: 10px;
	right: 12px;
	width: 34px;
	height: 34px;
	font-size: 26px;
	line-height: 1;
	color: #5c6b78;
	background: transparent;
	border: 0;
	border-radius: 6px;
	cursor: pointer;
}

.amh-modal__close:hover {
	background: #f1f4f7;
	color: #16212b;
}

.amh-router--in-modal {
	max-width: none;
}

body.amh-modal-open {
	overflow: hidden;
}

@media (max-width: 480px) {
	.amh-modal__dialog {
		padding: 24px 18px;
	}

	.amh-router__heading {
		font-size: 1.125rem;
	}
}
