/* ERL — modal szczegółowego budżetu remontowego */

/* Ukrywanie pól musi działać mimo display:flex na kontenerach */
.erl-budget-modal [hidden] {
	display: none !important;
}

/* Tryb tylko-do-odczytu (podgląd budżetu w panelu admina) */
.erl-budget-modal.is-readonly .erl-budget-io,
.erl-budget-modal.is-readonly .erl-budget-meta__hint {
	display: none !important;
}
.erl-budget-modal.is-readonly input:disabled,
.erl-budget-modal.is-readonly select:disabled,
.erl-budget-modal.is-readonly textarea:disabled {
	opacity: 1;
	background: #f6f7f7;
	color: #1d2327;
	-webkit-text-fill-color: #1d2327;
}

/* Bazowe pola — żeby modal działał także na portalu (bez erl-step2.css) */
.erl-budget-modal .erl-input {
	width: 100%;
	box-sizing: border-box;
	padding: 8px 10px;
	border: 1px solid #cfd4dc;
	border-radius: 8px;
	font: inherit;
	background: #fff;
	color: inherit;
}
.erl-budget-modal .erl-input:focus {
	outline: none;
	border-color: var(--erl-btn-bg, #d6ae5e);
	box-shadow: 0 0 0 3px rgba(214, 174, 94, 0.25);
}

/* Nota o cenach brutto */
.erl-budget-brutto {
	margin: 0 0 14px;
	padding: 10px 14px;
	border-radius: 8px;
	background: #eef6ee;
	border: 1px solid #cfe6cf;
	color: #2f6b34;
	font-size: var(--erl-type-body);
	font-weight: 600;
}

/* Przycisk otwierający budżet (na stronie kroku 2) */
.erl-budget-trigger-field {
	margin-top: 1.4rem;
}
.erl-budget-trigger {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	text-align: left;
	padding: 16px 18px;
	border: 1.5px solid #d9c79a;
	border-radius: 12px;
	background: linear-gradient(0deg, #fffdf6, #fffdf6);
	cursor: pointer;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.erl-budget-trigger:hover {
	border-color: var(--erl-btn-bg, #d6ae5e);
	box-shadow: 0 4px 14px rgba(214, 174, 94, 0.18);
}
.erl-budget-trigger.is-filled {
	border-color: #1f8a47;
	background: #f3fbf5;
}
.erl-budget-trigger__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	flex: 0 0 auto;
	border-radius: 10px;
	background: rgba(214, 174, 94, 0.18);
	color: #a9781a;
}
.erl-budget-trigger.is-filled .erl-budget-trigger__icon {
	background: rgba(31, 138, 71, 0.14);
	color: #1f8a47;
}
.erl-budget-trigger.is-filled.is-over {
	border-color: #c0392b;
	background: #fdf3f2;
}
.erl-budget-trigger.is-filled.is-over .erl-budget-trigger__icon {
	background: rgba(192, 57, 43, 0.14);
	color: #c0392b;
}
.erl-budget-trigger__text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1 1 auto;
	min-width: 0;
}
.erl-budget-trigger__title {
	font-weight: 700;
	color: #2a2f34;
}
.erl-budget-trigger__sub {
	font-size: var(--erl-type-body);
	color: #7a7165;
}
.erl-budget-trigger__chevron {
	font-size: 1.6rem;
	color: #c2a563;
	flex: 0 0 auto;
}

/* Overlay */
.erl-budget-noscroll {
	overflow: hidden;
}
.erl-budget-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
}
.erl-budget-modal[hidden] {
	display: none;
}
.erl-budget-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 32, 0.55);
	backdrop-filter: blur(2px);
}
.erl-budget-modal__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 880px;
	max-height: 92vh;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
	overflow: hidden;
	box-sizing: border-box;
}
.erl-budget-modal__dialog *,
.erl-budget-modal__dialog *::before,
.erl-budget-modal__dialog *::after {
	box-sizing: border-box;
}
.erl-budget-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 22px;
	border-bottom: 1px solid #eceef0;
	background: #002b3d;
	color: #fff;
}
.erl-budget-modal__title {
	margin: 0;
	font-size: var(--erl-type-heading);
	color: #fff;
}
.erl-budget-modal__close {
	border: none;
	background: transparent;
	color: #fff;
	font-size: 1.8rem;
	line-height: 1;
	cursor: pointer;
	opacity: 0.85;
	padding: 0 4px;
}
.erl-budget-modal__close:hover {
	opacity: 1;
}
.erl-budget-modal__body {
	padding: 18px clamp(18px, 3vw, 28px);
	overflow-y: auto;
}
.erl-budget-modal__foot {
	border-top: 1px solid #eceef0;
	padding: 14px clamp(18px, 3vw, 28px);
	background: #fafbfc;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

/* Podsumowanie / deklaracja / metraż */
.erl-budget-summary {
	margin-bottom: 18px;
}
.erl-budget-declared {
	padding: 12px 14px;
	border-radius: 10px;
	background: #f0f6fc;
	border: 1px solid #cfe0ef;
	margin-bottom: 14px;
}
.erl-budget-declared__line {
	font-size: var(--erl-type-body);
	color: #36424d;
}
.erl-budget-declared__status {
	margin-top: 6px;
	font-weight: 700;
	font-size: var(--erl-type-body);
}
.erl-budget-declared__status.is-ok {
	color: #1f8a47;
}
.erl-budget-declared__status.is-diff {
	color: #b5781b;
}
.erl-budget-declared__status.is-over {
	color: #c0392b;
}
.erl-budget-declared__cap {
	color: #6b7177;
	font-size: var(--erl-type-body);
}
.erl-budget-meta {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 12px;
}
.erl-budget-meta__item {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: var(--erl-type-body);
	font-weight: 600;
	color: #4a525a;
}
.erl-budget-meta__hint {
	margin: 8px 0 0;
	font-size: var(--erl-type-body);
	color: #7a8089;
	line-height: 1.4;
}
.erl-budget-io {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px dashed #e4e7ea;
}
.erl-budget-iobtn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border: 1px solid #c9ccd1;
	border-radius: 8px;
	background: #fff;
	color: #36424d;
	font-size: var(--erl-type-body);
	font-weight: 600;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}
