/* Sticky left «Калькулятор» tab + popup. Brand #c23736. */

.ajax-calc-tab {
	position: fixed;
	left: 0;
	top: 50%;
	z-index: 12000;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0;
	width: 46px;
	height: 52px;
	border: 0;
	border-radius: 0 10px 10px 0;
	background: #c23736;
	color: #fff;
	cursor: pointer;
	transform: translateY(-50%);
	box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.22);
	transition: background 0.2s, box-shadow 0.2s, width 0.2s;
}

.ajax-calc-tab svg {
	display: block;
	width: 24px;
	height: 24px;
	stroke: currentColor;
	fill: none;
}

.ajax-calc-tab::after {
	content: "Расчёт сметы";
	position: absolute;
	left: calc(100% + 10px);
	top: 50%;
	padding: 7px 12px;
	border-radius: 6px;
	background: #c23736;
	color: #fff;
	font: 700 13px/1.2 Arial, Helvetica, sans-serif;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transform: translateY(-50%) translateX(-6px);
	transition: opacity 0.18s, transform 0.18s;
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.ajax-calc-tab:hover,
.ajax-calc-tab:focus {
	background: #a82e2d;
	width: 50px;
	outline: none;
	box-shadow: 3px 3px 14px rgba(0, 0, 0, 0.28);
}

.ajax-calc-tab:hover::after,
.ajax-calc-tab:focus::after {
	opacity: 1;
	transform: translateY(-50%) translateX(0);
}

html.ajax-calc-open {
	overflow: hidden;
}

html.ajax-calc-open .ajax-calc-tab {
	visibility: hidden;
}

.ajax-calc-overlay {
	position: fixed;
	inset: 0;
	z-index: 12050;
	display: none;
	align-items: flex-start;
	justify-content: center;
	padding: 24px 16px;
	overflow: auto;
	background: rgba(32, 32, 32, 0.55);
	box-sizing: border-box;
}

.ajax-calc-overlay.is-open {
	display: flex;
}

.ajax-calc-modal {
	position: relative;
	width: 100%;
	max-width: 720px;
	margin: 24px auto 40px;
	padding: 28px 28px 24px;
	background: #fff;
	border: 1px solid #e6e6e6;
	border-radius: 12px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
	box-sizing: border-box;
	font-family: Arial, Helvetica, sans-serif;
	color: #4e4e4e;
}

.ajax-calc-close {
	position: absolute;
	top: 10px;
	right: 12px;
	width: 36px;
	height: 36px;
	border: 0;
	background: transparent;
	color: #888;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}

.ajax-calc-close:hover {
	color: #c23736;
}

.ajax-calc-title {
	margin: 0 28px 8px 0;
	padding: 0 0 12px;
	border-bottom: 2px solid #c23736;
	color: #c23736;
	font-size: 20px;
	font-weight: 700;
	letter-spacing: 0.02em;
	line-height: 1.3;
}

.ajax-calc-lead {
	margin: 0 0 18px;
	font-size: 13px;
	line-height: 1.45;
	color: #666;
}

.ajax-calc-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px 16px;
}

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

.ajax-calc-field--wide {
	grid-column: 1 / -1;
}

.ajax-calc-field label {
	font-size: 13px;
	font-weight: 700;
	color: #4e4e4e;
}

.ajax-calc-field .req {
	color: #c23736;
}

.ajax-calc-field input[type="text"],
.ajax-calc-field input[type="number"],
.ajax-calc-field select {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	border: 1px solid #d5d5d5;
	border-radius: 6px;
	padding: 10px 12px;
	font-size: 14px;
	line-height: 1.35;
	color: #4e4e4e;
	background: #fafafa;
}

.ajax-calc-field input:focus,
.ajax-calc-field select:focus {
	outline: none;
	border-color: #c23736;
	background: #fff;
	box-shadow: 0 0 0 3px rgba(194, 55, 54, 0.12);
}

.ajax-calc-check {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 22px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
}

.ajax-calc-check input {
	width: 16px;
	height: 16px;
	margin: 0;
	accent-color: #c23736;
}

.ajax-calc-specs {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
}

.ajax-calc-spec {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 0;
	padding: 10px 10px;
	border: 1px solid #e8e8e8;
	border-radius: 8px;
	background: #fafafa;
	font-size: 12px;
	line-height: 1.3;
	font-weight: 600;
	cursor: pointer;
}

.ajax-calc-spec.is-checked {
	border-color: #c23736;
	background: #fff7f7;
}

.ajax-calc-spec input {
	flex: 0 0 auto;
	margin: 2px 0 0;
	accent-color: #c23736;
}

.ajax-calc-result {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin: 18px 0 8px;
	padding: 14px 16px;
	background: #fff7f7;
	border: 1px solid #e8c4c3;
	border-left: 5px solid #c23736;
	border-radius: 6px;
}

.ajax-calc-result__label {
	font-size: 15px;
	font-weight: 700;
	color: #c23736;
}

.ajax-calc-result__value {
	font-size: 22px;
	font-weight: 700;
	color: #1a1a1a;
	white-space: nowrap;
}

.ajax-calc-note {
	margin: 0 0 16px;
	font-size: 12px;
	line-height: 1.4;
	color: #888;
}

.ajax-calc-contacts {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px 16px;
	margin: 0 0 16px;
}

.ajax-calc-submit {
	display: block;
	width: 100%;
	margin: 0;
	padding: 13px 24px;
	border: 0;
	border-radius: 6px;
	background: #c23736;
	color: #fff;
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	text-shadow: 0 -1px 0 #a91b1a;
}

.ajax-calc-submit:hover {
	background: #a82e2d;
}

#ajax-calc-form.is-invalid input,
#ajax-calc-form input.is-invalid {
	border-color: #c23736;
}

@media screen and (max-width: 640px) {
	.ajax-calc-tab {
		width: 42px;
		height: 48px;
	}

	.ajax-calc-tab:hover,
	.ajax-calc-tab:focus {
		width: 46px;
	}

	.ajax-calc-tab::after {
		display: none;
	}

	.ajax-calc-overlay {
		padding: 8px;
	}

	.ajax-calc-modal {
		margin: 8px auto 24px;
		padding: 22px 16px 18px;
	}

	.ajax-calc-grid,
	.ajax-calc-contacts,
	.ajax-calc-specs {
		grid-template-columns: 1fr;
	}

	.ajax-calc-result {
		flex-direction: column;
		align-items: flex-start;
		gap: 6px;
	}
}

@media print {
	.ajax-calc-tab,
	.ajax-calc-overlay {
		display: none !important;
	}
}
