/* ===== Brand colours =====
   Sampled from your site's existing heading / button colours. If you have
   exact brand hex codes, just change these two lines — everything else
   references them via var(). */
.iec60890-calc {
	--iec-blue: #181D4E;
	--iec-blue-light: #eaf0fb;
	--iec-red: #FA4729;
	--iec-red-dark: #DD3A1E;
	--iec-grey: #9aa0ac;
}

.iec60890-calc {
	max-width: 980px;
	margin: 0 auto;
	font-size: 16px;
	line-height: 1.55;
}
.iec60890-calc,
.iec60890-calc * {
	box-sizing: border-box;
}
.iec60890-calc .iec-section {
	border: 1px solid #e2e2e2;
	border-radius: 8px;
	padding: 20px 22px;
	margin-bottom: 20px;
	background: #fafafa;
}

/* Headings: explicit colour + !important so the theme's own heading styles
   (which were making these invisible/white) can never override them. */
.iec60890-calc h3,
.iec60890-calc h4 {
	margin: 0 0 12px;
	font-size: 19px;
	color: var(--iec-blue) !important;
	font-weight: 700;
}
.iec60890-calc h4 {
	font-size: 16px;
	margin-top: 18px;
}

.iec60890-calc .iec-hint {
	margin: -4px 0 14px;
	font-size: 13px;
	color: #666;
}
.iec60890-calc .req {
	color: var(--iec-red);
}

.iec-toggle {
	display: inline-flex !important;
	flex-direction: row !important;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
	color: #333;
	margin-bottom: 14px;
	cursor: pointer;
}
.iec-toggle input {
	width: 18px;
	height: 18px;
	accent-color: var(--iec-red);
	cursor: pointer;
}

/* ---- Grid layout ---- */
.iec-grid {
	display: grid;
	gap: 16px;
}
.iec-grid-3 {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 720px) {
	.iec-grid-3 {
		grid-template-columns: 1fr;
	}
}

/* ---- Labels & inputs ----
   IMPORTANT: a <label> here has exactly TWO children — a `.iec-label-text`
   span and the input/select. That keeps flex-direction:column labels to two
   stacked rows (text, then control) instead of one row per child node,
   which is what was pushing the "*" onto its own line before. */
.iec60890-calc label {
	display: flex;
	flex-direction: column;
	font-weight: 600;
	font-size: 13px;
	color: #333;
	gap: 5px;
}
.iec60890-calc .iec-label-text {
	display: flex;
	align-items: flex-end;
	min-height: 2.4em;
	line-height: 1.3;
}
.iec60890-calc .iec-field-note {
	font-weight: normal;
	font-size: 12px;
	color: #777;
	font-style: italic;
	margin-top: -2px;
}

.iec60890-calc input[type="text"],
.iec60890-calc input[type="number"],
.iec60890-calc input[type="email"],
.iec60890-calc input[type="tel"],
.iec60890-calc select {
	font-weight: normal;
	padding: 9px 10px;
	border: 1px solid #ccc !important;
	background: #fff !important;
	border-radius: 5px;
	font-size: 15px;
	width: 100%;
	-webkit-appearance: auto !important;
	appearance: auto !important;
	color: #222 !important;
	min-height: 40px;
	/* See the matching comment on table.iec-dyn-table select below — defeats
	   theme "reveal on scroll" animations that leave dynamically-added
	   elements permanently invisible. */
	visibility: visible !important;
	opacity: 1 !important;
	transform: none !important;
	animation: none !important;
	transition: none !important;
}
.iec60890-calc input:focus,
.iec60890-calc select:focus {
	outline: 2px solid var(--iec-blue);
	outline-offset: 1px;
}

/* ---- Installation type cards ---- */
.iec-install-types {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 10px;
	margin-bottom: 14px;
}
.iec-radio-card {
	display: flex !important;
	flex-direction: row !important;
	align-items: flex-start;
	gap: 8px;
	border: 1px solid #ddd;
	border-radius: 6px;
	padding: 10px 12px;
	background: #fff;
	font-weight: normal !important;
	font-size: 13.5px;
	cursor: pointer;
}
.iec-radio-card input {
	margin-top: 2px;
}
.iec-radio-card:has(input:checked) {
	border-color: var(--iec-blue);
	background: var(--iec-blue-light);
}