.erl-budget-iobtn:hover {
	border-color: var(--erl-btn-bg, #d6ae5e);
	background: #fffdf7;
}
.erl-budget-io__hint {
	font-size: var(--erl-type-body);
	color: #8a9097;
	flex: 1 1 180px;
	min-width: 160px;
}

/* Sekcja budżetu */
.erl-bsec {
	border: 1px solid #e6e8eb;
	border-radius: 12px;
	margin-bottom: 14px;
	overflow: hidden;
}
.erl-bsec__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 14px;
	background: #f7f8fa;
	border-bottom: 1px solid #eceef0;
	flex-wrap: wrap;
}
.erl-bsec__title {
	font-weight: 700;
	color: #2a2f34;
}
.erl-bsec__sectionamount {
	padding: 14px;
}
.erl-bsec__items {
	padding: 6px 8px 12px;
}
.erl-bsec__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	border-top: 1px dashed #e0e3e6;
	background: #fcfcfd;
}
.erl-bsec__sumlabel {
	font-size: var(--erl-type-body);
	color: #6b7177;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}
.erl-bsec__sumvalue {
	font-weight: 700;
	color: #2a2f34;
}

/* Wiersz pozycji */
.erl-brow {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 5px 6px;
	border-bottom: 1px solid #f1f2f4;
	flex-wrap: wrap;
}
.erl-brow:last-child {
	border-bottom: none;
}
.erl-brow__name {
	flex: 1 1 220px;
	min-width: 160px;
	font-size: var(--erl-type-body);
	color: #353b41;
	display: flex;
	align-items: baseline;
	gap: 6px;
}
.erl-brow__unit {
	font-size: var(--erl-type-body);
	color: #9aa0a7;
	white-space: nowrap;
}
.erl-brow__controls {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}
.erl-brow__amount,
.erl-brow__calc {
	display: flex;
	align-items: center;
	gap: 6px;
}
.erl-brow__times,
.erl-brow__eq {
	color: #9aa0a7;
}
.erl-brow__cost {
	min-width: 92px;
	text-align: right;
	font-weight: 700;
	color: #1f8a47;
}
.erl-brow__del {
	border: none;
	background: #f0f1f3;
	color: #6b7177;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	cursor: pointer;
	font-size: var(--erl-type-body);
	line-height: 1;
}
.erl-brow__del:hover {
	background: #e0473f;
	color: #fff;
}
.erl-bnum {
	width: 104px;
	padding: 6px 8px;
}
.erl-bnum--sm {
	width: 72px;
}
.erl-binput-name {
	width: 100%;
}
.erl-binline {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: var(--erl-type-body);
	color: #4a525a;
}

.erl-budget-add {
	margin: 10px 6px 0;
	border: 1px dashed #c9ccd1;
	background: #fff;
	color: #5a6066;
	padding: 8px 14px;
	border-radius: 8px;
	cursor: pointer;
	font-size: var(--erl-type-body);
}
.erl-budget-add:hover {
	border-color: var(--erl-btn-bg, #d6ae5e);
	color: #2a2f34;
}

/* Panel podsumowania */
.erl-bsum {
	border: 1px solid #e6e8eb;
	border-radius: 12px;
	padding: 6px 14px;
	background: #fbfbfc;
}
.erl-bsum__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 9px 0;
	border-bottom: 1px dashed #ebedef;
}
.erl-bsum__row:last-child {
	border-bottom: none;
}
.erl-bsum__label {
	font-size: var(--erl-type-body);
	color: #4a525a;
}
.erl-bsum__val {
	font-weight: 700;
	color: #2a2f34;
}

/* Przełączniki trybów */
.erl-seg2,
.erl-seg3 {
	display: inline-flex;
	border: 1px solid #d4d7db;
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
}
.erl-seg2__btn,
.erl-seg3__btn {
	border: none;
	background: #fff;
	color: #5a6066;
	padding: 6px 12px;
	font-size: var(--erl-type-body);
	cursor: pointer;
	white-space: nowrap;
}
.erl-seg3__btn {
	padding: 5px 10px;
	font-size: var(--erl-type-body);
}
.erl-seg2__btn + .erl-seg2__btn,
.erl-seg3__btn + .erl-seg3__btn {
	border-left: 1px solid #d4d7db;
}
.erl-seg2__btn.is-active,
.erl-seg3__btn.is-active {
	background: var(--erl-btn-bg, #d6ae5e);
	color: #002b3d;
	font-weight: 700;
}

/* Stopka modala — sumy i akcje */
.erl-budget-grandtotal {
	display: flex;
	align-items: baseline;
	gap: 8px;
	flex-wrap: wrap;
}
.erl-budget-grandtotal__label {
	font-size: var(--erl-type-body);
	color: #4a525a;
}
.erl-budget-grandtotal__value {
	font-size: var(--erl-type-heading);
	font-weight: 800;
	color: #002b3d;
}
.erl-budget-grandtotal__permeter {
	font-size: var(--erl-type-body);
	color: #7a8089;
}
.erl-budget-modal__actions {
	display: flex;
	gap: 10px;
}
.erl-budget-btn {
	padding: 11px 22px;
	border-radius: 8px;
	border: none;
	font-weight: 700;
	cursor: pointer;
	font-size: var(--erl-type-body);
}
.erl-budget-btn--ghost {
	background: #eef0f2;
	color: #4a525a;
}
.erl-budget-btn--ghost:hover {
	background: #e3e6e9;
}
.erl-budget-btn--primary {
	background: var(--erl-btn-bg, #d6ae5e);
	color: #002b3d;
}
.erl-budget-btn--primary:hover {
	background: var(--erl-btn-bg-hover, #c9a456);
}

@media (max-width: 640px) {
	.erl-budget-modal {
		padding: 0;
	}
	.erl-budget-modal__dialog {
		max-width: 100%;
		max-height: 100vh;
		height: 100vh;
		border-radius: 0;
	}
	.erl-brow__controls {
		width: 100%;
		justify-content: space-between;
	}
	.erl-budget-modal__foot {
		flex-direction: column;
		align-items: stretch;
	}
	.erl-budget-modal__actions {
		justify-content: flex-end;
	}
}
