/*!
 * Noblelift Calculators - front-end styles
 *
 * Everything is scoped under .nlc-calc so the calculators survive inside
 * arbitrary WordPress themes. Theme resets use doubled class specificity
 * (.nlc-calc .nlc-x) rather than !important (except in print).
 *
 * Contents
 *   1. Tokens & root
 *   2. Theme-interference resets
 *   3. Header / footer
 *   4. Layout (body grid, inputs column, groups)
 *   5. Fields (input group, affixes, help, errors)
 *   6. Buttons & actions
 *   7. KPI cards
 *   8. Panels, compare table, data table, breakdown
 *   9. Meter, badges, callouts, lists
 *  10. Charts (line, bars, stacked, legend, tooltip, series)
 *  11. Toast, noscript, utilities
 *  12. Dark variant
 *  13. Reduced motion
 *  14. Print
 */

/* ==========================================================================
   1. Tokens & root
   ========================================================================== */

.nlc-calc {
	/* Brand (accent is normally set inline from settings) */
	--nlc-accent: #ff4400;
	--nlc-accent-contrast: #ffffff;
	--nlc-accent-soft: #fff0eb; /* fallback; overridden below via color-mix() */
	--nlc-accent-strong: #d13800;

	/* Neutrals (slate) */
	--nlc-text: #0f172a;
	--nlc-muted: #5b6678;
	--nlc-bg: #f4f6f9;
	--nlc-surface: #ffffff;
	--nlc-surface-alt: #f8fafc;
	--nlc-border: #dde3ea;
	--nlc-border-strong: #c3ccd7;

	/* Status */
	--nlc-good: #15803d;
	--nlc-warn: #b45309;
	--nlc-bad: #b91c1c;
	--nlc-good-soft: #ecfdf3;
	--nlc-warn-soft: #fff7ed;
	--nlc-bad-soft: #fef2f2;

	/* Shape & type */
	--nlc-radius: 10px;
	--nlc-radius-sm: 6px;
	--nlc-font: inherit;
	--nlc-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 2px 8px rgba(15, 23, 42, 0.04);
	--nlc-shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.14);
	--nlc-focus: 0 0 0 3px var(--nlc-accent-soft), 0 0 0 1px var(--nlc-accent);
	--nlc-gap: clamp(1rem, 2.5vw, 1.75rem);

	/* Stacked chart palette */
	--nlc-s1: var(--nlc-accent);
	--nlc-s2: #475569;
	--nlc-s3: #b7791f;
	--nlc-s4: #0f766e;
	--nlc-s5: #6d5a9e;

	container-type: inline-size;
	container-name: nlc-root;
	position: relative;
	box-sizing: border-box;
	max-width: 100%;
	margin: 0 0 2rem;
	padding: clamp(1rem, 3vw, 2rem);
	background: var(--nlc-bg);
	border: 1px solid var(--nlc-border);
	border-top: 4px solid var(--nlc-accent);
	border-radius: var(--nlc-radius);
	color: var(--nlc-text);
	font-family: var(--nlc-font, inherit);
	font-size: 1rem;
	line-height: 1.5;
	text-align: left;
	-webkit-text-size-adjust: 100%;
}

@supports (color: color-mix(in srgb, red 50%, white)) {
	.nlc-calc {
		--nlc-accent-soft: color-mix(in srgb, var(--nlc-accent) 9%, var(--nlc-surface));
		--nlc-accent-strong: color-mix(in srgb, var(--nlc-accent) 82%, #000);
		--nlc-good-soft: color-mix(in srgb, var(--nlc-good) 9%, var(--nlc-surface));
		--nlc-warn-soft: color-mix(in srgb, var(--nlc-warn) 10%, var(--nlc-surface));
		--nlc-bad-soft: color-mix(in srgb, var(--nlc-bad) 8%, var(--nlc-surface));
	}
}

.nlc-calc *,
.nlc-calc *::before,
.nlc-calc *::after {
	box-sizing: inherit;
}

/* ==========================================================================
   2. Theme-interference resets
   ========================================================================== */

.nlc-calc h2,
.nlc-calc h3,
.nlc-calc p,
.nlc-calc dl,
.nlc-calc dt,
.nlc-calc dd,
.nlc-calc ul,
.nlc-calc li,
.nlc-calc form,
.nlc-calc fieldset,
.nlc-calc legend,
.nlc-calc figure {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	text-transform: none;
	letter-spacing: normal;
	font-family: inherit;
	color: inherit;
}

.nlc-calc fieldset {
	min-width: 0;
}

.nlc-calc legend {
	float: none;
	width: auto;
	max-width: 100%;
	font-size: inherit;
	line-height: inherit;
}

.nlc-calc table {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	border-spacing: 0;
	background: none;
	font-size: inherit;
	table-layout: auto;
}

.nlc-calc th,
.nlc-calc td {
	margin: 0;
	border: 0;
	background: none;
	box-shadow: none;
	text-transform: none;
	letter-spacing: normal;
	vertical-align: middle;
	font-family: inherit;
	color: inherit;
}

.nlc-calc input,
.nlc-calc button {
	margin: 0;
	font-family: inherit;
	font-size: inherit;
	line-height: inherit;
	letter-spacing: normal;
	text-transform: none;
	text-shadow: none;
}

.nlc-calc svg {
	max-width: none;
}

.nlc-calc [hidden] {
	display: none;
}

/* ==========================================================================
   3. Header / footer
   ========================================================================== */

.nlc-calc .nlc-calc__header {
	margin-bottom: var(--nlc-gap);
	max-width: 52rem;
}

.nlc-calc .nlc-calc__eyebrow {
	margin-bottom: 0.35rem;
	color: var(--nlc-accent);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.nlc-calc .nlc-calc__title {
	margin-bottom: 0.5rem;
	color: var(--nlc-text);
	font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem);
	font-weight: 800;
	line-height: 1.15;
	letter-spacing: -0.015em;
}

.nlc-calc .nlc-calc__intro {
	color: var(--nlc-muted);
	font-size: 1.0625rem;
}

.nlc-calc .nlc-calc__footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem 1.5rem;
	margin-top: var(--nlc-gap);
	padding-top: var(--nlc-gap);
	border-top: 1px solid var(--nlc-border);
}

