/**
 * TaxAgent Subsidie Calculator
 *
 * Everything is scoped under .tsc and driven by custom properties, so a theme
 * can restyle it by overriding the variables instead of fighting selectors.
 */

.tsc {
	--tsc-paper: #FBFBF9;
	--tsc-ink: #16202B;
	--tsc-ink-soft: #5A6672;
	--tsc-rule: #DFE3E6;
	--tsc-rule-strong: #C4CBD1;
	--tsc-accent: #1F6B4A;
	--tsc-accent-soft: #EDF4F0;
	--tsc-warn: #8A5200;
	--tsc-warn-soft: #FDF4E5;
	--tsc-radius: 3px;

	box-sizing: border-box;
	max-width: 74rem;
	margin: 0 auto;
	padding: 1.5rem 0 0;
	color: var(--tsc-ink);
	font-size: 1rem;
	line-height: 1.5;
	font-variant-numeric: tabular-nums;
}

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

/* ---------- Head ---------- */

.tsc-title {
	margin: 0 0 .4rem;
	font-size: clamp( 1.5rem, 1.1rem + 1.6vw, 2.1rem );
	line-height: 1.15;
	letter-spacing: -0.015em;
}

.tsc-intro {
	margin: 0 0 .5rem;
	max-width: 44rem;
	color: var(--tsc-ink-soft);
}

.tsc-stamp {
	margin: 0 0 1.75rem;
	padding-bottom: 1.25rem;
	border-bottom: 2px solid var(--tsc-ink);
	font-size: .8125rem;
	color: var(--tsc-ink-soft);
}

/* ---------- Layout ---------- */

/*
 * No align-items here on purpose. The panel column has to stretch to the full
 * row height, otherwise the sticky inner element has nowhere to travel.
 */
.tsc-grid {
	display: grid;
	grid-template-columns: minmax( 0, 1fr ) 19rem;
	gap: 2.5rem;
}

.tsc-step {
	margin: 0 0 2.25rem;
}

.tsc-step-title {
	margin: 0 0 .25rem;
	font-size: 1.0625rem;
	line-height: 1.3;
}

.tsc-step-hint,
.tsc-general-lead {
	margin: 0 0 1rem;
	max-width: 42rem;
	font-size: .875rem;
	color: var(--tsc-ink-soft);
}

/* ---------- Checkboxes ---------- */

.tsc-checks {
	display: grid;
	gap: .6rem;
}

.tsc-check {
	display: grid;
	grid-template-columns: 1.25rem minmax( 0, 1fr );
	gap: .6rem;
	align-items: start;
}

.tsc-check input[type="checkbox"],
.tsc-row-check,
.tsc-row-extra input[type="checkbox"] {
	width: 1.05rem;
	height: 1.05rem;
	margin: .2rem 0 0;
	accent-color: var(--tsc-accent);
	cursor: pointer;
}

.tsc-check label {
	cursor: pointer;
	line-height: 1.35;
}

.tsc-check-label {
	display: block;
	font-size: .9375rem;
}

.tsc-hint {
	display: block;
	margin-top: .1rem;
	font-size: .8125rem;
	line-height: 1.4;
	color: var(--tsc-ink-soft);
}

/* ---------- Measure rows ---------- */

.tsc-rows {
	border-top: 1px solid var(--tsc-rule-strong);
}

.tsc-row {
	display: grid;
	grid-template-columns: 1.25rem minmax( 0, 1fr ) 8rem 7rem;
	grid-template-areas:
		"check name field sum"
		".     extra extra extra"
		".     note  note  note";
	align-items: center;
	gap: .35rem .7rem;
	padding: .65rem 0;
	border-bottom: 1px solid var(--tsc-rule);
}

.tsc-row-check {
	grid-area: check;
}

.tsc-row-name {
	grid-area: name;
	cursor: pointer;
	line-height: 1.3;
}

.tsc-name {
	display: block;
	font-size: .9375rem;
	color: var(--tsc-ink-soft);
	transition: color .12s ease;
}

.tsc-row.is-on .tsc-name {
	color: var(--tsc-ink);
	font-weight: 600;
}

.tsc-term {
	display: block;
	font-size: .75rem;
	color: var(--tsc-ink-soft);
	opacity: .8;
}

/* Inputs stay out of the way until the measure is actually selected. */
.tsc-row-field {
	grid-area: field;
	display: none;
	align-items: center;
	gap: .35rem;
}

.tsc-row.is-on .tsc-row-field {
	display: flex;
}

.tsc-row-extra {
	grid-area: extra;
	display: none;
	align-items: flex-start;
	gap: .5rem;
	padding-top: .25rem;
	font-size: .8125rem;
}

