/* Self-contained calculator styles. Scoped so a host theme does not set the look. */

.esr-root {
	--esr-bg: #f3f5f8;
	--esr-surface: #ffffff;
	--esr-text: #1b2430;
	--esr-muted: #3d4c5f;
	--esr-line: #d5dbe3;
	--esr-line-strong: #8b97a6;
	--esr-blue: #1e4d7b;
	--esr-blue-dark: #163a5e;
	--esr-focus: #0b3f78;
	--esr-danger: #8c1d1d;
	--esr-danger-bg: #fdecec;
	--esr-warn: #5c3d00;
	--esr-warn-bg: #fff4cc;
	--esr-ok: #0f5132;
	--esr-ok-bg: #e7f6ee;
	--esr-space: 8px;
	box-sizing: border-box;
	max-width: 760px;
	margin: 0 auto;
	padding: 16px;
	background: var(--esr-bg);
	color: var(--esr-text);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
	font-size: 16px;
	line-height: 1.5;
	overflow-wrap: break-word;
}

.esr-root *,
.esr-root *::before,
.esr-root *::after {
	box-sizing: border-box;
}

.esr-root[hidden],
.esr-root [hidden] {
	display: none !important;
}

.esr-root h2,
.esr-root h3,
.esr-root p,
.esr-root ul,
.esr-root ol,
.esr-root li,
.esr-root fieldset,
.esr-root legend {
	margin: 0;
	padding: 0;
	font: inherit;
	color: inherit;
}

.esr-root h2 {
	font-size: 1.5rem;
	line-height: 1.3;
	font-weight: 700;
}

.esr-root h3 {
	font-size: 1.125rem;
	line-height: 1.35;
	font-weight: 700;
}

.esr-root :focus {
	outline: none;
}

.esr-root :focus-visible {
	outline: 3px solid var(--esr-focus);
	outline-offset: 2px;
}

.esr-tool {
	background: var(--esr-surface);
	border: 1px solid var(--esr-line);
	border-radius: 12px;
	padding: 16px;
}

.esr-progress {
	font-weight: 700;
	margin-bottom: 8px;
}

.esr-step-list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	list-style: none;
	margin: 0 0 24px;
	padding: 0;
	color: var(--esr-muted);
}

.esr-step-list [aria-current="step"] {
	color: var(--esr-text);
	font-weight: 700;
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
}

.esr-root fieldset {
	border: 0;
	min-inline-size: 0;
}

.esr-root legend {
	font-weight: 700;
	font-size: 1.25rem;
	line-height: 1.3;
	margin-bottom: 16px;
	padding: 0;
}

.esr-field fieldset,
.esr-field.esr-field legend,
fieldset.esr-field > legend {
	font-size: 1rem;
	font-weight: 650;
	margin-bottom: 8px;
}

.esr-field {
	margin: 0 0 24px;
}

.esr-label {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin-bottom: 8px;
}

.esr-label label {
	flex: 1 1 auto;
	font-weight: 650;
}

.esr-root input[type="text"],
.esr-root select {
	display: block;
	width: 100%;
	min-height: 44px;
	margin: 0;
	padding: 8px 16px;
	border: 1px solid var(--esr-line-strong);
	border-radius: 8px;
	background: var(--esr-surface);
	color: var(--esr-text);
	font: inherit;
	line-height: 1.4;
	appearance: auto;
}

.esr-root input::placeholder {
	color: var(--esr-muted);
	opacity: 1;
}

.esr-choice {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 8px 0;
}

.esr-choice input {
	width: 20px;
	height: 20px;
	margin: 2px 0 0;
	flex: 0 0 auto;
	accent-color: var(--esr-blue);
}

.esr-choice label {
	flex: 1 1 auto;
	font-weight: 450;
}

.esr-msg {
	margin: 8px 0 0;
	font-size: 0.9375rem;
}

.esr-msg--error {
	color: var(--esr-danger);
}

.esr-msg--warn {
	color: var(--esr-warn);
	background: var(--esr-warn-bg);
	padding: 8px 16px;
	border-radius: 8px;
}

.esr-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 8px;
}

.esr-actions .esr-btn,
#esr-download {
	width: 100%;
}

.esr-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 8px 16px;
	border-radius: 8px;
	border: 1px solid var(--esr-blue);
	font: inherit;
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
	text-decoration: none;
}

.esr-btn--primary {
	background: var(--esr-blue);
	color: #ffffff;
}

.esr-btn--primary:hover {
	background: var(--esr-blue-dark);
	border-color: var(--esr-blue-dark);
}

.esr-btn--ghost {
	background: var(--esr-surface);
	color: var(--esr-blue);
}

.esr-btn--ghost:hover {
	background: #e7eef6;
}

.esr-results {
	margin-top: 32px;
	padding-top: 24px;
	border-top: 1px solid var(--esr-line);
}

.esr-results > h2 {
	margin-bottom: 16px;
	scroll-margin-top: 16px;
}

.esr-root legend {
	scroll-margin-top: 16px;
}

.esr-prompt {
	margin: 0;
}

.esr-headline {
	margin: 0 0 8px;
}

.esr-verdict {
	margin: 0 0 16px;
}

