/* Briteair Calculators. Override the custom properties to restyle. */

.bac-overlay,
.bac-inline {
	--bac-accent: #013365;
	--bac-accent-ink: #ffffff;
	--bac-ink: #1c2530;
	--bac-muted: #5d6b7a;
	--bac-line: #dfe4ea;
	--bac-soft: #f3f6f9;
	--bac-warn: #9a5b00;
	--bac-error: #b42318;
	--bac-radius: 10px;
	font-family: inherit;
	color: var(--bac-ink);
	line-height: 1.4;
}

html.bac-lock,
html.bac-lock body {
	overflow: hidden;
}

/* Modal ---------------------------------------------------------------- */

.bac-overlay {
	position: fixed;
	inset: 0;
	z-index: 1000000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 5vh 16px;
	overflow-y: auto;
	background: rgba( 8, 20, 35, 0.6 );
	opacity: 0;
	transition: opacity 0.18s ease;
	-webkit-overflow-scrolling: touch;
}

.bac-overlay[hidden] {
	display: none;
}

.bac-overlay.is-open {
	opacity: 1;
}

.bac-dialog {
	position: relative;
	width: 100%;
	max-width: 880px;
	background: #fff;
	border-radius: var(--bac-radius);
	box-shadow: 0 24px 60px rgba( 0, 0, 0, 0.25 );
	transform: translateY( 12px );
	transition: transform 0.18s ease;
	outline: none;
}

.bac-overlay.is-open .bac-dialog {
	transform: none;
}

.bac-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 20px 24px;
	background: var(--bac-accent);
	color: var(--bac-accent-ink);
	border-radius: var(--bac-radius) var(--bac-radius) 0 0;
}

.bac-subtitle {
	margin: 0 0 2px;
	padding: 0;
	font-size: 13px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	opacity: 0.8;
	color: inherit;
}

.bac-title {
	margin: 0;
	padding: 0;
	font-size: 22px;
	font-weight: 600;
	line-height: 1.25;
	color: inherit;
	background: none;
}

.bac-close {
	flex: none;
	width: 40px;
	height: 40px;
	margin: -6px -8px 0 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	font-size: 28px;
	line-height: 40px;
	cursor: pointer;
}

.bac-close:hover,
.bac-close:focus-visible {
	background: rgba( 255, 255, 255, 0.15 );
}

.bac-body {
	padding: 24px;
}

/* Form ----------------------------------------------------------------- */

.bac-form {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 170px, 1fr ) );
	gap: 16px;
	align-items: start;
	margin: 0 0 20px;
}

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

.bac-field-reset {
	align-items: flex-start;
}

.bac-label {
	display: block;
	margin: 0;
	line-height: 1.4;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	font-size: 14px;
	font-weight: 600;
	color: var(--bac-ink);
}