.nlc-calc .nlc-disclaimer {
	flex: 1 1 22rem;
	color: var(--nlc-muted);
	font-size: 0.8125rem;
	line-height: 1.55;
}

/* ==========================================================================
   4. Layout
   ========================================================================== */

.nlc-calc .nlc-calc__body {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--nlc-gap);
	align-items: start;
}

@media (min-width: 960px) {
	.nlc-calc .nlc-calc__body {
		grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
	}
}

/* Container-query refinement: only go two-column when the calculator itself is wide */
@container nlc-root (max-width: 899px) {
	.nlc-calc .nlc-calc__body {
		grid-template-columns: minmax(0, 1fr);
	}
}

@container nlc-root (min-width: 900px) {
	.nlc-calc .nlc-calc__body {
		grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
	}
	.nlc-calc .nlc-calc__inputs {
		position: sticky;
		top: 2rem;
		max-height: calc(100vh - 4rem);
		overflow-y: auto;
		overscroll-behavior: contain;
		scrollbar-width: thin;
	}
}

.nlc-calc .nlc-calc__inputs {
	container-type: inline-size;
	container-name: nlc-inputs;
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	padding: 1.25rem;
	background: var(--nlc-surface);
	border: 1px solid var(--nlc-border);
	border-radius: var(--nlc-radius);
	box-shadow: var(--nlc-shadow);
}

.nlc-calc .nlc-calc__results {
	display: flex;
	flex-direction: column;
	gap: var(--nlc-gap);
	min-width: 0;
}

/* Field groups */
.nlc-calc .nlc-group {
	display: block;
	min-width: 0;
}

.nlc-calc .nlc-group + .nlc-group,
.nlc-calc .nlc-group + .nlc-group-pair {
	padding-top: 1.25rem;
	border-top: 1px solid var(--nlc-border);
}

.nlc-calc .nlc-group__title {
	/* Floated so the legend leaves the fieldset border: the divider then runs above the title, not through it. */
	float: left;
	width: 100%;
	display: block;
	margin-bottom: 0.875rem;
	padding: 0;
	color: var(--nlc-text);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.09em;
	text-transform: uppercase;
}

.nlc-calc .nlc-group__title::before {
	content: "";
	display: inline-block;
	width: 0.5rem;
	height: 0.5rem;
	margin-right: 0.5rem;
	border-radius: 2px;
	background: var(--nlc-accent);
	vertical-align: 0.05em;
}

.nlc-calc .nlc-group--option-alt .nlc-group__title::before {
	background: #475569;
}

.nlc-calc .nlc-group__grid {
	clear: both;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr));
	gap: 0.875rem 1rem;
}

/* Paired groups (e.g. lithium | lead-acid) sit side by side only when the inputs column is wide */
.nlc-calc .nlc-group-pair {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1.25rem;
}

.nlc-calc .nlc-group-pair > .nlc-group + .nlc-group {
	padding-top: 1.25rem;
	border-top: 1px solid var(--nlc-border);
}

@supports not (container-type: inline-size) {
	@media (min-width: 640px) and (max-width: 959px) {
		.nlc-calc .nlc-group-pair {
			grid-template-columns: repeat(2, minmax(0, 1fr));
		}
		.nlc-calc .nlc-group-pair > .nlc-group + .nlc-group {
			padding-top: 0;
			border-top: 0;
		}
	}
}

@container nlc-inputs (min-width: 640px) {
	.nlc-calc .nlc-group-pair {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 1.5rem;
	}
	.nlc-calc .nlc-group-pair > .nlc-group + .nlc-group {
		padding-top: 0;
		padding-left: 1.5rem;
		border-top: 0;
		border-left: 1px solid var(--nlc-border);
	}
}

/* ==========================================================================
   5. Fields
   ========================================================================== */

.nlc-calc .nlc-field {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	min-width: 0;
}

.nlc-calc .nlc-field__label {
	display: block;
	margin: 0;
	color: var(--nlc-text);
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1.3;
	text-transform: none;
	letter-spacing: normal;
}