/* ---- Installation-type help / guide ---- */
.iec-help {
	border: 1px dashed #c7c9d1;
	border-radius: 6px;
	padding: 10px 14px;
	background: #fff;
}
.iec-help summary {
	cursor: pointer;
	font-weight: 600;
	color: var(--iec-blue);
	list-style: none;
}
.iec-help summary::-webkit-details-marker {
	display: none;
}
.iec-help summary::before {
	content: "?  ";
	display: inline-block;
	width: 20px;
	height: 20px;
	line-height: 18px;
	text-align: center;
	border-radius: 50%;
	border: 1px solid var(--iec-blue);
	margin-right: 6px;
	font-size: 12px;
}
.iec-help-body {
	margin-top: 12px;
	font-size: 13px;
	color: #444;
}
.iec-legend-swatch {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 2px;
	margin: 0 2px -1px 8px;
}
.iec-legend-free {
	background: var(--iec-blue);
}
.iec-legend-blocked {
	background: var(--iec-grey);
}
.iec-diagram-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 14px;
	margin-top: 12px;
}
.iec-diagram-card {
	text-align: center;
	background: #fbfbfc;
	border: 1px solid #eee;
	border-radius: 6px;
	padding: 8px;
}
.iec-install-diagram {
	width: 100%;
	height: auto;
}
.iec-diagram-caption {
	font-size: 11.5px;
	color: #555;
	margin-top: 4px;
	line-height: 1.3;
}

/* ---- Dynamic tables (switchgear / busbar / cable) ---- */
.iec-table-wrap {
	overflow-x: auto;
	overflow-y: visible;
}
table.iec-dyn-table,
table.iec-result-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 10px;
	background: #fff;
}
table.iec-dyn-table th,
table.iec-dyn-table td,
table.iec-result-table th,
table.iec-result-table td {
	border: 1px solid #e0e0e0;
	padding: 7px 8px;
	text-align: left;
	font-size: 13.5px;
}
table.iec-dyn-table th {
	background: #f1f1f1;
	color: #333;
}
table.iec-dyn-table input,
table.iec-dyn-table select {
	width: 100%;
	min-width: 100px;
	padding: 7px;
	border: 1px solid #ccc !important;
	background: #fff !important;
	border-radius: 4px;
	-webkit-appearance: auto !important;
	appearance: auto !important;
	min-height: 36px;
	/* Defeats theme "reveal on scroll / fade-in" animation systems that set
	   visibility:hidden/opacity:0 on elements until a page-load-time scan
	   reveals them — a scan that never sees rows added later by our own JS,
	   leaving them stuck invisible. Our controls must always be visible. */
	visibility: visible !important;
	opacity: 1 !important;
	transform: none !important;
	animation: none !important;
	transition: none !important;
}
.iec-remove-row {
	background: #fbeaea;
	border: 1px solid #e0b4b4;
	color: var(--iec-red-dark);
	border-radius: 4px;
	width: 30px;
	height: 30px;
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
}
.iec-add-row {
	margin-top: 4px;
}

/* ---- Buttons: red, per brand preference ---- */
.iec60890-calc .button,
.iec60890-calc .iec-add-row,
.iec60890-calc .iec-submit,
.iec60890-calc .iec-download-pdf {
	background: var(--iec-red) !important;
	border: 1px solid var(--iec-red-dark) !important;
	color: #fff !important;
	font-weight: 600;
	border-radius: 5px;
	cursor: pointer;
	padding: 10px 18px;
	font-size: 14px;
	transition: background 0.15s ease;
}
.iec60890-calc .button:hover,
.iec60890-calc .iec-add-row:hover,
.iec60890-calc .iec-submit:hover,
.iec60890-calc .iec-download-pdf:hover {
	background: var(--iec-red-dark) !important;
}
.iec60890-calc .iec-submit:disabled {
	opacity: 0.6;
	cursor: default;
}

.iec-submit-row {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 22px 0;
}
.iec-submit {
	font-size: 16px;
	padding: 12px 26px;
	height: auto;
}
.iec-spinner {
	width: 20px;
	height: 20px;
	border: 2px solid #ccc;
	border-top-color: var(--iec-red);
	border-radius: 50%;
	display: none;
	animation: iec-spin 0.8s linear infinite;
}
.iec-spinner.is-active {
	display: inline-block;
}
@keyframes iec-spin {
	to { transform: rotate(360deg); }
}

.iec-form-errors {
	display: none;
	background: #fbeaea;
	border: 1px solid #e0b4b4;
	color: #922;
	padding: 12px 14px;
	border-radius: 6px;
	margin-bottom: 16px;
	font-size: 14px;
}

