/* =======================================================
   CALCULATOR PAGE — CSS
   tampinmattroi.vn • White/Black/Orange
======================================================= */

/* ── Variables ── */
:root {
	--c-bg: #ffffff;
	--c-surface: #f8f8f8;
	--c-border: #e5e5e5;
	--c-text: #0a0a0a;
	--c-muted: #666666;
	--c-orange: #f97316;
	--c-orange-d: #ea6a0a;
	--c-orange-l: #fff4ed;
	--c-green: #16a34a;
	--c-green-l: #f0fdf4;
	--c-blue: #2563eb;
	--c-blue-l: #eff6ff;
	--c-red: #dc2626;
	--c-red-l: #fef2f2;
	--r: 10px;
	--r-lg: 16px;
	--shadow: 0 2px 16px rgba(0, 0, 0, .07);
	--shadow-lg: 0 8px 40px rgba(0, 0, 0, .12);
	--font: 'Inter', sans-serif;
}

/* ── Page scope (avoid breaking site chrome when shared layout loads) ── */
.calculator-page,
.calculator-page *,
.calculator-page *::before,
.calculator-page *::after {
	box-sizing: border-box;
}

.calculator-page {
	font-family: var(--font);
	background: var(--c-bg);
	color: var(--c-text);
	line-height: 1.6;
	font-size: 15px;
	margin: 0;
	min-height: 100vh;
	overflow-x: hidden;
}

.calculator-page a {
	color: var(--c-orange);
	text-decoration: none;
}

.calculator-page input,
.calculator-page select,
.calculator-page textarea,
.calculator-page button {
	font-family: inherit;
}

/* Tooltips */
.calculator-page .info-tooltip-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
	margin-left: 6px;
	cursor: pointer;
	vertical-align: middle;
}

.calculator-page .info-icon-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 17px;
	height: 17px;
	border-radius: 50%;
	background: var(--c-orange, #f97316);
	color: #fff;
	font-size: 11px;
	font-weight: 800;
	font-family: system-ui, -apple-system, sans-serif;
	line-height: 1;
	box-shadow: 0 2px 4px rgba(249, 115, 22, 0.3);
	transition: transform 0.2s ease;
}

.calculator-page .info-tooltip-wrap:hover .info-icon-badge {
	transform: scale(1.18);
}

.calculator-page .info-tooltip-text {
	visibility: hidden;
	opacity: 0;
	width: min(280px, calc(100vw - 32px));
	background-color: #0f172a;
	color: #f8fafc;
	text-align: left;
	border-radius: 8px;
	padding: 10px 14px;
	position: absolute;
	z-index: 9999;
	bottom: 125%;
	left: -10px;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
	border: 1px solid rgba(249, 115, 22, 0.5);
	font-size: 0.78rem;
	font-weight: 400;
	line-height: 1.45;
	transition: opacity 0.2s ease, visibility 0.2s ease;
	pointer-events: none;
	white-space: normal;
	word-wrap: break-word;
}

.calculator-page .info-tooltip-text::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 14px;
	border-width: 6px;
	border-style: solid;
	border-color: #0f172a transparent transparent transparent;
}

.calculator-page .info-tooltip-wrap:hover .info-tooltip-text {
	visibility: visible;
	opacity: 1;
}

/* ── Calc Header ── */
.calc-header {
	background: #0a0a0a;
	padding: 0 24px;
	height: 60px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	position: sticky;
	top: 0;
	z-index: 100;
	border-bottom: 2px solid var(--c-orange);
}

.calc-header-logo {
	font-weight: 800;
	font-size: 1.05rem;
	color: #fff;
	letter-spacing: -.5px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.calc-header-logo span {
	color: var(--c-orange);
}

.calc-header-logo-img {
	height: 40px;
	width: auto;
	object-fit: contain;
	display: block;
	background: #353535;
    border-radius: 8px;
	padding: 6px 12px;
}

.calc-header-back {
	font-size: .85rem;
	color: #aaa;
	display: flex;
	align-items: center;
	gap: 6px;
	transition: color .2s;
}

.calc-header-back:hover {
	color: #fff;
}

/* ── Progress Bar ── */
.calc-progress {
	background: var(--c-surface);
	border-bottom: 1px solid var(--c-border);
	padding: 0 24px;
}

.calc-progress-inner {
	max-width: 900px;
	margin: 0 auto;
	display: flex;
	align-items: stretch;
}

.calc-step-tab {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 12px;
	border-bottom: 3px solid transparent;
	font-size: .82rem;
	font-weight: 500;
	color: var(--c-muted);
	transition: all .25s;
	cursor: default;
	user-select: none;
}

.calc-step-tab.active {
	color: var(--c-text);
	border-color: var(--c-orange);
}

.calc-step-tab.done {
	color: var(--c-green);
	border-color: var(--c-green);
}

.calc-step-num {
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--c-border);
	color: var(--c-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: .8rem;
	font-weight: 700;
	flex-shrink: 0;
	transition: all .25s;
}

.calc-step-tab.active .calc-step-num {
	background: var(--c-orange);
	color: #fff;
}

.calc-step-tab.done .calc-step-num {
	background: var(--c-green);
	color: #fff;
}

.calc-step-label {
	display: none;
}

@media (min-width: 640px) {
	.calc-step-label {
		display: block;
	}
}

/* ── Layout ── */
.calc-body {
	max-width: 1100px;
	margin: 0 auto;
	padding: 32px 20px 80px;
	display: grid;
	grid-template-columns: 1fr 340px;
	gap: 28px;
	align-items: start;
	width: 100%;
}

.calc-body > * {
	min-width: 0;
	max-width: 100%;
}
.calc-page-heading {
	grid-column: 1 / -1;
	font-size: 1.5rem;
	font-weight: 800;
	margin: 0;
	color: var(--c-text);
	letter-spacing: -0.4px;
}

@media (max-width: 820px) {
	.calc-body {
		grid-template-columns: 1fr;
		padding: 20px 16px 60px;
	}

	.calc-preview {
		position: static;
	}
}

/* ── Step panels ── */
.calc-step-panel {
	display: none;
}

.calc-step-panel.active {
	display: block;
}

#steps-container,
#step-4 {
	min-width: 0;
	max-width: 100%;
}