.nlc-calc .nlc-field__control {
	display: flex;
	align-items: stretch;
	min-width: 0;
	background: var(--nlc-surface);
	border: 1px solid var(--nlc-border-strong);
	border-radius: var(--nlc-radius-sm);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.nlc-calc .nlc-field__control:hover {
	border-color: var(--nlc-muted);
}

.nlc-calc .nlc-field__control:focus-within {
	border-color: var(--nlc-accent);
	box-shadow: 0 0 0 3px var(--nlc-accent-soft);
}

.nlc-calc .nlc-field__input,
.nlc-calc input.nlc-field__input[type="number"] {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	height: auto;
	min-height: 2.5rem;
	margin: 0;
	padding: 0.5rem 0.7rem;
	background: transparent;
	border: 0;
	border-radius: var(--nlc-radius-sm);
	box-shadow: none;
	outline: none;
	color: var(--nlc-text);
	font-family: inherit;
	font-size: 1rem; /* >= 16px avoids iOS zoom */
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	line-height: 1.4;
	text-align: left;
	-webkit-appearance: none;
	-moz-appearance: textfield;
	appearance: textfield;
}

.nlc-calc .nlc-field__input::-webkit-outer-spin-button,
.nlc-calc .nlc-field__input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.nlc-calc .nlc-field__input:focus,
.nlc-calc .nlc-field__input:focus-visible {
	outline: none;
	border: 0;
	box-shadow: none;
	background: transparent;
}

.nlc-calc .nlc-field__affix {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	padding: 0 0.65rem;
	background: var(--nlc-surface-alt);
	color: var(--nlc-muted);
	font-size: 0.8125rem;
	font-weight: 600;
	white-space: nowrap;
	user-select: none;
}

.nlc-calc .nlc-field__affix--prefix {
	border-right: 1px solid var(--nlc-border);
	border-radius: var(--nlc-radius-sm) 0 0 var(--nlc-radius-sm);
}

.nlc-calc .nlc-field__affix--suffix {
	border-left: 1px solid var(--nlc-border);
	border-radius: 0 var(--nlc-radius-sm) var(--nlc-radius-sm) 0;
}

.nlc-calc .nlc-field__help {
	color: var(--nlc-muted);
	font-size: 0.75rem;
	line-height: 1.4;
}

.nlc-calc .nlc-field__error {
	color: var(--nlc-bad);
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.4;
}

.nlc-calc .nlc-field--invalid .nlc-field__control {
	border-color: var(--nlc-bad);
	background: var(--nlc-bad-soft);
}

.nlc-calc .nlc-field--invalid .nlc-field__control:focus-within {
	box-shadow: 0 0 0 3px var(--nlc-bad-soft), 0 0 0 1px var(--nlc-bad);
}

/* Align inputs across a row even when one label wraps to two lines (label | control | help | error). */
@supports (grid-template-rows: subgrid) {
	.nlc-calc .nlc-group__grid {
		row-gap: 0;
		margin-bottom: -0.875rem;
	}
	.nlc-calc .nlc-field {
		display: grid;
		grid-row: span 4;
		grid-template-rows: subgrid;
		gap: 0;
		padding-bottom: 0.875rem;
	}
	.nlc-calc .nlc-field__label {
		grid-row: 1;
		align-self: end;
	}
	.nlc-calc .nlc-field__control {
		grid-row: 2;
		margin-top: 0.3rem;
	}
	.nlc-calc .nlc-field__help {
		grid-row: 3;
		margin-top: 0.3rem;
	}
	.nlc-calc .nlc-field__error {
		grid-row: 4;
		margin-top: 0.3rem;
	}
}

/* ==========================================================================
   6. Buttons & actions
   ========================================================================== */

.nlc-calc .nlc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	min-height: 2.5rem;
	margin: 0;
	padding: 0.55rem 1.1rem;
	border: 1px solid transparent;
	border-radius: var(--nlc-radius-sm);
	box-shadow: none;
	background: none;
	color: inherit;
	font-family: inherit;
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.01em;
	text-align: center;
	text-decoration: none;
	text-transform: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.nlc-calc .nlc-btn:active {
	transform: translateY(1px);
}

.nlc-calc .nlc-btn:focus {
	outline: none;
}

.nlc-calc .nlc-btn:focus-visible {
	outline: 2px solid var(--nlc-accent);
	outline-offset: 2px;
}

.nlc-calc .nlc-btn--primary,
.nlc-calc a.nlc-btn--primary {
	background: var(--nlc-accent);
	border-color: var(--nlc-accent);
	color: var(--nlc-accent-contrast);
}

.nlc-calc .nlc-btn--primary:hover,
.nlc-calc a.nlc-btn--primary:hover,
.nlc-calc a.nlc-btn--primary:focus {
	background: var(--nlc-accent-strong);
	border-color: var(--nlc-accent-strong);
	color: var(--nlc-accent-contrast);
	text-decoration: none;
}

.nlc-calc .nlc-btn--ghost {
	background: var(--nlc-surface);
	border-color: var(--nlc-border-strong);
	color: var(--nlc-text);
}

.nlc-calc .nlc-btn--ghost:hover {
	background: var(--nlc-surface-alt);
	border-color: var(--nlc-muted);
	color: var(--nlc-text);
}

.nlc-calc .nlc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	padding-top: 1rem;
	border-top: 1px solid var(--nlc-border);
}

.nlc-calc .nlc-actions .nlc-btn {
	flex: 1 1 auto;
}

.nlc-calc .nlc-cta {
	flex: 0 0 auto;
	padding: 0.75rem 1.5rem;
	font-size: 0.9375rem;
}

/* ==========================================================================
   7. KPI cards
   ========================================================================== */

/* Flex (not grid) so the secondary cards always share a row evenly: no orphan cell. */
.nlc-calc .nlc-kpis {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
}

.nlc-calc .nlc-kpi {
	display: flex;
	flex: 1 1 10.5rem;
	flex-direction: column;
	gap: 0.25rem;
	min-width: 0;
	padding: 1.1rem 1.25rem;
	background: var(--nlc-surface);
	border: 1px solid var(--nlc-border);
	border-radius: var(--nlc-radius);
	box-shadow: var(--nlc-shadow);
}

.nlc-calc .nlc-kpi__label {
	color: var(--nlc-muted);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 1.3;
	text-transform: uppercase;
}