/* ---- Results ---- */
.iec-results {
	border-top: 3px solid var(--iec-blue);
	padding-top: 22px;
	margin-top: 12px;
}
.iec-result-summary {
	border-radius: 8px;
	padding: 18px 20px;
	margin-bottom: 20px;
}
.iec-result-summary.iec-badge-ok {
	background: #eafaf0;
	border: 1px solid #a9dfbf;
}
.iec-result-summary.iec-badge-warn {
	background: #fdf2e3;
	border: 1px solid #f0c896;
}
.iec-result-headline {
	font-size: 19px;
	margin-bottom: 6px;
	color: #222;
}
.iec-result-badge {
	display: inline-block;
	font-weight: 700;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 4px 12px;
	border-radius: 20px;
	margin-bottom: 10px;
}
.iec-badge-ok .iec-result-badge {
	background: #2e7d32;
	color: #fff;
}
.iec-badge-warn .iec-result-badge {
	background: #b8600a;
	color: #fff;
}
.iec-badge.iec-badge-ok {
	background: #2e7d32;
	color: #fff;
	padding: 3px 10px;
	border-radius: 12px;
	font-size: 12px;
}
.iec-badge.iec-badge-warn {
	background: #b8600a;
	color: #fff;
	padding: 3px 10px;
	border-radius: 12px;
	font-size: 12px;
}

.iec-result-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 12px;
	margin-bottom: 22px;
}
.iec-result-grid div {
	background: #f8f9fa;
	border: 1px solid #e5e5e5;
	border-radius: 6px;
	padding: 12px 14px;
}
.iec-result-grid span {
	display: block;
	font-size: 12.5px;
	color: #666;
	margin-bottom: 4px;
}
.iec-result-grid strong {
	font-size: 17px;
	color: #222;
}
.iec-subtotal {
	text-align: right;
	font-weight: 600;
	margin-top: -4px;
	color: #333;
}
.iec-muted {
	color: #777;
	font-style: italic;
}

/* ---- Temperature-rise curve chart ---- */
.iec-curve-wrap {
	background: #fff;
	border: 1px solid #eee;
	border-radius: 8px;
	padding: 10px;
	margin-bottom: 22px;
	text-align: center;
}
.iec-curve-svg {
	width: 100%;
	max-width: 520px;
	height: auto;
}
.iec-curve-title {
	font-size: 13px;
	fill: #333;
	font-weight: 700;
}
.iec-curve-grid {
	stroke: #eee;
	stroke-width: 1;
}
.iec-curve-axis {
	stroke: #999;
	stroke-width: 1.2;
}
.iec-curve-tick {
	font-size: 10px;
	fill: #777;
}
.iec-curve-axis-title {
	font-size: 10.5px;
	fill: #555;
}
.iec-curve-line {
	fill: none;
	stroke: var(--iec-blue);
	stroke-width: 2;
}
.iec-curve-dot {
	fill: var(--iec-red);
	stroke: #fff;
	stroke-width: 1;
}
.iec-curve-point-label {
	font-size: 11px;
	fill: #222;
	font-weight: 600;
}

.iec-post-actions {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-top: 10px;
	flex-wrap: wrap;
}
.iec-email-sent {
	font-size: 13px;
	color: #2e7d32;
}

/* ---- Tier summary (multi-tier workflow) ---- */
.iec-tier-summary {
	background: #fff;
	border: 2px solid var(--iec-blue);
	border-radius: 8px;
	padding: 18px 20px;
	margin-bottom: 20px;
}
table.iec-tier-table {
	width: 100%;
	border-collapse: collapse;
	margin: 12px 0;
}
table.iec-tier-table th,
table.iec-tier-table td {
	border: 1px solid #e0e0e0;
	padding: 8px 10px;
	font-size: 13.5px;
	text-align: left;
}
table.iec-tier-table th {
	background: #f1f1f1;
}
table.iec-tier-table .tier-include {
	width: 18px;
	height: 18px;
	accent-color: var(--iec-red);
	cursor: pointer;
}
.iec-tier-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}
.iec-remove-tier {
	background: #fbeaea;
	border: 1px solid #e0b4b4;
	color: var(--iec-red-dark);
	border-radius: 4px;
	width: 28px;
	height: 28px;
	cursor: pointer;
	font-size: 15px;
	line-height: 1;
}