.tsc-row.is-on .tsc-row-extra {
	display: flex;
}

.tsc-row-extra label {
	cursor: pointer;
	color: var(--tsc-ink-soft);
}

.tsc-row-extra .tsc-hint {
	display: inline;
	margin-left: .3rem;
}

.tsc-row-sum {
	grid-area: sum;
	text-align: right;
	font-size: .9375rem;
	font-weight: 600;
	color: var(--tsc-ink-soft);
	white-space: nowrap;
}

.tsc-row-sum.is-live {
	color: var(--tsc-accent);
}

.tsc-dash {
	color: var(--tsc-rule-strong);
	font-weight: 400;
}

.tsc-row-note {
	grid-area: note;
	margin: 0;
	font-size: .8125rem;
	color: var(--tsc-warn);
}

/* ---------- Fields ---------- */

.tsc-num,
.tsc-select {
	width: 100%;
	min-width: 0;
	padding: .4rem .5rem;
	border: 1px solid var(--tsc-rule-strong);
	border-radius: var(--tsc-radius);
	background: #fff;
	color: inherit;
	font: inherit;
	font-size: .9375rem;
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.tsc-select {
	text-align: left;
	font-size: .8125rem;
}

.tsc-num:disabled,
.tsc-select:disabled {
	background: #F3F4F3;
	color: #A3ABB2;
	cursor: not-allowed;
}

.tsc-num::-webkit-outer-spin-button,
.tsc-num::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.tsc-num[type="number"] {
	-moz-appearance: textfield;
	appearance: textfield;
}

.tsc-unit {
	font-size: .8125rem;
	color: var(--tsc-ink-soft);
	white-space: nowrap;
}

.tsc-row-field--wide {
	grid-column: field / sum;
}

.tsc :is( .tsc-num, .tsc-select, input[type="checkbox"], button, a, summary ):focus-visible {
	outline: 2px solid var(--tsc-accent);
	outline-offset: 2px;
}

/* ---------- Money block ---------- */

.tsc-money {
	display: grid;
	gap: 1rem;
	max-width: 26rem;
}

.tsc-field label {
	display: block;
	margin-bottom: .25rem;
	font-size: .875rem;
	font-weight: 600;
}

.tsc-num--wide {
	max-width: 12rem;
	text-align: left;
}

.tsc-field .tsc-hint {
	margin-top: .25rem;
}

/* ---------- Result panel ---------- */

.tsc-panel-inner {
	position: sticky;
	top: 1.5rem;
	padding: 1.25rem;
	background: var(--tsc-paper);
	border: 1px solid var(--tsc-rule-strong);
	border-top: 3px solid var(--tsc-accent);
	border-radius: var(--tsc-radius);
}

.tsc-panel-label {
	margin: 0;
	font-size: .8125rem;
	color: var(--tsc-ink-soft);
}

.tsc-total {
	margin: .1rem 0 0;
	font-size: clamp( 2rem, 1.4rem + 2vw, 2.75rem );
	line-height: 1.05;
	letter-spacing: -0.03em;
	font-weight: 700;
	color: var(--tsc-accent);
}

.tsc-total.is-bumped {
	animation: tsc-bump .18s ease-out;
}

@keyframes tsc-bump {
	from { transform: translateY( 2px ); opacity: .55; }
	to   { transform: none; opacity: 1; }
}

.tsc-share {
	margin: .2rem 0 0;
	font-size: .8125rem;
	color: var(--tsc-ink-soft);
}

.tsc-double {
	margin: .9rem 0 0;
	padding: .5rem .6rem;
	border-left: 3px solid var(--tsc-rule-strong);
	background: #fff;
	font-size: .8125rem;
	line-height: 1.4;
	color: var(--tsc-ink-soft);
}

.tsc-double.is-on {
	border-left-color: var(--tsc-accent);
	background: var(--tsc-accent-soft);
	color: var(--tsc-ink);
	font-weight: 600;
}

.tsc-breakdown {
	margin: 1rem 0 0;
	padding: 0;
	list-style: none;
	border-top: 1px solid var(--tsc-rule);
}

.tsc-breakdown li {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: .6rem;
	padding: .5rem 0;
	border-bottom: 1px solid var(--tsc-rule);
	font-size: .875rem;
}

.tsc-breakdown-empty {
	display: block !important;
	color: var(--tsc-ink-soft);
	font-size: .8125rem !important;
	border-bottom: 0 !important;
}

.tsc-bd-name em {
	display: block;
	font-style: normal;
	font-size: .75rem;
	color: var(--tsc-ink-soft);
}

.tsc-bd-sum {
	font-weight: 600;
	white-space: nowrap;
}

.tsc-warnings {
	margin-top: 1rem;
	padding: .75rem .8rem;
	background: var(--tsc-warn-soft);
	border-left: 3px solid var(--tsc-warn);
	font-size: .8125rem;
	line-height: 1.45;
}

.tsc-warnings-title {
	margin: 0 0 .3rem;
	font-weight: 700;
	color: var(--tsc-warn);
}

.tsc-warnings ul {
	margin: 0;
	padding-left: 1rem;
	color: var(--tsc-ink);
}

.tsc-warnings li + li {
	margin-top: .35rem;
}

/* ---------- Buttons ---------- */

.tsc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem;
	margin-top: 1.1rem;
}