/* ── Card ── */
.calc-card {
	background: var(--c-bg);
	border: 1px solid var(--c-border);
	border-radius: var(--r-lg);
	padding: 28px;
	box-shadow: var(--shadow);
	max-width: 100%;
}

.calc-card+.calc-card {
	margin-top: 20px;
}

.calc-card-title {
	font-size: 1.05rem;
	font-weight: 700;
	margin-bottom: 20px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.calc-card-title-icon {
	width: 32px;
	height: 32px;
	background: var(--c-orange-l);
	color: var(--c-orange);
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1rem;
}

/* ── Form Fields ── */
.field {
	margin-bottom: 18px;
}

.field label {
	display: block;
	font-size: .82rem;
	font-weight: 600;
	color: var(--c-text);
	margin-bottom: 6px;
}

.field-hint {
	font-size: .78rem;
	color: var(--c-muted);
	margin-top: 4px;
}

.field input[type="number"],
.field input[type="text"],
.field select {
	width: 100%;
	padding: 11px 14px;
	border: 1.5px solid var(--c-border);
	border-radius: var(--r);
	font-size: .92rem;
	background: var(--c-bg);
	color: var(--c-text);
	transition: border-color .2s, box-shadow .2s;
	outline: none;
	appearance: none;
	-webkit-appearance: none;
}

.field input:focus,
.field select:focus {
	border-color: var(--c-orange);
	box-shadow: 0 0 0 3px rgba(249, 115, 22, .12);
}

.field select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	padding-right: 36px;
}

.input-group {
	position: relative;
	display: flex;
	align-items: center;
}

.input-group input {
	padding-right: 70px;
}

.input-suffix {
	position: absolute;
	right: 14px;
	font-size: .8rem;
	color: var(--c-muted);
	pointer-events: none;
	white-space: nowrap;
}

.bill-kwh-toggle {
	display: flex;
	gap: 0;
	margin-bottom: 10px;
	border: 1.5px solid var(--c-border);
	border-radius: var(--r);
	overflow: hidden;
	width: fit-content;
}

.bill-kwh-toggle button {
	padding: 7px 18px;
	font-size: .82rem;
	font-weight: 600;
	background: transparent;
	border: none;
	color: var(--c-muted);
	cursor: pointer;
	transition: all .2s;
}

.bill-kwh-toggle button.active {
	background: var(--c-orange);
	color: #fff;
}

/* Radio Groups */
.radio-group {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.radio-option {
	flex: 1;
	min-width: 100px;
}

.radio-option input {
	display: none;
}

.radio-option label {
	display: block;
	padding: 10px 14px;
	border: 1.5px solid var(--c-border);
	border-radius: var(--r);
	text-align: center;
	font-size: .83rem;
	font-weight: 500;
	cursor: pointer;
	transition: all .2s;
	color: var(--c-muted);
	background: var(--c-bg);
	width: 100%;
}

.radio-option input:checked+label {
	border-color: var(--c-orange);
	background: var(--c-orange-l);
	color: var(--c-orange);
	font-weight: 600;
}

.radio-option label:hover {
	border-color: var(--c-orange);
}

.radio-option-ico {
	display: inline-block;
	margin-right: 4px;
	font-weight: 700;
	line-height: 1;
}

@media (max-width: 820px) {
	.radio-group {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 10px;
	}

	.radio-option {
		min-width: 0;
	}

	.radio-group:has(.radio-option:nth-child(3)) .radio-option:last-child {
		grid-column: 1 / -1;
	}
}

/* Toggle / Checkbox */
.toggle-field {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 14px;
	background: var(--c-surface);
	border-radius: var(--r);
	cursor: pointer;
	border: 1.5px solid var(--c-border);
	transition: border-color .2s;
}

.toggle-field:hover {
	border-color: var(--c-orange);
}

.toggle-field-label {
	font-size: .88rem;
	font-weight: 500;
}

.toggle-switch {
	width: 40px;
	height: 22px;
	background: var(--c-border);
	border-radius: 11px;
	position: relative;
	transition: background .2s;
	flex-shrink: 0;
}

.toggle-switch::after {
	content: '';
	position: absolute;
	top: 3px;
	left: 3px;
	width: 16px;
	height: 16px;
	background: #fff;
	border-radius: 50%;
	transition: left .2s;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}

.toggle-switch.on {
	background: var(--c-orange);
}

.toggle-switch.on::after {
	left: 21px;
}

/* EVN tier badge */
.evn-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 12px;
	border-radius: 20px;
	font-size: .78rem;
	font-weight: 600;
	margin-top: 6px;
	background: var(--c-orange-l);
	color: var(--c-orange);
}

