:root {
	--bg: #f3f5f7;
	--card: #ffffff;
	--text: #1f2937;
	--muted: #64748b;
	--line: #dbe2ea;
	--accent: #1565c0;
	--accent-dark: #0d47a1;
	--success: #0f766e;
	--danger: #b42318;
	--shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	background: var(--bg);
	color: var(--text);
}

.container {
	width: min(1180px, calc(100% - 24px));
	margin: 24px auto 48px;
}

.hero {
	background: linear-gradient(135deg, #0d47a1, #1976d2);
	color: white;
	border-radius: 18px;
	padding: 24px;
	box-shadow: var(--shadow);
	margin-bottom: 18px;
}

.hero h1 {
	margin: 0 0 8px;
	font-size: clamp(26px, 4vw, 38px);
}

.hero p {
	margin: 0;
	opacity: .9;
	line-height: 1.5;
}

.grid {
	display: grid;
	grid-template-columns: 1.1fr .9fr;
	gap: 18px;
	align-items: start;
}

.card {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 16px;
	padding: 18px;
	box-shadow: var(--shadow);
	margin-bottom: 18px;
}

.card h2 {
	margin: 0 0 14px;
	font-size: 20px;
}

.subtext {
	margin: -7px 0 14px;
	color: var(--muted);
	font-size: 14px;
	line-height: 1.45;
}

.row {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 10px;
	margin-bottom: 10px;
	align-items: end;
}

.row.three {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.row.two {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
	display: block;
	font-size: 13px;
	font-weight: 700;
	margin-bottom: 6px;
}

input,
select {
	width: 100%;
	min-height: 42px;
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 9px 10px;
	font: inherit;
	color: var(--text);
	background: white;
	outline: none;
}

input:focus,
select:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(21, 101, 192, .12);
}

button {
	border: 0;
	border-radius: 10px;
	padding: 11px 14px;
	font-weight: 800;
	cursor: pointer;
	font: inherit;
}

.btn-primary {
	background: var(--accent);
	color: white;
}

.btn-primary:hover {
	background: var(--accent-dark);
}

.btn-secondary {
	background: #e8eef6;
	color: #234;
}

.btn-secondary:hover {
	background: #dce6f2;
}

.btn-danger {
	background: #fee4e2;
	color: var(--danger);
	padding: 10px 12px;
}

.btn-danger:hover {
	background: #fecdca;
}

.toolbar {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.item-list {
	display: grid;
	gap: 10px;
}

.item {
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 12px;
	background: #fbfcfe;
}

.item-head {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	align-items: center;
	margin-bottom: 10px;
}

.item-title {
	font-weight: 800;
}


/*
|--------------------------------------------------------------------------
| ДОДАТКОВІ ЕЛЕМЕНТИ ВІКОН / ДВЕРЕЙ
|--------------------------------------------------------------------------
*/

.opening-extras {
	margin-top: 12px;
	padding: 12px;
	border: 1px solid #d7e5f5;
	border-radius: 10px;
	background: #f7fbff;
}

.opening-extra-result {
	margin-top: 2px;
}


/*
|--------------------------------------------------------------------------
| ПІДВІКОННИК
|--------------------------------------------------------------------------
*/

.sill-field {
	min-width: 0;
}


/*
|--------------------------------------------------------------------------
| М/П
|--------------------------------------------------------------------------
*/

.mp-item {
	background: #fffdf7;
	border-color: #eadfbf;
}

.mp-result {
	margin-top: 4px;
}


/*
|--------------------------------------------------------------------------
| РЕЗУЛЬТАТ СТІНИ
|--------------------------------------------------------------------------
*/

.wall-result {
	margin-top: 10px;
	padding: 10px 12px;
	background: #f8fafc;
	border-radius: 10px;
}


/*
|--------------------------------------------------------------------------
| РЕЗУЛЬТАТ ВІКНА / ДВЕРЕЙ
|--------------------------------------------------------------------------
*/

.opening-result {
	margin-top: 6px;
}


/*
|--------------------------------------------------------------------------
| ПІДСУМОК
|--------------------------------------------------------------------------
*/

.summary {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
}

.metric {
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 13px;
	background: #f8fafc;
}

.metric span {
	color: var(--muted);
	font-size: 13px;
	display: block;
}

.metric strong {
	font-size: 22px;
	display: block;
	margin-top: 4px;
}

.metric.highlight {
	background: #e6f5f3;
	border-color: #b6e3dc;
}


/*
|--------------------------------------------------------------------------
| ТАБЛИЦІ
|--------------------------------------------------------------------------
*/

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

th,
td {
	text-align: left;
	border-bottom: 1px solid var(--line);
	padding: 10px 8px;
	vertical-align: middle;
}

th {
	color: var(--muted);
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .03em;
}

td:last-child,
th:last-child {
	text-align: right;
}

.total-row td {
	font-weight: 900;
	font-size: 16px;
}


/*
|--------------------------------------------------------------------------
| ПРИМІТКИ
|--------------------------------------------------------------------------
*/

.note {
	font-size: 13px;
	color: var(--muted);
	line-height: 1.5;
}

.error {
	color: var(--danger);
	font-weight: 700;
	margin-top: 10px;
	display: none;
}


/*
|--------------------------------------------------------------------------
| STICKY ПРАВА КОЛОНКА
|--------------------------------------------------------------------------
*/

.sticky {
	position: sticky;
	top: 14px;
}

/*
|--------------------------------------------------------------------------
| ЗГОРТАННЯ / РОЗГОРТАННЯ СЕКЦІЙ
|--------------------------------------------------------------------------
*/

.collapsible-card {
	padding: 0;
	overflow: hidden;
}


/*
|----------------------------------------------------------------------
| ЗАГОЛОВОК СЕКЦІЇ
|----------------------------------------------------------------------
*/

.collapsible-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;

	padding: 18px;

	cursor: pointer;
	user-select: none;

	list-style: none;
}


/*
|----------------------------------------------------------------------
| ПРИБИРАЄМО СТАНДАРТНУ СТРІЛКУ БРАУЗЕРА
|----------------------------------------------------------------------
*/

.collapsible-title::-webkit-details-marker {
	display: none;
}

.collapsible-title::marker {
	display: none;
	content: "";
}


/*
|----------------------------------------------------------------------
| НАЗВА СЕКЦІЇ
|----------------------------------------------------------------------
*/

.collapsible-title h2 {
	margin: 0;
	font-size: 20px;
}


/*
|----------------------------------------------------------------------
| НАША СТРІЛКА
|----------------------------------------------------------------------
*/

.collapse-arrow {
	width: 11px;
	height: 11px;

	flex: 0 0 11px;

	border-right: 2px solid var(--muted);
	border-bottom: 2px solid var(--muted);

	transform: rotate(45deg);

	transition: transform .2s ease;
}


/*
|----------------------------------------------------------------------
| КОЛИ СЕКЦІЯ ВІДКРИТА
|----------------------------------------------------------------------
*/

.collapsible-card[open] > .collapsible-title .collapse-arrow {
	transform: rotate(225deg);
}


/*
|----------------------------------------------------------------------
| ВМІСТ СЕКЦІЇ
|----------------------------------------------------------------------
*/

.collapsible-content {
	padding: 0 18px 18px;
}


/*
|----------------------------------------------------------------------
| ЛІНІЯ ПІД ЗАГОЛОВКОМ ВІДКРИТОЇ СЕКЦІЇ
|----------------------------------------------------------------------
*/

.collapsible-card[open] > .collapsible-title {
	border-bottom: 1px solid var(--line);
	margin-bottom: 18px;
}


/*
|----------------------------------------------------------------------
| НАВЕДЕННЯ
|----------------------------------------------------------------------
*/

.collapsible-title:hover {
	background: #f8fafc;
}


/*
|----------------------------------------------------------------------
| ЩОБ ЗАКРУГЛЕННЯ НЕ ЛАМАЛОСЯ
|----------------------------------------------------------------------
*/

.collapsible-title {
	border-radius: 16px;
}

.collapsible-card[open] > .collapsible-title {
	border-radius: 16px 16px 0 0;
}

/*
|--------------------------------------------------------------------------
| ЗГОРТАННЯ / РОЗГОРТАННЯ ОКРЕМОЇ СТІНИ
|--------------------------------------------------------------------------
*/

.wall-collapse-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;

	margin-bottom: 12px;
	padding: 10px 12px;

	background: #f1f5f9;
	border-radius: 10px;

	cursor: pointer;
	user-select: none;

	transition: background .2s ease;
}