.esr-net--pos {
	color: var(--esr-ok);
}

.esr-net--neg {
	color: var(--esr-danger);
}

.esr-panel {
	margin-top: 24px;
}

.esr-panel h3 {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}

.esr-panel p {
	margin: 0 0 8px;
}

.esr-panel ul {
	margin: 0;
	padding-left: 24px;
}

.esr-panel li {
	margin: 0 0 8px;
}

.esr-table-scroll {
	overflow-x: auto;
	max-width: 100%;
	margin-top: 8px;
}

.esr-note,
.esr-scroll-hint {
	margin: 0 0 8px;
	color: var(--esr-muted);
}

.esr-sens {
	container-type: inline-size;
}

.esr-scroll-hint {
	display: none;
	font-size: 0.875rem;
}

@container (max-width: 35.99rem) {
	.esr-scroll-hint {
		display: block;
	}
}

.esr-results-wide {
	margin-top: 24px;
	padding-top: 24px;
	border-top: 1px solid var(--esr-line);
}

.esr-root table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9375rem;
	background: var(--esr-surface);
}

.esr-root caption {
	caption-side: top;
	text-align: left;
	font-weight: 700;
	padding: 0 0 8px;
	color: var(--esr-text);
}

.esr-root th,
.esr-root td {
	padding: 8px 16px;
	border-bottom: 1px solid var(--esr-line);
	vertical-align: top;
	text-align: left;
	overflow-wrap: normal;
	word-break: normal;
	white-space: nowrap;
}

.esr-root td {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.esr-table-scroll--summary table {
	width: 100%;
	min-width: 0;
}

.esr-table-scroll--summary th[scope="row"] {
	white-space: normal;
	width: 62%;
}

.esr-table-scroll--summary td {
	width: 38%;
}

.esr-table-scroll:not(.esr-table-scroll--summary) th {
	white-space: normal;
}

.esr-table-scroll--sensitivity table {
	min-width: 36rem;
}

.esr-sens-current th {
	box-shadow: inset 4px 0 0 var(--esr-blue);
}

.esr-root tfoot th,
.esr-root tfoot td {
	font-weight: 700;
	border-top: 2px solid var(--esr-text);
}

.esr-sens-current {
	background: #e7eef6;
	font-weight: 700;
}

.esr-disclaimer {
	margin-top: 24px;
	color: var(--esr-muted);
	font-size: 0.9375rem;
}

#esr-download {
	margin-top: 16px;
}

.esr-tip {
	position: relative;
	display: inline-block;
	flex: 0 0 auto;
}

.esr-tip__btn {
	width: 32px;
	height: 32px;
	min-height: 32px;
	padding: 0;
	border-radius: 50%;
	border: 1px solid var(--esr-blue);
	background: var(--esr-surface);
	color: var(--esr-blue);
	font: inherit;
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
}

.esr-tip__panel {
	display: none;
	position: absolute;
	z-index: 5;
	top: calc(100% + 8px);
	right: 0;
	width: min(20rem, calc(100vw - 48px));
	padding: 16px;
	background: var(--esr-text);
	color: #ffffff;
	border-radius: 8px;
	font-size: 0.875rem;
	font-weight: 400;
	line-height: 1.5;
	text-align: left;
	white-space: normal;
}

.esr-tip:hover .esr-tip__panel,
.esr-tip:focus-within .esr-tip__panel,
.esr-tip.is-open .esr-tip__panel {
	display: block;
}

.esr-tip.is-dismissed .esr-tip__panel,
.esr-tip.is-dismissed:hover .esr-tip__panel,
.esr-tip.is-dismissed:focus-within .esr-tip__panel {
	display: none;
}

.esr-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.esr-editorial {
	margin-top: 48px;
	max-width: 72ch;
}

.esr-editorial h2 {
	margin: 48px 0 16px;
}

.esr-editorial h2:first-child {
	margin-top: 0;
}

.esr-editorial h3 {
	margin: 24px 0 8px;
}

.esr-editorial p {
	margin: 0 0 16px;
}

.esr-editorial a {
	color: var(--esr-blue);
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	font-weight: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
	display: inline;
}

.esr-editorial a:hover {
	color: var(--esr-blue-dark);
}

@media (min-width: 640px) {
	.esr-root {
		padding: 32px 24px;
	}

	.esr-tool {
		padding: 32px;
	}

	.esr-actions {
		flex-direction: row;
		justify-content: flex-start;
	}

	.esr-actions .esr-btn,
	#esr-download {
		width: auto;
	}

	.esr-btn {
		min-width: 128px;
	}
}

@media (min-width: 960px) {
	.esr-root {
		max-width: 1120px;
	}

	.esr-layout {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		gap: 32px;
		align-items: start;
	}

	.esr-results {
		margin-top: 0;
		padding-top: 0;
		border-top: 0;
		padding-left: 32px;
		border-left: 1px solid var(--esr-line);
	}
}

@media print {
	.esr-root {
		background: #ffffff;
		max-width: none;
	}

	.esr-step {
		display: block !important;
	}

	.esr-actions,
	.esr-tip__btn {
		display: none !important;
	}
}