.tsc-btn {
	display: inline-block;
	padding: .5rem .85rem;
	border: 1px solid var(--tsc-rule-strong);
	border-radius: var(--tsc-radius);
	background: #fff;
	color: var(--tsc-ink);
	font: inherit;
	font-size: .8125rem;
	line-height: 1.3;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
}

.tsc-btn:hover {
	border-color: var(--tsc-ink);
}

.tsc-btn--solid {
	display: block;
	margin-top: .6rem;
	padding: .65rem .9rem;
	background: var(--tsc-accent);
	border-color: var(--tsc-accent);
	color: #fff;
	font-size: .9375rem;
	font-weight: 600;
}

.tsc-btn--solid:hover {
	filter: brightness( .92 );
	border-color: var(--tsc-accent);
}

.tsc-btn--quiet {
	border-color: transparent;
	color: var(--tsc-ink-soft);
}

.tsc-btn[disabled] {
	opacity: .55;
	cursor: not-allowed;
}

/* ---------- General return ---------- */

.tsc-general,
.tsc-conditions,
.tsc-article {
	margin-top: 3rem;
	padding-top: 1.75rem;
	border-top: 2px solid var(--tsc-ink);
}

.tsc-general-title {
	margin: 0 0 .3rem;
	font-size: 1.25rem;
	line-height: 1.25;
}

/*
 * Ruled columns rather than boxes: a half-empty last row then reads as blank
 * paper instead of a grey hole.
 */
.tsc-cards {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 15rem, 1fr ) );
	gap: 1.75rem 2rem;
}

.tsc-card {
	padding-top: .9rem;
	border-top: 2px solid var(--tsc-rule-strong);
}

.tsc-card--tax {
	border-top-color: var(--tsc-accent);
}

.tsc-card h4 {
	margin: 0 0 .4rem;
	font-size: .9375rem;
	line-height: 1.3;
}

.tsc-card p {
	margin: 0 0 .6rem;
	font-size: .875rem;
	line-height: 1.5;
	color: var(--tsc-ink-soft);
}

.tsc-card a {
	font-size: .8125rem;
	color: var(--tsc-accent);
}

.tsc-figures {
	display: grid;
	gap: .5rem;
	margin: 0 0 .7rem;
}

.tsc-figures dt {
	font-size: .75rem;
	color: var(--tsc-ink-soft);
}

.tsc-figures dd {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.2;
	color: var(--tsc-accent);
}

/* ---------- Conditions ---------- */

.tsc-cond {
	border-bottom: 1px solid var(--tsc-rule);
}

.tsc-cond summary {
	padding: .7rem 1.5rem .7rem 0;
	position: relative;
	cursor: pointer;
	font-size: .9375rem;
	font-weight: 600;
	list-style: none;
}

.tsc-cond summary::-webkit-details-marker {
	display: none;
}

.tsc-cond summary::after {
	content: "+";
	position: absolute;
	right: .2rem;
	top: .55rem;
	font-size: 1.1rem;
	font-weight: 400;
	color: var(--tsc-ink-soft);
}

.tsc-cond[open] summary::after {
	content: "\2013";
}

.tsc-cond p {
	margin: 0 0 1rem;
	max-width: 46rem;
	font-size: .875rem;
	line-height: 1.6;
	color: var(--tsc-ink-soft);
}

/* ---------- Article under the calculator ---------- */

/*
 * Narrower measure than the calculator above it: this is prose, and prose
 * wants a line length you can actually read.
 */
.tsc-article h2 {
	margin: 0 0 .5rem;
	font-size: 1.375rem;
	line-height: 1.25;
	letter-spacing: -0.01em;
}

.tsc-article h3 {
	margin: 2rem 0 .5rem;
	font-size: 1.0625rem;
	line-height: 1.3;
}