/*
|--------------------------------------------------------------------------
| НАВЕДЕННЯ НА ЗАГОЛОВОК СТІНИ
|--------------------------------------------------------------------------
*/

.wall-collapse-head:hover {
	background: #e8eef6;
}


/*
|--------------------------------------------------------------------------
| ЛІВА ЧАСТИНА: НАЗВА + СТРІЛКА
|--------------------------------------------------------------------------
*/

.wall-collapse-left {
	display: flex;
	align-items: center;
	gap: 10px;

	min-width: 0;
}


/*
|--------------------------------------------------------------------------
| НАЗВА СТІНИ
|--------------------------------------------------------------------------
*/

.wall-collapse-head .wall-title {
	font-size: 16px;
	font-weight: 800;
}


/*
|--------------------------------------------------------------------------
| СТРІЛКА СТІНИ
|--------------------------------------------------------------------------
*/

.wall-collapse-arrow {
	width: 9px;
	height: 9px;

	flex: 0 0 9px;

	border-right: 2px solid var(--muted);
	border-bottom: 2px solid var(--muted);

	transform: rotate(225deg);

	transition: transform .2s ease;
}


/*
|--------------------------------------------------------------------------
| СТІНА ЗГОРНУТА
|--------------------------------------------------------------------------
*/

.wall-item.wall-collapsed .wall-collapse-arrow {
	transform: rotate(45deg);
}