.nlc-calc .nlc-kpi__value {
	color: var(--nlc-text);
	font-size: clamp(1.5rem, 1.2rem + 1vw, 1.875rem);
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	line-height: 1.1;
	letter-spacing: -0.02em;
	overflow-wrap: anywhere;
}

.nlc-calc .nlc-kpi__note {
	color: var(--nlc-muted);
	font-size: 0.8125rem;
	line-height: 1.4;
}

.nlc-calc .nlc-kpi__value.nlc-is-negative {
	color: var(--nlc-bad);
}

.nlc-calc .nlc-kpi__value.nlc-is-positive {
	color: var(--nlc-text);
}

/* Primary KPI: accent card on its own full-width row */
.nlc-calc .nlc-kpi--primary {
	flex-basis: 100%;
	background: var(--nlc-accent);
	border-color: var(--nlc-accent);
	color: var(--nlc-accent-contrast);
	box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
	background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.12));
}

.nlc-calc .nlc-kpi--primary .nlc-kpi__label,
.nlc-calc .nlc-kpi--primary .nlc-kpi__note {
	color: var(--nlc-accent-contrast);
	opacity: 0.88;
}

.nlc-calc .nlc-kpi--primary .nlc-kpi__value,
.nlc-calc .nlc-kpi--primary .nlc-kpi__value.nlc-is-negative,
.nlc-calc .nlc-kpi--primary .nlc-kpi__value.nlc-is-positive {
	color: var(--nlc-accent-contrast);
	font-size: clamp(1.875rem, 1.4rem + 1.8vw, 2.625rem);
}

/* ==========================================================================
   8. Panels & tables
   ========================================================================== */

.nlc-calc .nlc-panel {
	min-width: 0;
	padding: clamp(1rem, 2.5vw, 1.5rem);
	background: var(--nlc-surface);
	border: 1px solid var(--nlc-border);
	border-radius: var(--nlc-radius);
	box-shadow: var(--nlc-shadow);
}

.nlc-calc .nlc-panel > * + * {
	margin-top: 1rem;
}

.nlc-calc .nlc-panel__title {
	margin: 0 0 1rem;
	padding: 0 0 0.75rem;
	border-bottom: 1px solid var(--nlc-border);
	color: var(--nlc-text);
	font-size: 1.0625rem;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -0.005em;
}

.nlc-calc .nlc-panel > .nlc-panel__title + * {
	margin-top: 0;
}

/* Title with a trailing status badge */
.nlc-calc .nlc-panel--status .nlc-panel__title {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
}

.nlc-calc .nlc-panel__note {
	margin-bottom: 0;
	color: var(--nlc-muted);
	font-size: 0.8125rem;
	line-height: 1.45;
}

.nlc-calc .nlc-compare__sub {
	display: block;
	margin-top: 0.15rem;
	color: var(--nlc-muted);
	font-size: 0.75rem;
	font-weight: 400;
	white-space: normal;
}

.nlc-calc .nlc-compare__sub:empty {
	display: none;
}