.bac-control {
	display: flex;
	align-items: stretch;
	border: 1px solid var(--bac-line);
	box-sizing: border-box;
	height: 44px;
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bac-control:focus-within {
	border-color: var(--bac-accent);
	box-shadow: 0 0 0 3px rgba( 1, 51, 101, 0.15 );
}

.bac-control.is-invalid {
	border-color: var(--bac-error);
}

.bac-control input {
	flex: 1;
	min-width: 0;
	box-sizing: border-box;
	height: 100%;
	margin: 0;
	padding: 0 12px;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: var(--bac-ink);
	font: inherit;
	font-size: 16px; /* Prevents iOS zoom on focus. */
	line-height: normal;
	box-shadow: none;
	outline: none;
	-moz-appearance: textfield;
}

.bac-control input::-webkit-outer-spin-button,
.bac-control input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.bac-unit {
	display: flex;
	align-items: center;
	padding: 0 12px;
	background: var(--bac-soft);
	border-left: 1px solid var(--bac-line);
	color: var(--bac-muted);
	font-size: 14px;
	white-space: nowrap;
}

.bac-err {
	min-height: 1em;
	font-size: 13px;
	color: var(--bac-error);
}

.bac-reset {
	box-sizing: border-box;
	height: 44px;
	margin: 0;
	padding: 0 16px;
	line-height: normal;
	border: 1px solid var(--bac-line);
	border-radius: 8px;
	background: #fff;
	color: var(--bac-muted);
	font: inherit;
	font-size: 14px;
	text-transform: none;
	box-shadow: none;
	cursor: pointer;
}

.bac-reset:hover,
.bac-reset:focus-visible {
	border-color: var(--bac-accent);
	color: var(--bac-accent);
}

/* Results -------------------------------------------------------------- */

.bac-results {
	transition: opacity 0.15s ease;
}

.bac-results.is-loading,
.bac-results.is-stale {
	opacity: 0.45;
}

.bac-section-title {
	margin: 0 0 8px;
	padding: 0;
	font-size: 16px;
	font-weight: 600;
	color: var(--bac-accent);
	background: none;
}

.bac-table-wrap {
	margin: 0 0 16px;
	border: 1px solid var(--bac-line);
	border-radius: var(--bac-radius);
	overflow-x: auto;
}

.bac-table {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	font-size: 15px;
	font-variant-numeric: tabular-nums;
}

.bac-table th,
.bac-table td {
	padding: 10px 14px;
	border: 0;
	border-bottom: 1px solid var(--bac-line);
	text-align: right;
	white-space: nowrap;
	vertical-align: middle;
}

.bac-table thead th {
	background: var(--bac-soft);
	color: var(--bac-muted);
	font-size: 13px;
	font-weight: 600;
}

.bac-table th[scope="row"],
.bac-table thead th:first-child {
	text-align: left;
	color: var(--bac-ink);
	font-weight: 600;
}

.bac-table tbody tr:last-child th,
.bac-table tbody tr:last-child td {
	border-bottom: 0;
}

.bac-table tbody tr:hover {
	background: #fafbfc;
}

.bac-table tr.is-out td,
.bac-table tr.is-out th {
	color: var(--bac-muted);
	background: repeating-linear-gradient( 135deg, transparent 0 6px, rgba( 0, 0, 0, 0.025 ) 6px 12px );
}

.bac-out-tag {
	display: block;
	margin-top: 2px;
	font-size: 12px;
	font-weight: 500;
	color: var(--bac-warn);
	white-space: normal;
}

.bac-cards {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 150px, 1fr ) );
	gap: 12px;
	margin: 0 0 16px;
}

.bac-card {
	padding: 14px 16px;
	border: 1px solid var(--bac-line);
	border-radius: var(--bac-radius);
	background: var(--bac-soft);
}

.bac-card-label {
	font-size: 13px;
	color: var(--bac-muted);
}

.bac-card-value {
	margin-top: 4px;
	font-size: 26px;
	font-weight: 600;
	color: var(--bac-accent);
	font-variant-numeric: tabular-nums;
}

.bac-cards.is-out .bac-card-value {
	color: var(--bac-muted);
}

.bac-cards .bac-out-tag {
	grid-column: 1 / -1;
	margin: 0;
}

.bac-message {
	margin: 0 0 16px;
	padding: 10px 14px;
	border-radius: 8px;
	background: #fef3f2;
	color: var(--bac-error);
	font-size: 14px;
}

.bac-note {
	margin: 4px 0 0;
	padding: 0;
	font-size: 13px;
	color: var(--bac-muted);
}

.bac-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect( 0 0 0 0 );
	white-space: nowrap;
	border: 0;
}

/* Small screens: stack table rows as cards. */
@media ( max-width: 600px ) {
	.bac-overlay {
		padding: 0;
		align-items: stretch;
	}

	.bac-dialog {
		min-height: 100%;
		border-radius: 0;
	}

	.bac-head {
		border-radius: 0;
		position: sticky;
		top: 0;
		z-index: 1;
	}

	.bac-body {
		padding: 16px;
	}

	.bac-form {
		grid-template-columns: 1fr 1fr;
		gap: 12px;
	}

	.bac-table-wrap {
		border: 0;
		overflow: visible;
	}

	.bac-table thead {
		display: none;
	}

	.bac-table,
	.bac-table tbody,
	.bac-table tr,
	.bac-table th,
	.bac-table td {
		display: block;
		width: auto;
	}

	.bac-table tr {
		margin: 0 0 10px;
		border: 1px solid var(--bac-line);
		border-radius: var(--bac-radius);
		overflow: hidden;
	}

	.bac-table th[scope="row"] {
		background: var(--bac-soft);
		border-bottom: 1px solid var(--bac-line);
	}

	.bac-table td {
		display: flex;
		justify-content: space-between;
		gap: 12px;
		padding: 8px 14px;
		border-bottom: 1px solid var(--bac-line);
	}

	.bac-table td::before {
		content: attr( data-label );
		color: var(--bac-muted);
		font-size: 13px;
	}

	.bac-table tbody tr:last-child td {
		border-bottom: 1px solid var(--bac-line);
	}

	.bac-table tr td:last-child,
	.bac-table tbody tr:last-child td:last-child {
		border-bottom: 0;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.bac-overlay,
	.bac-dialog,
	.bac-results {
		transition: none;
	}
}