/*
|--------------------------------------------------------------------------
| ПРИБИРАЄМО ВІДСТУП КОЛИ СТІНА ЗГОРНУТА
|--------------------------------------------------------------------------
*/

.wall-item.wall-collapsed .wall-collapse-head {
	margin-bottom: 0;
}


/*
|--------------------------------------------------------------------------
| ВМІСТ СТІНИ
|--------------------------------------------------------------------------
*/

.wall-collapse-content {
	display: block;
}


/*
|--------------------------------------------------------------------------
| КНОПКА "ВИДАЛИТИ СТІНУ"
|--------------------------------------------------------------------------
*/

.wall-collapse-head .btn-danger {
	flex-shrink: 0;
}


/*
|--------------------------------------------------------------------------
| ПЛАНШЕТ
|--------------------------------------------------------------------------
*/

@media (max-width: 900px) {

	.grid {
		grid-template-columns: 1fr;
	}

	.sticky {
		position: static;
	}

}


/*
|--------------------------------------------------------------------------
| ТЕЛЕФОН
|--------------------------------------------------------------------------
*/

@media (max-width: 680px) {

	.row,
	.row.three,
	.row.two {
		grid-template-columns: 1fr 1fr;
	}

	.summary {
		grid-template-columns: 1fr;
	}

	.container {
		width: min(100% - 14px, 1180px);
		margin-top: 10px;
	}

	.hero,
	.card {
		border-radius: 13px;
		padding: 14px;
	}

	.item-head {
		align-items: flex-start;
	}

	.toolbar {
		gap: 7px;
	}

}


/*
|--------------------------------------------------------------------------
| МАЛЕНЬКИЙ ТЕЛЕФОН
|--------------------------------------------------------------------------
*/

@media (max-width: 480px) {

	.row,
	.row.three,
	.row.two {
		grid-template-columns: 1fr;
	}

	.item-head {
		flex-direction: column;
		align-items: stretch;
	}

	.item-head .btn-danger {
		width: 100%;
	}

	.toolbar {
		width: 100%;
	}

	.toolbar button {
		flex: 1;
	}

	.opening-extras {
		padding: 10px;
	}

}


/*
|--------------------------------------------------------------------------
| ДРУК / PDF
|--------------------------------------------------------------------------
*/

@media print {

	body {
		background: white;
	}

	.no-print,
	.hero p {
		display: none !important;
	}

	.container {
		width: 100%;
		margin: 0;
	}

	.card,
	.hero {
		box-shadow: none;
		break-inside: avoid;
	}

	.grid {
		grid-template-columns: 1fr;
	}

	.sticky {
		position: static;
	}

	.opening-extras,
	.mp-item {
		break-inside: avoid;
	}

}