.nlc-calc .nlc-num {
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* Comparison table */
.nlc-calc .nlc-compare {
	font-size: 0.9375rem;
}

.nlc-calc .nlc-compare th,
.nlc-calc .nlc-compare td {
	padding: 0.65rem 0.75rem;
	border-bottom: 1px solid var(--nlc-border);
	text-align: left;
}

.nlc-calc .nlc-compare thead th {
	color: var(--nlc-muted);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	border-bottom: 2px solid var(--nlc-border-strong);
}

.nlc-calc .nlc-compare td:not(:first-child),
.nlc-calc .nlc-compare th:not(:first-child) {
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.nlc-calc .nlc-compare tbody th {
	font-weight: 500;
}

.nlc-calc .nlc-compare .nlc-col--lithium,
.nlc-calc .nlc-compare td:nth-child(2) {
	background: var(--nlc-accent-soft);
}

.nlc-calc .nlc-compare thead .nlc-col--lithium {
	color: var(--nlc-accent);
	box-shadow: inset 0 3px 0 var(--nlc-accent);
}

.nlc-calc .nlc-compare .nlc-compare__total th,
.nlc-calc .nlc-compare .nlc-compare__total td {
	border-top: 2px solid var(--nlc-text);
	border-bottom: 0;
	font-weight: 800;
	font-size: 1rem;
}

/* Generic data table */
.nlc-calc .nlc-table-wrap {
	max-width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border: 1px solid var(--nlc-border);
	border-radius: var(--nlc-radius-sm);
}

.nlc-calc .nlc-table {
	min-width: 32rem;
	font-size: 0.875rem;
}

.nlc-calc .nlc-table th,
.nlc-calc .nlc-table td {
	padding: 0.55rem 0.75rem;
	border-bottom: 1px solid var(--nlc-border);
	text-align: left;
}

.nlc-calc .nlc-table thead th {
	position: sticky;
	top: 0;
	background: var(--nlc-surface-alt);
	color: var(--nlc-muted);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	white-space: nowrap;
}

.nlc-calc .nlc-table th.nlc-num,
.nlc-calc .nlc-table td.nlc-num {
	text-align: right;
}

.nlc-calc .nlc-table tbody tr:nth-child(even) {
	background: var(--nlc-surface-alt);
}

.nlc-calc .nlc-table tbody tr:last-child td,
.nlc-calc .nlc-table tbody tr:last-child th {
	border-bottom: 0;
}

.nlc-calc .nlc-table .nlc-row--highlight,
.nlc-calc .nlc-table tbody tr.nlc-row--highlight:nth-child(even) {
	background: var(--nlc-accent-soft);
}

.nlc-calc .nlc-table .nlc-row--highlight > :first-child {
	box-shadow: inset 3px 0 0 var(--nlc-accent);
	font-weight: 700;
}

.nlc-calc .nlc-table tfoot th,
.nlc-calc .nlc-table tfoot td {
	border-top: 2px solid var(--nlc-border-strong);
	border-bottom: 0;
	background: var(--nlc-surface);
	font-weight: 800;
}

/* Breakdown list */
.nlc-calc .nlc-breakdown {
	display: flex;
	flex-direction: column;
	font-size: 0.9375rem;
}

.nlc-calc .nlc-breakdown__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.55rem 0;
	border-bottom: 1px dashed var(--nlc-border);
}

.nlc-calc .nlc-breakdown__row dt {
	color: var(--nlc-muted);
	font-weight: 500;
}

.nlc-calc .nlc-breakdown__row dd {
	margin: 0;
	color: var(--nlc-text);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.nlc-calc .nlc-breakdown__row--total {
	margin-top: 0.25rem;
	padding-top: 0.75rem;
	border-top: 2px solid var(--nlc-text);
	border-bottom: 0;
}

.nlc-calc .nlc-breakdown__row--total dt,
.nlc-calc .nlc-breakdown__row--total dd {
	color: var(--nlc-text);
	font-size: 1.0625rem;
	font-weight: 800;
}

/* ==========================================================================
   9. Meter, badges, callouts, lists
   ========================================================================== */

.nlc-calc .nlc-meter {
	--nlc-meter: 0;
	--nlc-meter-color: var(--nlc-accent);
	position: relative;
	height: 0.75rem;
	overflow: hidden;
	background: var(--nlc-border);
	border-radius: 999px;
}

.nlc-calc .nlc-meter__fill {
	width: calc(var(--nlc-meter) * 1%);
	max-width: 100%;
	height: 100%;
	background: var(--nlc-meter-color);
	border-radius: inherit;
	transition: width 0.35s ease, background-color 0.2s ease;
}

.nlc-calc .nlc-meter--good { --nlc-meter-color: var(--nlc-good); }
.nlc-calc .nlc-meter--warn { --nlc-meter-color: var(--nlc-warn); }
.nlc-calc .nlc-meter--bad  { --nlc-meter-color: var(--nlc-bad); }

.nlc-calc .nlc-meter__labels {
	display: flex;
	justify-content: space-between;
	gap: 0.5rem;
	margin-top: 0.4rem;
	color: var(--nlc-muted);
	font-size: 0.75rem;
	font-variant-numeric: tabular-nums;
}

.nlc-calc .nlc-panel > .nlc-meter + .nlc-meter__labels {
	margin-top: 0.4rem;
}

.nlc-calc .nlc-meter__labels > span:nth-child(2):not(:last-child) {
	text-align: center;
}

.nlc-calc .nlc-meter__labels > span:last-child {
	text-align: right;
}

.nlc-calc .nlc-meter__labels strong {
	color: var(--nlc-text);
	font-weight: 700;
}

/* Badges */
.nlc-calc .nlc-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.2rem 0.6rem;
	border: 1px solid var(--nlc-border);
	border-radius: 999px;
	background: var(--nlc-surface-alt);
	color: var(--nlc-muted);
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1.4;
	letter-spacing: 0.02em;
	white-space: nowrap;
	vertical-align: middle;
}

.nlc-calc .nlc-badge::before {
	content: "";
	width: 0.45rem;
	height: 0.45rem;
	border-radius: 50%;
	background: currentColor;
}

.nlc-calc .nlc-badge:empty {
	display: none;
}

.nlc-calc .nlc-badge--good { color: var(--nlc-good); background: var(--nlc-good-soft); border-color: currentColor; }
.nlc-calc .nlc-badge--warn { color: var(--nlc-warn); background: var(--nlc-warn-soft); border-color: currentColor; }
.nlc-calc .nlc-badge--bad  { color: var(--nlc-bad);  background: var(--nlc-bad-soft);  border-color: currentColor; }

/* Callouts */
.nlc-calc .nlc-callout {
	padding: 0.85rem 1rem;
	border: 1px solid var(--nlc-border);
	border-left: 4px solid var(--nlc-muted);
	border-radius: var(--nlc-radius-sm);
	background: var(--nlc-surface-alt);
	color: var(--nlc-text);
	font-size: 0.9375rem;
	line-height: 1.5;
}

.nlc-calc .nlc-callout:empty {
	display: none;
}

.nlc-calc .nlc-callout--good { border-left-color: var(--nlc-good); background: var(--nlc-good-soft); }
.nlc-calc .nlc-callout--warn { border-left-color: var(--nlc-warn); background: var(--nlc-warn-soft); }
.nlc-calc .nlc-callout--bad  { border-left-color: var(--nlc-bad);  background: var(--nlc-bad-soft); }

/* Marketing bullet list */
.nlc-calc .nlc-list {
	display: grid;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.nlc-calc .nlc-list li {
	position: relative;
	margin: 0;
	padding: 0 0 0 1.75rem;
	list-style: none;
	line-height: 1.5;
}

.nlc-calc .nlc-list li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.2em;
	width: 1.1rem;
	height: 1.1rem;
	border-radius: 50%;
	background: var(--nlc-accent-soft);
}

.nlc-calc .nlc-list li::after {
	content: "";
	position: absolute;
	left: 0.38rem;
	top: calc(0.2em + 0.24rem);
	width: 0.32rem;
	height: 0.55rem;
	border: solid var(--nlc-accent);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

/* ==========================================================================
   10. Charts
   ========================================================================== */

.nlc-calc .nlc-chart {
	position: relative;
	min-height: 2rem;
	color: var(--nlc-text);
}

.nlc-calc .nlc-chart__svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
	font-family: inherit;
}

.nlc-calc .nlc-chart__grid {
	stroke: var(--nlc-border);
	stroke-width: 1;
	shape-rendering: crispEdges;
}

.nlc-calc .nlc-chart__axis {
	stroke: var(--nlc-border-strong);
	stroke-width: 1;
	shape-rendering: crispEdges;
}

.nlc-calc .nlc-chart__gridline {
	stroke: var(--nlc-border);
	stroke-width: 1;
}

.nlc-calc .nlc-chart__gridline--zero,
.nlc-calc .nlc-chart__axis-line {
	stroke: var(--nlc-border-strong);
	stroke-width: 1;
}

.nlc-calc .nlc-chart__axis-line--y {
	stroke: none;
}

.nlc-calc .nlc-chart__tick,
.nlc-calc .nlc-chart__axis-label {
	fill: var(--nlc-muted);
	stroke: none;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
}

.nlc-calc .nlc-chart__axis-label {
	font-weight: 600;
}

.nlc-calc .nlc-chart__line {
	fill: none;
	stroke: currentColor;
	stroke-width: 3;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.nlc-calc .nlc-chart__point {
	fill: currentColor;
	stroke: var(--nlc-surface);
	stroke-width: 2;
}

.nlc-calc .nlc-chart__point.is-active {
	stroke: currentColor;
	stroke-width: 4;
}

.nlc-calc .nlc-chart__point--quiet {
	opacity: 0;
}

.nlc-calc .nlc-chart__point--quiet.is-active {
	opacity: 1;
}

.nlc-calc .nlc-chart__marker,
.nlc-calc .nlc-chart__marker line {
	stroke: var(--nlc-muted);
	stroke-width: 1.25;
	stroke-dasharray: 4 4;
}

.nlc-calc .nlc-chart__marker text,
.nlc-calc .nlc-chart__marker-label {
	fill: var(--nlc-muted);
	stroke: none;
	font-size: 11px;
	font-weight: 600;
}

.nlc-calc .nlc-chart__hover,
.nlc-calc .nlc-chart__hover-line,
.nlc-calc .nlc-chart__cursor {
	stroke: var(--nlc-border-strong);
	stroke-width: 1;
	pointer-events: none;
}

.nlc-calc .nlc-chart__overlay {
	fill: transparent;
	cursor: crosshair;
}

.nlc-calc .nlc-chart:focus-visible,
.nlc-calc .nlc-chart__svg:focus-visible {
	outline: 2px solid var(--nlc-accent);
	outline-offset: 4px;
	border-radius: var(--nlc-radius-sm);
}

.nlc-calc .nlc-chart__tooltip {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 5;
	min-width: 9rem;
	max-width: 16rem;
	padding: 0.55rem 0.7rem;
	background: var(--nlc-surface);
	border: 1px solid var(--nlc-border);
	border-radius: var(--nlc-radius-sm);
	box-shadow: var(--nlc-shadow-lg);
	color: var(--nlc-text);
	font-size: 0.8125rem;
	font-variant-numeric: tabular-nums;
	line-height: 1.4;
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.12s ease;
}

.nlc-calc .nlc-chart__tooltip.is-visible {
	opacity: 1;
	visibility: visible;
}

.nlc-calc .nlc-chart__tooltip-title {
	margin-bottom: 0.25rem;
	font-weight: 700;
}

.nlc-calc .nlc-chart__tooltip-row {
	display: flex;
	align-items: center;
	gap: 0.45rem;
}

.nlc-calc .nlc-chart__tooltip-swatch {
	flex: 0 0 auto;
	width: 0.6rem;
	height: 0.6rem;
	border-radius: 2px;
	background: currentColor;
}

.nlc-calc .nlc-chart__tooltip-label {
	flex: 1 1 auto;
	color: var(--nlc-muted);
}

.nlc-calc .nlc-chart__tooltip-value {
	margin-left: 0.5rem;
	color: var(--nlc-text);
	font-weight: 700;
	white-space: nowrap;
}

/* Legend */
.nlc-calc .nlc-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 1.1rem;
	margin: 0.75rem 0 0;
	padding: 0;
	list-style: none;
	color: var(--nlc-muted);
	font-size: 0.8125rem;
}

.nlc-calc .nlc-legend__item {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.nlc-calc .nlc-legend__swatch {
	display: inline-block;
	flex: 0 0 auto;
	width: 0.85rem;
	height: 0.85rem;
	border-radius: 3px;
	background: currentColor;
}

.nlc-calc .nlc-legend__label {
	color: var(--nlc-text);
}

/* Horizontal bars */
.nlc-calc .nlc-bars {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.nlc-calc .nlc-bars__row {
	display: grid;
	grid-template-columns: minmax(6rem, 30%) minmax(0, 1fr) auto;
	align-items: center;
	gap: 0.75rem;
}

.nlc-calc .nlc-bars__label,
.nlc-calc .nlc-stack__label {
	color: var(--nlc-text);
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.3;
}

.nlc-calc .nlc-bars__track,
.nlc-calc .nlc-stack__track {
	position: relative;
	display: flex;
	height: 1.5rem;
	overflow: hidden;
	background: var(--nlc-surface-alt);
	border: 1px solid var(--nlc-border);
	border-radius: var(--nlc-radius-sm);
}

.nlc-calc .nlc-bars__fill {
	height: 100%;
	min-width: 2px;
	background: currentColor;
	border-radius: 0 4px 4px 0;
	transition: width 0.35s ease;
}

.nlc-calc .nlc-bars__value,
.nlc-calc .nlc-stack__value,
.nlc-calc .nlc-stack__total {
	color: var(--nlc-text);
	font-size: 0.875rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	text-align: right;
	white-space: nowrap;
}

@container nlc-root (max-width: 480px) {
	.nlc-calc .nlc-bars__row {
		grid-template-columns: minmax(0, 1fr) auto;
	}
	.nlc-calc .nlc-bars__track {
		grid-column: 1 / -1;
		grid-row: 2;
	}
}

/* Stacked bars */
.nlc-calc .nlc-stack {
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
}

.nlc-calc .nlc-stack__row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 0.35rem 0.75rem;
	align-items: center;
}

.nlc-calc .nlc-stack__track {
	grid-column: 1 / -1;
	height: 1.75rem;
}

.nlc-calc .nlc-stack__seg {
	height: 100%;
	background: currentColor;
	transition: width 0.35s ease;
}

.nlc-calc .nlc-stack__seg + .nlc-stack__seg {
	box-shadow: inset 2px 0 0 var(--nlc-surface);
}

/* Total sits on the label row, right-aligned, above the full-width track */
.nlc-calc .nlc-stack__total {
	grid-row: 1;
	grid-column: 2;
}

.nlc-calc .nlc-bars__row--negative .nlc-bars__fill {
	opacity: 0.55;
}

.nlc-calc .nlc-bars__row--negative .nlc-bars__value {
	color: var(--nlc-bad);
}

/* Series colours */
.nlc-calc .nlc-series--lithium { color: var(--nlc-accent); }
.nlc-calc .nlc-series--alt     { color: #475569; }
.nlc-calc .nlc-series--savings { color: var(--nlc-good); }
.nlc-calc .nlc-series--s1 { color: var(--nlc-s1); }
.nlc-calc .nlc-series--s2 { color: var(--nlc-s2); }
.nlc-calc .nlc-series--s3 { color: var(--nlc-s3); }
.nlc-calc .nlc-series--s4 { color: var(--nlc-s4); }
.nlc-calc .nlc-series--s5 { color: var(--nlc-s5); }

/* Cost-composition segments (lead acid vs lithium stacked chart) */
.nlc-calc .nlc-seg--initial     { color: var(--nlc-s1); }
.nlc-calc .nlc-seg--maintenance { color: var(--nlc-s2); }
.nlc-calc .nlc-seg--routine     { color: var(--nlc-s3); }
.nlc-calc .nlc-seg--wash        { color: var(--nlc-s4); }
.nlc-calc .nlc-seg--replacement { color: var(--nlc-s5); }

/* Legend text stays readable; only the swatch takes the series colour */
.nlc-calc .nlc-legend__item[class*="nlc-seg--"],
.nlc-calc .nlc-legend__item[class*="nlc-series--"] {
	color: var(--nlc-muted);
}
.nlc-calc .nlc-legend__item.nlc-series--lithium .nlc-legend__swatch { color: var(--nlc-accent); }
.nlc-calc .nlc-legend__item.nlc-series--alt .nlc-legend__swatch     { color: #475569; }
.nlc-calc .nlc-legend__item.nlc-series--savings .nlc-legend__swatch { color: var(--nlc-good); }
.nlc-calc .nlc-legend__item.nlc-series--s1 .nlc-legend__swatch { color: var(--nlc-s1); }
.nlc-calc .nlc-legend__item.nlc-series--s2 .nlc-legend__swatch { color: var(--nlc-s2); }
.nlc-calc .nlc-legend__item.nlc-series--s3 .nlc-legend__swatch { color: var(--nlc-s3); }
.nlc-calc .nlc-legend__item.nlc-series--s4 .nlc-legend__swatch { color: var(--nlc-s4); }
.nlc-calc .nlc-legend__item.nlc-series--s5 .nlc-legend__swatch { color: var(--nlc-s5); }
.nlc-calc .nlc-legend__item.nlc-seg--initial .nlc-legend__swatch     { color: var(--nlc-s1); }
.nlc-calc .nlc-legend__item.nlc-seg--maintenance .nlc-legend__swatch { color: var(--nlc-s2); }
.nlc-calc .nlc-legend__item.nlc-seg--routine .nlc-legend__swatch     { color: var(--nlc-s3); }
.nlc-calc .nlc-legend__item.nlc-seg--wash .nlc-legend__swatch        { color: var(--nlc-s4); }
.nlc-calc .nlc-legend__item.nlc-seg--replacement .nlc-legend__swatch { color: var(--nlc-s5); }

/* ==========================================================================
   11. Toast, noscript, utilities
   ========================================================================== */

.nlc-calc .nlc-toast {
	position: fixed;
	left: 50%;
	bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
	z-index: 99999;
	max-width: min(28rem, calc(100vw - 2rem));
	padding: 0.7rem 1.1rem;
	background: #0f172a;
	border-radius: var(--nlc-radius-sm);
	box-shadow: var(--nlc-shadow-lg);
	color: #ffffff;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.4;
	text-align: center;
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	transform: translate(-50%, 0.75rem);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}

.nlc-calc .nlc-toast.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, 0);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s;
}

.nlc-calc .nlc-noscript {
	margin-top: 1rem;
	padding: 0.85rem 1rem;
	border: 1px solid var(--nlc-warn);
	border-left-width: 4px;
	border-radius: var(--nlc-radius-sm);
	background: var(--nlc-warn-soft);
	color: var(--nlc-text);
	font-weight: 600;
}

.nlc-calc .nlc-sr-only,
.nlc-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.nlc-calc a:focus-visible {
	outline: 2px solid var(--nlc-accent);
	outline-offset: 2px;
}

/* Narrow screens (down to 320px) */
@media (max-width: 400px) {
	.nlc-calc {
		padding: 0.875rem;
	}
	.nlc-calc .nlc-calc__inputs,
	.nlc-calc .nlc-panel {
		padding: 0.875rem;
	}
	.nlc-calc .nlc-compare th,
	.nlc-calc .nlc-compare td {
		padding: 0.5rem 0.4rem;
		font-size: 0.875rem;
	}
	.nlc-calc .nlc-cta {
		width: 100%;
	}
}

/* ==========================================================================
   12. Dark variant (opt-in: .nlc-calc.nlc-theme-dark)
   ========================================================================== */

.nlc-calc.nlc-theme-dark {
	--nlc-accent-contrast: #ffffff;
	--nlc-text: #e5e9f0;
	--nlc-muted: #9aa5b5;
	--nlc-bg: #0b1220;
	--nlc-surface: #131c2c;
	--nlc-surface-alt: #1a2436;
	--nlc-border: #263247;
	--nlc-border-strong: #364560;
	--nlc-good: #22c55e;
	--nlc-warn: #f59e0b;
	--nlc-bad: #f87171;
	--nlc-accent-soft: rgba(255, 68, 0, 0.18);
	--nlc-good-soft: rgba(34, 197, 94, 0.12);
	--nlc-warn-soft: rgba(245, 158, 11, 0.12);
	--nlc-bad-soft: rgba(248, 113, 113, 0.12);
	--nlc-s2: #94a3b8;
	--nlc-s3: #e0a43a;
	--nlc-s4: #2dd4bf;
	--nlc-s5: #a78bfa;
	--nlc-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
	--nlc-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
}

@supports (color: color-mix(in srgb, red 50%, white)) {
	.nlc-calc.nlc-theme-dark {
		--nlc-accent-soft: color-mix(in srgb, var(--nlc-accent) 20%, var(--nlc-surface));
		--nlc-good-soft: color-mix(in srgb, var(--nlc-good) 14%, var(--nlc-surface));
		--nlc-warn-soft: color-mix(in srgb, var(--nlc-warn) 14%, var(--nlc-surface));
		--nlc-bad-soft: color-mix(in srgb, var(--nlc-bad) 14%, var(--nlc-surface));
	}
}

.nlc-calc.nlc-theme-dark .nlc-series--alt,
.nlc-calc.nlc-theme-dark .nlc-legend__item.nlc-series--alt .nlc-legend__swatch {
	color: #94a3b8;
}

.nlc-calc.nlc-theme-dark .nlc-field__input {
	color-scheme: dark;
}

/* ==========================================================================
   13. Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.nlc-calc *,
	.nlc-calc *::before,
	.nlc-calc *::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
	}
	.nlc-calc .nlc-btn:active {
		transform: none;
	}
}

/* ==========================================================================
   14. Print
   ========================================================================== */

@media print {
	html.nlc-print-mode body * {
		visibility: hidden !important;
	}

	html.nlc-print-mode .nlc-printing,
	html.nlc-print-mode .nlc-printing * {
		visibility: visible !important;
	}

	html.nlc-print-mode .nlc-printing {
		position: absolute !important;
		left: 0 !important;
		top: 0 !important;
		width: 100% !important;
		margin: 0 !important;
	}

	.nlc-calc {
		border: 0 !important;
		padding: 0 !important;
		background: #ffffff !important;
		color: #000000 !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	.nlc-calc .nlc-actions,
	.nlc-calc .nlc-cta,
	.nlc-calc .nlc-toast,
	.nlc-calc .nlc-chart__tooltip,
	.nlc-calc .nlc-noscript,
	html.nlc-print-mode .nlc-printing .nlc-actions,
	html.nlc-print-mode .nlc-printing .nlc-cta,
	html.nlc-print-mode .nlc-printing .nlc-toast {
		display: none !important;
	}

	.nlc-calc .nlc-calc__body {
		display: block !important;
	}

	.nlc-calc .nlc-calc__inputs {
		position: static !important;
		max-height: none !important;
		overflow: visible !important;
		margin-bottom: 1rem;
		box-shadow: none !important;
	}

	.nlc-calc .nlc-calc__results {
		display: block !important;
	}

	.nlc-calc .nlc-panel,
	.nlc-calc .nlc-kpi,
	.nlc-calc .nlc-callout,
	.nlc-calc .nlc-group,
	.nlc-calc .nlc-chart,
	.nlc-calc .nlc-compare tr,
	.nlc-calc .nlc-table tr {
		break-inside: avoid;
		page-break-inside: avoid;
	}

	.nlc-calc .nlc-panel,
	.nlc-calc .nlc-kpis {
		margin-bottom: 1rem;
		box-shadow: none !important;
	}

	.nlc-calc .nlc-kpi {
		box-shadow: none !important;
	}

	.nlc-calc .nlc-table-wrap {
		overflow: visible !important;
	}

	.nlc-calc .nlc-table {
		min-width: 0 !important;
	}

	.nlc-calc .nlc-table thead th {
		position: static !important;
	}

	.nlc-calc .nlc-field__control {
		box-shadow: none !important;
	}
}