.tsc-article p {
	margin: 0 0 1rem;
	max-width: 40rem;
	font-size: .9375rem;
	line-height: 1.65;
	color: var(--tsc-ink-soft);
}

.tsc-article-lead {
	font-size: 1rem !important;
	color: var(--tsc-ink) !important;
}

.tsc-article .tsc-cond summary {
	font-weight: 500;
}

.tsc-article .tsc-cond p {
	max-width: 40rem;
}

.tsc-article-note {
	margin-top: 1.75rem !important;
	padding-top: .9rem;
	border-top: 1px solid var(--tsc-rule);
	font-size: .8125rem !important;
	line-height: 1.55 !important;
}

/* ---------- Rate tables ---------- */

.tsc-table-wrap {
	max-width: 44rem;
	margin: 0 0 1.5rem;
	overflow-x: auto;
}

.tsc-table {
	width: 100%;
	border-collapse: collapse;
	font-size: .875rem;
}

.tsc-table th,
.tsc-table td {
	padding: .55rem .6rem;
	border-bottom: 1px solid var(--tsc-rule);
	text-align: left;
	vertical-align: baseline;
}

.tsc-table thead th {
	border-bottom: 2px solid var(--tsc-ink);
	font-size: .75rem;
	font-weight: 600;
	white-space: nowrap;
}

.tsc-table tbody th {
	font-weight: 600;
	padding-left: 0;
}

.tsc-table tbody th span {
	display: block;
	font-weight: 400;
	font-size: .75rem;
	color: var(--tsc-ink-soft);
}

.tsc-table .tsc-num-col {
	text-align: right;
	white-space: nowrap;
}

.tsc-table tbody td {
	color: var(--tsc-ink);
	font-weight: 600;
}

/* ---------- Footer ---------- */

.tsc-disclaimer {
	margin: 2rem 0 0;
	padding-top: 1rem;
	border-top: 1px solid var(--tsc-rule);
	font-size: .75rem;
	line-height: 1.55;
	color: var(--tsc-ink-soft);
}

.tsc-disclaimer a {
	color: var(--tsc-ink-soft);
}

/* ---------- Mobile total bar ---------- */

.tsc-minibar {
	display: none;
}

/* ---------- Responsive ---------- */

@media ( max-width: 60rem ) {

	.tsc-grid {
		grid-template-columns: minmax( 0, 1fr );
		gap: 2rem;
	}

	.tsc-panel-inner {
		position: static;
	}

	.tsc-minibar {
		position: sticky;
		top: 0;
		z-index: 20;
		display: flex;
		align-items: baseline;
		justify-content: space-between;
		gap: .75rem;
		margin-bottom: 1.5rem;
		padding: .6rem .8rem;
		background: var(--tsc-paper);
		border: 1px solid var(--tsc-rule-strong);
		border-top: 3px solid var(--tsc-accent);
		border-radius: var(--tsc-radius);
		box-shadow: 0 2px 10px rgba( 22, 32, 43, .07 );
	}

	.tsc-minibar span:first-child {
		font-size: .8125rem;
		color: var(--tsc-ink-soft);
	}

	.tsc-minibar .tsc-total {
		margin: 0;
		font-size: 1.5rem;
	}
}

@media ( max-width: 34rem ) {

	.tsc-row {
		grid-template-columns: 1.25rem minmax( 0, 1fr ) auto;
		grid-template-areas:
			"check name  sum"
			".     field field"
			".     extra extra"
			".     note  note";
		gap: .4rem .7rem;
		padding: .8rem 0;
	}

	.tsc-row-field {
		max-width: 11rem;
	}

	.tsc-row-field--wide {
		grid-column: auto;
		max-width: none;
	}

	.tsc-cards {
		grid-template-columns: minmax( 0, 1fr );
	}
}

@media ( prefers-reduced-motion: reduce ) {

	.tsc-total.is-bumped {
		animation: none;
	}

	.tsc * {
		transition: none !important;
	}
}

/* ---------- Print ---------- */

@media print {

	body > *:not( :has( .tsc ) ) {
		display: none;
	}

	.tsc {
		max-width: none;
		padding: 0;
		font-size: 11pt;
	}

	.tsc-grid {
		display: block;
	}

	.tsc-panel-inner {
		position: static;
		page-break-inside: avoid;
		margin-top: 1.5rem;
	}

	.tsc-actions,
	.tsc-minibar,
	.tsc-btn {
		display: none !important;
	}

	.tsc-row-check,
	.tsc-check input {
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	.tsc-cond {
		page-break-inside: avoid;
	}

	.tsc-cond p {
		display: block !important;
	}
}