/* ── Devices Checklist ── */
.devices-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	margin-bottom: 12px;
}

@media (max-width: 500px) {
	.devices-grid {
		grid-template-columns: 1fr;
	}
}

.device-item {
	border: 1.5px solid var(--c-border);
	border-radius: var(--r);
	padding: 10px 12px;
	cursor: pointer;
	transition: all .2s;
	background: var(--c-bg);
}

.device-item.selected {
	border-color: var(--c-orange);
	background: var(--c-orange-l);
}

.device-item-top {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 6px;
}

.device-icon {
	font-size: 1.1rem;
}

.device-name {
	font-size: .82rem;
	font-weight: 600;
	flex: 1;
}

.device-fields {
	display: none;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 6px;
	margin-top: 6px;
}

.device-item.selected .device-fields {
	display: grid;
}

.device-field-label {
	font-size: .7rem;
	color: var(--c-muted);
	margin-bottom: 2px;
}

.device-field input {
	width: 100%;
	padding: 5px 8px;
	border: 1px solid var(--c-border);
	border-radius: 6px;
	font-size: .78rem;
	background: #fff;
	outline: none;
}

.device-field input:focus {
	border-color: var(--c-orange);
}

.add-device-btn {
	width: 100%;
	padding: 10px;
	border: 1.5px dashed var(--c-border);
	border-radius: var(--r);
	background: transparent;
	color: var(--c-muted);
	font-size: .82rem;
	cursor: pointer;
	transition: all .2s;
}

.add-device-btn:hover {
	border-color: var(--c-orange);
	color: var(--c-orange);
}

