/* Softener regeneration calculator */
.cw-scalc {
	--cw-scalc-border: #dcdfe3;
	--cw-scalc-muted: #5f6770;
	--cw-scalc-optimal-bg: #e7f6ec;
	--cw-scalc-optimal-text: #1d6b36;
	--cw-scalc-warn-text: #8a5a00;
	--cw-scalc-high-text: #a12622;
	--cw-scalc-invalid: #d63638;

	margin: 1.5em 0;
}

.cw-scalc__form {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 1em 1.5em;
	margin-bottom: 1.5em;
}

.cw-scalc__field label {
	display: block;
	margin-bottom: 0.35em;
	font-weight: 600;
}

.cw-scalc__input-group {
	display: flex;
	align-items: stretch;
}

.cw-scalc__input-group input {
	flex: 1 1 auto;
	min-width: 0;
	width: 100%;
}

.cw-scalc__input-group input.is-invalid {
	border-color: var(--cw-scalc-invalid);
}

.cw-scalc__unit,
.cw-scalc__input-group select {
	flex: 0 0 auto;
	margin-left: -1px;
	border: 1px solid var(--cw-scalc-border);
	background: #f6f7f8;
}

.cw-scalc__unit {
	display: flex;
	align-items: center;
	padding: 0 0.9em;
}

.cw-scalc__input-group select {
	width: auto;
	padding-right: 2em;
}

.cw-scalc__converted {
	margin: 0.35em 0 0;
	font-size: 0.9em;
	color: var(--cw-scalc-muted);
}

.cw-scalc__placeholder {
	color: var(--cw-scalc-muted);
}

.cw-scalc__group {
	margin-bottom: 2em;
}

.cw-scalc__group-title {
	margin: 0 0 0.6em;
	padding-left: 0.6em;
	border-left: 4px solid currentColor;
	font-size: 1.2em;
	line-height: 1.3;
}

/* Fixed column widths keep all product line tables aligned */
.cw-scalc__table {
	width: 100%;
	margin-bottom: 0;
	border-collapse: collapse;
	table-layout: fixed;
}

.cw-scalc__table th:nth-child(1) {
	width: 40%;
}

.cw-scalc__table th:nth-child(2) {
	width: 25%;
}

.cw-scalc__table th,
.cw-scalc__table td {
	padding: 0.6em 0.8em;
	border: 1px solid var(--cw-scalc-border);
	text-align: left;
	vertical-align: middle;
}

.cw-scalc__table td:nth-child(2) {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.cw-scalc__row--optimal td {
	background: var(--cw-scalc-optimal-bg);
}

.cw-scalc__row--optimal td:first-child,
.cw-scalc__row--optimal td:last-child {
	font-weight: 600;
	color: var(--cw-scalc-optimal-text);
}

.cw-scalc__row--optimal td:first-child a {
	color: inherit;
}

.cw-scalc__row--low td:last-child {
	color: var(--cw-scalc-warn-text);
}

.cw-scalc__row--high td:last-child {
	color: var(--cw-scalc-high-text);
}

.cw-scalc__note {
	font-size: 0.95em;
	color: var(--cw-scalc-muted);
}

/* Stacked cards on small screens */
@media (max-width: 600px) {
	.cw-scalc__table thead {
		display: none;
	}

	.cw-scalc__table,
	.cw-scalc__table tbody,
	.cw-scalc__table tr,
	.cw-scalc__table td {
		display: block;
		width: 100%;
	}

	.cw-scalc__table tr:not(:last-child) {
		margin-bottom: 0.75em;
	}

	.cw-scalc__table tr {
		border: 1px solid var(--cw-scalc-border);
	}

	.cw-scalc__table td {
		display: flex;
		justify-content: space-between;
		gap: 1em;
		border: 0;
		border-bottom: 1px solid var(--cw-scalc-border);
	}

	.cw-scalc__table td:last-child {
		border-bottom: 0;
	}

	.cw-scalc__table td::before {
		content: attr(data-label);
		font-weight: 400;
		color: var(--cw-scalc-muted);
	}

	.cw-scalc__table td:nth-child(3) {
		text-align: right;
	}
}