/* ── Live Preview Panel (right sidebar) ── */
.calc-preview {
	position: sticky;
	top: 76px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.preview-card {
	background: #0a0a0a;
	color: #fff;
	border-radius: var(--r-lg);
	padding: 24px;
	position: relative;
	overflow: visible;
	box-shadow: var(--shadow-lg);
}

.preview-card--mascot {
	padding-top: 28px;
}

.preview-mascot {
	position: absolute;
	top: -36px;
	right: 12px;
	height: 88px;
	width: auto;
	object-fit: contain;
	z-index: 2;
	pointer-events: none;
	filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
}

.calc-side-info {
	padding: 16px;
	background: var(--c-surface);
	border-radius: var(--r-lg);
	border: 1px solid var(--c-border);
}

.calc-side-info-label {
	font-size: .78rem;
	font-weight: 700;
	color: var(--c-muted);
	text-transform: uppercase;
	letter-spacing: .06em;
	margin-bottom: 10px;
}

.calc-side-info-body {
	font-size: .85rem;
	color: var(--c-text);
	line-height: 1.5;
}

.calc-side-cta {
	padding: 20px;
	background: var(--c-orange);
	border-radius: var(--r-lg);
	color: #fff;
	text-align: center;
}

.calc-side-cta-title {
	font-weight: 700;
	margin-bottom: 6px;
}

.calc-side-cta-sub {
	font-size: .8rem;
	opacity: .9;
	margin-bottom: 14px;
}

.calc-side-cta-btn {
	display: block;
	padding: 10px 12px;
	background: #fff;
	color: var(--c-orange) !important;
	border-radius: 8px;
	font-weight: 700;
	font-size: .9rem;
}

.calc-side-cta-btn:hover {
	background: #fff7ed;
}

.modal-footer-actions {
	display: flex;
	gap: 10px;
}

.modal-footer-confirm {
	flex: 1;
}

.preview-title {
	font-size: .78rem;
	font-weight: 600;
	color: #888;
	text-transform: uppercase;
	letter-spacing: .08em;
	margin-bottom: 16px;
}

.preview-system-size {
	font-size: 2.2rem;
	font-weight: 800;
	color: var(--c-orange);
	line-height: 1.1;
	margin-bottom: 4px;
}

.preview-system-sub {
	font-size: .85rem;
	color: #aaa;
	margin-bottom: 20px;
}

.preview-specs {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 20px;
}

.preview-spec {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 10px 12px;
	background: rgba(255, 255, 255, .06);
	border-radius: 8px;
	font-size: .84rem;
}

.preview-spec-label {
	color: #aaa;
}

.preview-spec-value {
	font-weight: 600;
	color: #fff;
}

.preview-spec-value.orange {
	color: var(--c-orange);
}

.preview-savings {
	background: rgba(249, 115, 22, .12);
	border: 1px solid rgba(249, 115, 22, .25);
	border-radius: 10px;
	padding: 14px;
	margin-bottom: 16px;
}

.preview-savings-label {
	font-size: .75rem;
	color: var(--c-orange);
	margin-bottom: 4px;
	font-weight: 600;
}

.preview-savings-value {
	font-size: 1.3rem;
	font-weight: 800;
	color: var(--c-orange);
}

.preview-evn {
	font-size: .75rem;
	color: #ffffff;
	font-weight: 500;
	padding-top: 12px;
	border-top: 1px solid rgba(255, 255, 255, .12);
}

.preview-placeholder {
	text-align: center;
	padding: 20px 0;
	color: #555;
	font-size: .85rem;
}

.preview-placeholder-icon {
	font-size: 2rem;
	margin-bottom: 8px;
}

/* Roof warning */
.roof-warning {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	background: var(--c-red-l);
	border: 1px solid #fca5a5;
	border-radius: var(--r);
	font-size: .82rem;
	color: var(--c-red);
	margin-top: 8px;
}

/* ── Navigation Buttons ── */
.calc-nav {
	display: flex;
	gap: 12px;
	margin-top: 28px;
	align-items: center;
}

.btn-calc-primary {
	flex: 1;
	padding: 14px 24px;
	background: var(--c-orange);
	color: #fff;
	border: none;
	border-radius: var(--r);
	font-size: .95rem;
	font-weight: 700;
	cursor: pointer;
	transition: all .2s;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.btn-calc-primary:hover {
	background: var(--c-orange-d);
	transform: translateY(-1px);
}

.btn-calc-primary:active {
	transform: translateY(0);
}

.btn-calc-back {
	padding: 14px 20px;
	background: var(--c-surface);
	color: var(--c-text);
	border: 1.5px solid var(--c-border);
	border-radius: var(--r);
	font-size: .9rem;
	font-weight: 500;
	cursor: pointer;
	transition: all .2s;
}

.btn-calc-back:hover {
	border-color: var(--c-text);
}

/* ── BOM Table (Step 2 result) ── */
.overflow-x-auto {
	max-width: 100%;
	-webkit-overflow-scrolling: touch;
}

.bom-table {
	width: 100%;
	border-collapse: collapse;
}

.bom-table th,
.bom-table td {
	padding: 12px 14px;
	text-align: left;
	border-bottom: 1px solid var(--c-border);
	font-size: .85rem;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.bom-table th {
	font-size: .75rem;
	font-weight: 700;
	color: var(--c-muted);
	text-transform: uppercase;
	letter-spacing: .05em;
	background: var(--c-surface);
}

.bom-table tr:last-child td {
	border-bottom: none;
}

.bom-icon {
	margin-right: 6px;
	color: var(--c-orange, #F97316);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	vertical-align: middle;
}

.bom-svg {
	width: 16px;
	height: 16px;
	stroke: currentColor;
	stroke-width: 2.2px;
}

.bom-model {
	font-weight: 600;
	font-size: .88rem;
}

.bom-product {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.bom-product-thumb,
.print-bom-thumb {
	width: 48px;
	height: 48px;
	object-fit: contain;
	background: #fff;
	border: 1px solid var(--c-border);
	border-radius: 8px;
	flex-shrink: 0;
}

.print-bom-thumb {
	width: 40px;
	height: 40px;
}

.bom-product-meta {
	min-width: 0;
}

.bom-cat {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-width: 0;
	flex-wrap: wrap;
}

.bom-note {
	font-size: .75rem;
	color: var(--c-muted);
	margin-top: 2px;
}

.bom-qty {
	font-weight: 600;
	color: var(--c-orange);
	text-align: center;
}

.bom-price {
	font-weight: 700;
	text-align: right;
}

.bom-line-total {
	font-weight: 700;
	text-align: right;
}

.bom-price.locked {
	filter: blur(5px);
	user-select: none;
	cursor: not-allowed;
}

.bom-swap-btn {
	padding: 5px 12px;
	background: transparent;
	border: 1.5px solid var(--c-border);
	border-radius: 20px;
	font-size: .75rem;
	font-weight: 600;
	color: var(--c-muted);
	cursor: pointer;
	transition: all .2s;
	white-space: nowrap;
}

.bom-swap-btn:hover {
	border-color: var(--c-orange);
	color: var(--c-orange);
}

.bom-footer {
	background: var(--c-surface);
	border-radius: 0 0 var(--r) var(--r);
	padding: 14px 16px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.bom-total-label {
	font-size: .85rem;
	font-weight: 600;
	color: var(--c-muted);
}

.bom-total-value {
	font-size: 1.2rem;
	font-weight: 800;
}

/* ── Lead Gate (Step 3) ── */
.lead-gate {
	background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
	color: #fff;
	border-radius: var(--r-lg);
	padding: 32px;
	text-align: center;
	margin-bottom: 24px;
}

.lead-gate-icon {
	font-size: 2.5rem;
	margin-bottom: 12px;
}

.lead-gate-title {
	font-size: 1.3rem;
	font-weight: 800;
	margin-bottom: 8px;
}

.lead-gate-sub {
	font-size: .88rem;
	color: #aaa;
	margin-bottom: 24px;
	line-height: 1.5;
}

.lead-unlock-items {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	text-align: left;
	margin-bottom: 24px;
}

.lead-unlock-item {
	display: flex;
	align-items: flex-start;
	gap: 6px;
	font-size: .82rem;
	color: #ccc;
	min-width: 0;
}

.lead-unlock-item::before {
	content: '✓';
	color: var(--c-orange);
	font-weight: 700;
	flex-shrink: 0;
}

.lead-form {
	text-align: left;
}

.lead-form .field {
	margin-bottom: 24px;
}

.lead-form .field label {
	color: #fff;
	font-weight: 700;
	margin-bottom: 10px;
	display: inline-block;
	font-size: 0.95rem;
	letter-spacing: 0.3px;
}

.lead-form input,
.lead-form select {
	background: rgba(255, 255, 255, .08) !important;
	border: 2px solid rgba(255, 255, 255, .25) !important;
	color: #fff !important;
	padding: 16px 20px !important;
	font-size: 1.15rem !important;
	border-radius: var(--r) !important;
	height: 56px !important;
	box-sizing: border-box !important;
	font-weight: 500 !important;
	letter-spacing: 0.5px !important;
}

.lead-form input::placeholder {
	color: #888;
	font-size: 1.05rem;
}

.lead-form input:focus,
.lead-form select:focus {
	border-color: var(--c-orange) !important;
	box-shadow: 0 0 10px rgba(249, 115, 22, 0.4) !important;
	background: rgba(255, 255, 255, .12) !important;
}

.lead-form select option {
	background: #1a1a1a;
	color: #fff;
}

.lead-form .radio-option label {
	background: rgba(255, 255, 255, .06);
	border-color: rgba(255, 255, 255, .1);
	color: #aaa;
}

.lead-form .radio-option input:checked+label {
	background: rgba(249, 115, 22, .2);
	border-color: var(--c-orange);
	color: var(--c-orange);
}

.lead-form .recaptcha-v2 {
	margin: 0 0 8px;
}

.lead-form-row {
	display: flex;
	gap: 10px;
	margin-bottom: 8px;
}

.lead-form-col {
	flex: 1;
	min-width: 0;
}

.lead-form-actions {
	display: flex;
	gap: 12px;
	margin-top: 20px;
	align-items: stretch;
}

.lead-form-actions .btn-calc-back {
	flex-shrink: 0;
	min-height: 56px;
}

.lead-form-actions .btn-calc-primary {
	flex: 1;
	min-height: 56px;
	font-size: 1.05rem;
}

.calc-notice {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	background: rgba(16, 185, 129, 0.08);
	border: 1.5px solid rgba(16, 185, 129, 0.3);
	border-radius: var(--r-lg);
	padding: 14px 16px;
	margin-bottom: 20px;
	font-size: .88rem;
	color: var(--c-text);
	max-width: 100%;
	line-height: 1.5;
}

.calc-notice-icon {
	flex-shrink: 0;
	font-size: 1.25rem;
	line-height: 1.3;
}

.calc-notice strong {
	color: #10b981;
}

.calc-notice-sub {
	display: block;
	margin-top: 4px;
	font-size: .8rem;
	color: var(--c-muted);
}

.calc-notice > div {
	min-width: 0;
	flex: 1;
}

.calc-export-card {
	background: #0f172a;
	border: 1.5px solid #1e293b;
	padding: 24px;
	border-radius: var(--r-lg);
	margin-bottom: 24px;
	box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.calc-export-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	align-items: center;
	justify-content: space-between;
}

.calc-export-copy,
.calc-export-actions {
	min-width: 0;
}

.calc-export-title {
	font-weight: 800;
	font-size: 1.05rem;
	color: #fff;
	margin-bottom: 4px;
}

.calc-export-sub {
	font-size: .85rem;
	color: #94a3b8;
}

.calc-export-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.calc-print-card {
	background: var(--c-surface);
	margin-bottom: 24px;
}

.preview-scroll-wrapper {
	position: relative;
	overflow: hidden;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	background: #525659;
	padding: 20px 12px;
	border-radius: var(--r);
	box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.preview-scale-host {
	width: 800px;
	transform-origin: top left;
	transform: scale(var(--print-scale, 1));
	margin-bottom: calc((var(--print-scale, 1) - 1) * var(--print-h, 0px));
}

.preview-scale-host.is-exporting {
	transform: none;
	margin-bottom: 0;
}

.print-preview-overlay {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 10;
	background: rgba(16, 16, 16, 0.95);
	color: #fff;
	padding: 20px 22px;
	border-radius: var(--r);
	font-weight: 600;
	font-size: .95rem;
	pointer-events: none;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
	text-align: center;
	border: 1px solid rgba(255, 255, 255, 0.1);
	line-height: 1.5;
	width: min(85%, 320px);
}

.print-preview-overlay span {
	display: block;
	margin-top: 4px;
	font-size: .82rem;
	color: #ccc;
	font-weight: 400;
}

/* ── Step 4: Product Swap Modal ── */
.modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .6);
	z-index: 1000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.modal-overlay.open {
	display: flex;
}

.modal-box {
	background: var(--c-bg);
	border-radius: var(--r-lg);
	box-shadow: var(--shadow-lg);
	width: 100%;
	max-width: 640px;
	max-height: 80vh;
	display: flex;
	flex-direction: column;
}

.modal-header {
	padding: 20px 24px;
	border-bottom: 1px solid var(--c-border);
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.modal-title {
	font-size: 1rem;
	font-weight: 700;
}

.modal-close {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: none;
	background: var(--c-surface);
	cursor: pointer;
	font-size: 1.1rem;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .2s;
}

.modal-close:hover {
	background: var(--c-border);
}

.modal-body {
	flex: 1;
	overflow-y: auto;
	padding: 20px 24px;
}

.modal-footer {
	padding: 16px 24px;
	border-top: 1px solid var(--c-border);
}

.product-option {
	border: 1.5px solid var(--c-border);
	border-radius: var(--r);
	padding: 14px;
	margin-bottom: 8px;
	cursor: pointer;
	transition: all .2s;
}

.product-option:hover {
	border-color: var(--c-orange);
}

.product-option.selected {
	border-color: var(--c-orange);
	background: var(--c-orange-l);
}

.product-option-main {
	display: flex;
	align-items: flex-start;
	gap: 12px;
}

.product-option-thumb {
	width: 72px;
	height: 72px;
	object-fit: contain;
	background: #fff;
	border: 1px solid var(--c-border);
	border-radius: 10px;
	flex-shrink: 0;
}

.product-option-info {
	flex: 1;
	min-width: 0;
}

.product-option-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 12px;
	margin-bottom: 6px;
}

.product-option-name {
	font-weight: 600;
	font-size: .88rem;
}

.product-option-price {
	font-size: .85rem;
	font-weight: 700;
	color: var(--c-orange);
	white-space: nowrap;
}

.product-option-specs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 6px;
}

.spec-chip {
	padding: 2px 8px;
	background: var(--c-surface);
	border-radius: 20px;
	font-size: .72rem;
	color: var(--c-muted);
	font-weight: 500;
}

.spec-chip.highlight {
	background: var(--c-orange-l);
	color: var(--c-orange);
}

.product-option.out-of-stock {
	opacity: .5;
	cursor: not-allowed;
}

.product-option.out-of-stock::after {
	content: 'Tạm hết hàng';
	display: block;
	font-size: .72rem;
	color: var(--c-red);
	margin-top: 4px;
}

/* ── ROI Card ── */
.roi-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	margin-top: 16px;
}

@media (max-width: 500px) {
	.roi-grid {
		grid-template-columns: 1fr 1fr;
	}
}

.roi-item {
	background: var(--c-surface);
	border-radius: var(--r);
	padding: 16px;
	text-align: center;
}

.roi-value {
	font-size: 1.3rem;
	font-weight: 800;
	color: var(--c-text);
}

.roi-value.orange {
	color: var(--c-orange);
}

.roi-value.green {
	color: var(--c-green);
}

.roi-label {
	font-size: .72rem;
	color: var(--c-muted);
	margin-top: 4px;
}

.roi-item-highlight {
	grid-column: 1 / -1;
	background: rgba(16, 185, 129, 0.08);
	border: 1.5px solid rgba(16, 185, 129, 0.28);
}

.roi-note {
	font-size: .7rem;
	color: var(--c-muted);
	margin-top: 2px;
}

/* ── PDF & Image Export Buttons (Neon Lime #CCFF66) ── */
.btn-pdf,
.btn-neon-green {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 24px;
	background: #CCFF66;
	color: #0f172a;
	border: 1.5px solid #d9ff88;
	border-radius: var(--r);
	font-size: .92rem;
	font-weight: 800;
	cursor: pointer;
	box-shadow: 0 0 20px rgba(204, 255, 102, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
	transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-pdf:hover,
.btn-neon-green:hover {
	background: #e2ff99;
	border-color: #ffffff;
	color: #000000;
	transform: translateY(-2px) scale(1.02);
	box-shadow: 0 0 28px rgba(204, 255, 102, 0.75), 0 4px 14px rgba(0, 0, 0, 0.4);
}

.btn-pdf:active,
.btn-neon-green:active {
	transform: translateY(0) scale(0.98);
	box-shadow: 0 0 12px rgba(204, 255, 102, 0.4);
}

/* ── Success State ── */
.calc-success {
	display: none;
	text-align: center;
	padding: 40px 20px;
}

.calc-success.show {
	display: block;
}

.calc-success-icon {
	width: 72px;
	height: 72px;
	background: var(--c-green-l);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 2rem;
	margin: 0 auto 16px;
}

.calc-success-title {
	font-size: 1.3rem;
	font-weight: 700;
	margin-bottom: 8px;
}

.calc-success-sub {
	color: var(--c-muted);
	font-size: .9rem;
}

/* ── Disclaimer ── */
.disclaimer {
	background: var(--c-surface);
	border-left: 3px solid var(--c-orange);
	border-radius: 0 var(--r) var(--r) 0;
	padding: 12px 16px;
	font-size: .78rem;
	color: var(--c-muted);
	line-height: 1.5;
	margin-top: 16px;
}

/* ── Responsive adjustments ── */
@media (max-width: 768px) {
	.calc-header {
		padding: 0 16px;
		height: 56px;
	}

	.calc-header-logo-img {
		height: 34px;
		padding: 4px 8px;
	}

	.calc-header-back {
		min-height: 44px;
		padding: 8px 4px;
		font-size: .82rem;
	}

	.calc-progress {
		padding: 0 8px;
	}

	.calc-step-tab {
		padding: 10px 4px;
		justify-content: center;
		gap: 6px;
	}

	.calc-page-heading {
		font-size: clamp(1.15rem, 5.4vw, 1.4rem);
	}

	.calc-card {
		padding: 20px 16px;
	}

	.calc-card.p-0 {
		padding: 0;
	}

	.calc-card.p-5,
	.calc-card.p-6 {
		padding: 16px;
	}

	.calc-card.p-0 .pt-5.px-6,
	.calc-card.p-0 .px-6 {
		padding-left: 16px;
		padding-right: 16px;
		padding-top: 16px;
	}

	.calc-card-title {
		font-size: 1rem;
	}

	.field input[type="number"],
	.field input[type="text"],
	.field input[type="tel"],
	.field input[type="email"],
	.field select {
		font-size: 16px;
	}

	.bill-kwh-toggle {
		width: 100%;
	}

	.bill-kwh-toggle button {
		flex: 1;
		white-space: nowrap;
		padding: 10px 10px;
		font-size: .8rem;
	}

	.lead-unlock-items {
		grid-template-columns: 1fr;
	}

	.lead-gate {
		padding: 24px 16px;
		max-width: 100%;
	}

	.lead-form,
	.lead-form .field,
	.lead-form-col {
		max-width: 100%;
	}

	.lead-form input,
	.lead-form select {
		width: 100% !important;
		max-width: 100%;
	}

	.lead-gate-title {
		font-size: 1.1rem;
		line-height: 1.35;
	}

	.lead-gate-sub,
	.lead-unlock-item,
	.disclaimer,
	.calc-notice {
		overflow-wrap: anywhere;
		word-break: break-word;
	}

	.lead-form-row,
	.lead-form-actions,
	.calc-nav,
	.modal-footer-actions {
		flex-direction: column;
	}

	.lead-form-actions {
		flex-direction: column-reverse;
	}

	.calc-nav {
		flex-direction: column-reverse;
		align-items: stretch;
	}

	.btn-calc-back,
	.btn-calc-primary,
	.lead-form-actions .btn-calc-back,
	.lead-form-actions .btn-calc-primary {
		width: 100%;
		justify-content: center;
	}

	.roi-grid {
		grid-template-columns: 1fr 1fr;
		gap: 8px;
		margin-top: 12px;
	}

	.roi-item {
		padding: 12px 8px;
	}

	.roi-value {
		font-size: 1.05rem;
		overflow-wrap: anywhere;
		word-break: break-word;
	}

	.roi-label,
	.roi-note {
		overflow-wrap: anywhere;
	}

	.bom-footer {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
		padding: 14px 16px;
	}

	.bom-total-value {
		font-size: 1.05rem;
		overflow-wrap: anywhere;
		word-break: break-word;
	}

	#bom-summary-card {
		margin-bottom: 16px;
	}

	.bom-table {
		min-width: 0;
		width: 100%;
	}

	.bom-table thead {
		display: none;
	}

	#bom-full-body {
		padding: 8px;
	}

	.bom-table,
	.bom-table tbody,
	.bom-table tr,
	.bom-table td {
		display: block;
		width: 100%;
		height: auto;
		max-width: 100%;
	}

	.bom-table tr {
		border: 1px solid var(--c-border);
		border-radius: var(--r);
		margin-bottom: 12px;
		padding: 10px 12px;
		background: var(--c-bg);
	}

	.bom-table tr:last-child {
		margin-bottom: 0;
	}

	.bom-table td {
		display: grid;
		grid-template-columns: 5.6rem minmax(0, 1fr);
		align-items: center;
		column-gap: 8px;
		border-bottom: 1px dashed var(--c-border);
		padding: 8px 0;
		text-align: left !important;
	}

	.bom-table td:last-child {
		border-bottom: none;
	}

	.bom-table td::before {
		content: attr(data-label);
		grid-column: 1;
		grid-row: 1;
		font-size: .7rem;
		font-weight: 700;
		color: var(--c-muted);
		text-transform: uppercase;
		letter-spacing: .04em;
		line-height: 1.3;
		text-align: left;
	}

	.bom-table td > * {
		grid-column: 2;
		min-width: 0;
		max-width: 100%;
		text-align: left;
	}

	.bom-table td.bom-qty > *,
	.bom-table td.bom-price > *,
	.bom-table td[data-label="Thành tiền"] > * {
		text-align: right;
		justify-self: end;
	}

	.bom-table td[data-label="Sản phẩm"] > * {
		justify-self: stretch;
		text-align: left;
	}

	.bom-swap-btn {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		text-align: center;
		padding: 10px 12px;
		min-height: 40px;
	}

	.bom-table td:not([data-label])::before,
	.bom-table td[data-label=""]::before,
	.bom-table td[colspan]::before {
		display: none;
		content: none;
	}

	.bom-table td[data-label=""] {
		display: block;
		padding-top: 10px;
		padding-bottom: 2px;
	}

	.bom-table td[data-label="Sản phẩm"] {
		align-items: start;
	}

	.bom-table td[colspan] {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: flex-start;
		text-align: left;
		gap: 6px;
	}

	.bom-product {
		align-items: flex-start;
		width: 100%;
	}

	.calc-export-card {
		padding: 16px;
	}

	.calc-export-actions {
		width: 100%;
		flex-direction: column;
	}

	.calc-export-actions .btn-neon-green {
		width: 100%;
		justify-content: center;
		min-height: 48px;
	}

	.preview-scroll-wrapper {
		padding: 12px 8px;
	}

	.print-preview-overlay {
		padding: 16px 14px;
		font-size: .88rem;
		width: min(92%, 280px);
	}

	.preview-mascot {
		height: 68px;
		top: -28px;
		right: 8px;
	}

	.preview-card--mascot {
		padding-top: 36px;
	}

	.modal-overlay {
		padding: 12px;
		align-items: flex-end;
	}

	.modal-box {
		max-height: 92vh;
		border-radius: var(--r-lg) var(--r-lg) 0 0;
	}

	.product-option-header {
		flex-direction: column;
		gap: 4px;
	}
}

@media (max-width: 480px) {
	.calc-card {
		padding: 18px 14px;
	}

	.preview-system-size {
		font-size: 1.8rem;
	}

	.radio-group {
		grid-template-columns: 1fr;
	}

	.radio-group:has(.radio-option:nth-child(3)) .radio-option:last-child {
		grid-column: auto;
	}

	.device-fields {
		grid-template-columns: 1fr;
	}

	.bom-footer {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
	}

	.lead-gate {
		padding: 20px 14px;
	}

	.lead-form input,
	.lead-form select {
		font-size: 16px !important;
		padding: 14px 14px !important;
		height: 52px !important;
	}

	.calculator-page .info-tooltip-text {
		left: 50%;
		transform: translateX(-50%);
	}

	.bom-product-thumb {
		width: 40px;
		height: 40px;
	}

	.product-option-thumb {
		width: 56px;
		height: 56px;
	}

	.calc-step-num {
		width: 24px;
		height: 24px;
		font-size: .75rem;
	}
}

/* ── BOM table icon fix ── */
.bom-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	margin-right: 6px;
	flex-shrink: 0;
	vertical-align: middle;
	font-size: 1rem;
	line-height: 1;
}

.bom-svg {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	stroke: currentColor;
	stroke-width: 1.5;
	display: block;
}

/* Hide any leftover site chrome on calculator (standalone flow) */
.calculator-page .float-widgets,
.calculator-page .ai-chatbox,
.calculator-page #ai-chatbox,
.calculator-page #header,
.calculator-page #footer,
.calculator-page #mobile-nav {
	display: none !important;
}

/* ── Floating contact widgets (theme leftover; unused on this page) ── */
.float-widgets {
	position: fixed;
	bottom: 28px;
	right: 24px;
	z-index: 800;
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-items: flex-end;
}

.float-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border-radius: 12px;
	border: 2px solid #ffb703;
	font-size: 13px;
	font-weight: 600;
	color: #fff;
	cursor: pointer;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	text-decoration: none;
	overflow: hidden;
}

.float-btn:hover {
	width: 140px;
	padding: 0 16px;
	justify-content: flex-start;
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.float-btn-top {
	background: #0a0a0a;
	color: #CCFF66;
	border-color: #CCFF66;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}
.float-btn-top.is-visible {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.float-btn-zalo {
	background: #0068FF;
}

.float-btn-phone {
	background: #0a0a0a;
}

.float-btn-ai {
	background: #e63946;
	border-color: #e63946;
	box-shadow: 0 0 12px rgba(230, 57, 70, 0.5);
}

.float-btn span {
	display: none;
	white-space: nowrap;
	margin-left: 10px;
}

.float-btn:hover span {
	display: inline;
}

.float-btn svg {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

/* ── AI Chatbox (injected by ai-chat.js) ── */
.ai-chatbox {
	position: fixed;
	bottom: 90px;
	right: 24px;
	width: 340px;
	max-height: 480px;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
	display: none;
	flex-direction: column;
	z-index: 900;
	border: 1px solid var(--c-border);
	overflow: hidden;
}

.ai-chatbox.open {
	display: flex;
}

.ai-chatbox-header {
	background: #0a0a0a;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	color: #fff;
}

.ai-chatbox-bot-info {
	display: flex;
	align-items: center;
	gap: 10px;
}

.ai-chatbox-avatar {
	width: 32px;
	height: 32px;
	background: var(--c-orange);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ai-chatbox-avatar svg {
	width: 16px;
	height: 16px;
	color: #fff;
}

.ai-chatbox-name {
	font-weight: 700;
	font-size: .9rem;
}

.ai-chatbox-status {
	font-size: .75rem;
	color: #aaa;
}

.ai-chatbox-close {
	background: none;
	border: none;
	color: #aaa;
	cursor: pointer;
	padding: 4px;
}

.ai-chatbox-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	font-size: .85rem;
	line-height: 1.5;
}

.ai-msg {
	padding: 10px 14px;
	border-radius: 12px;
	max-width: 85%;
}

.ai-msg.bot {
	background: var(--c-surface);
	border: 1px solid var(--c-border);
	align-self: flex-start;
}

.ai-msg.user {
	background: var(--c-orange);
	color: #fff;
	align-self: flex-end;
}

.ai-chatbox-input-area {
	display: flex;
	padding: 12px;
	gap: 8px;
	border-top: 1px solid var(--c-border);
}

.ai-chatbox-input-area input {
	flex: 1;
	padding: 8px 12px;
	border: 1px solid var(--c-border);
	border-radius: 8px;
	font-size: .85rem;
	outline: none;
}

.ai-chatbox-send {
	background: var(--c-orange);
	border: none;
	color: #fff;
	width: 36px;
	height: 36px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
.ai-chatbox-send:disabled,
.ai-chatbox-input-area.is-busy .ai-chatbox-send {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

@media (max-width: 480px) {
	.bill-kwh-toggle {
		width: 100%;
	}

	.bill-kwh-toggle button {
		flex: 1;
		white-space: nowrap;
	}
}