/* ========================================
   Impuestos de España — Custom CSS
   Overrides Hugolify/Bootstrap con prefijo t-
   ======================================== */

/* --- Design tokens como CSS custom properties --- */
:root {
	/* Paleta principal */
	--t-primary: #1e3a8a;
	--t-primary-light: #2563eb;
	--t-primary-dark: #1e2a5e;
	--t-accent: #ef4444;
	--t-accent-light: #fca5a5;
	--t-secondary: #f59e0b;
	--t-secondary-light: #fde68a;
	--t-bg: #f9fafb;
	--t-bg-alt: #f3f4f6;
	--t-text: #111827;
	--t-text-light: #6b7280;
	--t-white: #ffffff;

	/* Niveles de impuesto */
	--t-estatal: var(--t-primary);
	--t-autonomico: var(--t-secondary);
	--t-local: #10b981;

	/* Spacing */
	--t-space-xs: 0.25rem;
	--t-space-sm: 0.5rem;
	--t-space-md: 1rem;
	--t-space-lg: 1.5rem;
	--t-space-xl: 2rem;
	--t-space-2xl: 3rem;
	--t-space-3xl: 4rem;

	/* Tipografía */
	--t-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--t-font-mono: "JetBrains Mono", ui-monospace, monospace;

	/* Bordes */
	--t-radius-sm: 0.375rem;
	--t-radius-md: 0.5rem;
	--t-radius-lg: 0.75rem;
	--t-radius-xl: 1rem;

	/* Sombras */
	--t-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
	--t-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
	--t-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

	/* Transiciones */
	--t-transition-fast: 150ms ease;
	--t-transition-base: 250ms ease;
}

/* --- Base overrides --- */
body {
	background-color: var(--t-bg);
	color: var(--t-text);
	font-family: var(--t-font-sans);
}

/* --- Utility classes --- */
.t-container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 var(--t-space-md);
}

.t-section {
	padding: var(--t-space-2xl) 0;
}

.t-text-accent {
	color: var(--t-accent);
}

.t-text-primary {
	color: var(--t-primary);
}

.t-text-secondary {
	color: var(--t-secondary);
}

/* --- Badge de nivel --- */
.t-badge {
	display: inline-block;
	padding: var(--t-space-xs) var(--t-space-sm);
	border-radius: var(--t-radius-sm);
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.t-badge--estatal {
	background: var(--t-primary);
	color: var(--t-white);
}

.t-badge--autonomico {
	background: var(--t-secondary);
	color: var(--t-text);
}

.t-badge--local {
	background: var(--t-local);
	color: var(--t-white);
}

/* --- Hero --- */
.t-hero {
	padding: var(--t-space-2xl) 0 var(--t-space-lg);
	text-align: center;
}

.t-hero__title {
	font-size: clamp(1.75rem, 5vw, 2.5rem);
	font-weight: 800;
	color: var(--t-primary);
	margin: var(--t-space-sm) 0;
}

.t-hero__desc {
	font-size: 1.125rem;
	color: var(--t-text-light);
	max-width: 600px;
	margin: 0 auto;
}

.t-hero__subtitle {
	font-size: 1.125rem;
	color: var(--t-text-light);
}

/* --- Filtros --- */
.t-filters {
	margin-bottom: var(--t-space-xl);
}

.t-filters__search {
	margin-bottom: var(--t-space-md);
}

.t-filters__input {
	width: 100%;
	max-width: 480px;
	padding: var(--t-space-sm) var(--t-space-md);
	border: 2px solid var(--t-bg-alt);
	border-radius: var(--t-radius-lg);
	font-size: 1rem;
	font-family: var(--t-font-sans);
	background: var(--t-white);
	transition: border-color var(--t-transition-fast);
}

.t-filters__input:focus {
	outline: none;
	border-color: var(--t-primary-light);
}

.t-filters__chips {
	display: flex;
	flex-wrap: wrap;
	gap: var(--t-space-sm);
}

.t-chip {
	display: inline-flex;
	align-items: center;
	gap: var(--t-space-xs);
	padding: var(--t-space-xs) var(--t-space-md);
	border: 2px solid var(--t-bg-alt);
	border-radius: 999px;
	background: var(--t-white);
	font-size: 0.875rem;
	font-weight: 500;
	cursor: pointer;
	transition: all var(--t-transition-fast);
	font-family: var(--t-font-sans);
}

.t-chip:hover {
	border-color: var(--t-primary-light);
}

.t-chip.is-active {
	background: var(--t-primary);
	color: var(--t-white);
	border-color: var(--t-primary);
}

.t-chip__count {
	font-size: 0.75rem;
	opacity: 0.8;
}

/* --- Cards grid --- */
.t-cards {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--t-space-md);
}

@media (min-width: 640px) {
	.t-cards {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.t-cards {
		grid-template-columns: repeat(3, 1fr);
	}
}

.t-card {
	display: block;
	padding: var(--t-space-lg);
	background: var(--t-white);
	border-radius: var(--t-radius-lg);
	box-shadow: var(--t-shadow-sm);
	text-decoration: none;
	color: inherit;
	transition: all var(--t-transition-fast);
}

.t-card:hover {
	box-shadow: var(--t-shadow-md);
	transform: translateY(-2px);
}

.t-card__title {
	font-size: 1.125rem;
	font-weight: 700;
	margin: var(--t-space-sm) 0 var(--t-space-xs);
	color: var(--t-primary);
}

.t-card__desc {
	font-size: 0.875rem;
	color: var(--t-text-light);
	margin: 0;
	line-height: 1.5;
}

/* --- Empty state --- */
.t-empty {
	text-align: center;
	padding: var(--t-space-3xl);
	color: var(--t-text-light);
}

.t-empty.is-hidden,
.t-cards.is-hidden {
	display: none;
}

/* --- Tax detail page --- */
.t-tax-detail {
	padding: var(--t-space-xl) 0;
	max-width: 800px;
	margin: 0 auto;
}

.t-tax-detail__section {
	margin-bottom: var(--t-space-xl);
}

.t-tax-detail__section h2 {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--t-primary);
	margin-bottom: var(--t-space-sm);
}

.t-tax-detail__data {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: var(--t-space-sm) var(--t-space-md);
}

.t-tax-detail__data dt {
	font-weight: 600;
	color: var(--t-text-light);
	font-size: 0.875rem;
}

.t-tax-detail__data dd {
	margin: 0;
}

.t-tax-detail__link {
	color: var(--t-primary-light);
	text-decoration: underline;
}

.t-back-link {
	display: inline-block;
	margin-top: var(--t-space-xl);
	color: var(--t-primary-light);
	text-decoration: none;
}

.t-back-link:hover {
	text-decoration: underline;
}

/* --- Glossary --- */
.t-glossary {
	max-width: 700px;
	margin: 0 auto;
	padding: var(--t-space-xl) 0;
}

.t-glossary__intro {
	text-align: center;
	font-size: 1.125rem;
	color: var(--t-text-light);
	margin-bottom: var(--t-space-xl);
}

.t-glossary__list {
	display: flex;
	flex-direction: column;
	gap: var(--t-space-sm);
}

.t-glossary__item {
	background: var(--t-white);
	border-radius: var(--t-radius-md);
	box-shadow: var(--t-shadow-sm);
	overflow: hidden;
}

.t-glossary__term {
	margin: 0;
}

.t-glossary__toggle {
	display: flex;
	width: 100%;
	align-items: center;
	justify-content: space-between;
	padding: var(--t-space-md) var(--t-space-lg);
	background: none;
	border: none;
	cursor: pointer;
	text-align: left;
	font-family: var(--t-font-sans);
	font-size: 1rem;
}

.t-glossary__coloquial {
	font-weight: 600;
	color: var(--t-accent);
}

.t-glossary__arrow {
	transition: transform var(--t-transition-fast);
}

.t-glossary__def {
	max-height: 0;
	overflow: hidden;
	transition:
		max-height var(--t-transition-base),
		padding var(--t-transition-base);
	padding: 0 var(--t-space-lg);
	margin: 0;
}

.t-glossary__item.is-open .t-glossary__def {
	max-height: 100px;
	padding: 0 var(--t-space-lg) var(--t-space-md);
}

.t-glossary__item.is-open .t-glossary__arrow {
	transform: rotate(180deg);
}

.t-glossary__original {
	font-size: 0.9375rem;
	color: var(--t-text-light);
}

/* --- Home --- */
.t-home {
	padding: var(--t-space-xl) 0 var(--t-space-3xl);
}

/* Hero */
.t-home__hero {
	text-align: center;
	padding: var(--t-space-3xl) 0;
}

.t-home__counter {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--t-space-xs);
	margin-bottom: var(--t-space-lg);
}

.t-home__counter-number {
	font-size: 4rem;
	font-weight: 900;
	color: var(--t-accent);
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

@media (min-width: 768px) {
	.t-home__counter-number {
		font-size: 6rem;
	}
}

.t-home__counter-label {
	font-size: 1.125rem;
	color: var(--t-text-light);
	font-weight: 500;
}

.t-home__hook {
	font-size: clamp(1.25rem, 3vw, 1.5rem);
	color: var(--t-text);
	margin-bottom: var(--t-space-xl);
	line-height: 1.4;
}

.t-home__hook strong {
	color: var(--t-accent);
}

.t-home__cta {
	display: inline-block;
	padding: var(--t-space-md) var(--t-space-2xl);
	background: var(--t-accent);
	color: var(--t-white);
	font-size: 1.125rem;
	font-weight: 700;
	text-decoration: none;
	border-radius: var(--t-radius-lg);
	transition:
		background var(--t-transition-fast),
		transform var(--t-transition-fast),
		box-shadow var(--t-transition-fast);
}

.t-home__cta:hover {
	background: #b91c1c;
	transform: translateY(-2px) scale(1.05);
	box-shadow: var(--t-shadow-lg);
}

.t-home__cta:active {
	transform: translateY(0);
}

/* Section cards */
.t-home__sections {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--t-space-lg);
	margin-bottom: var(--t-space-3xl);
}

@media (min-width: 600px) {
	.t-home__sections {
		grid-template-columns: repeat(2, 1fr);
	}
}

.t-home__card {
	display: flex;
	flex-direction: column;
	padding: var(--t-space-xl);
	background: var(--t-white);
	border: 2px solid var(--t-bg-alt);
	border-radius: var(--t-radius-xl);
	text-decoration: none;
	color: var(--t-text);
	transition:
		border-color var(--t-transition-fast),
		box-shadow var(--t-transition-fast),
		transform var(--t-transition-fast);
}

.t-home__card:hover {
	border-color: var(--t-primary-light);
	box-shadow: var(--t-shadow-lg);
	transform: translateY(-3px);
}

.t-home__card--highlight {
	border-color: var(--t-accent);
	background: linear-gradient(135deg, #fef2f2, var(--t-white));
}

.t-home__card--highlight:hover {
	border-color: var(--t-accent);
}

.t-home__teaser {
	display: flex;
	flex-wrap: wrap;
	gap: var(--t-space-xs);
	margin-top: var(--t-space-md);
	margin-bottom: var(--t-space-md);
}

.t-home__teaser--calc {
	margin-top: auto;
}

.t-home__card-title {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--t-primary);
	margin-bottom: var(--t-space-xs);
}

.t-home__card-desc {
	font-size: 0.875rem;
	color: var(--t-text-light);
	line-height: 1.5;
	flex: 1;
}

.t-home__card-badge {
	display: inline-block;
	margin-top: var(--t-space-sm);
	margin-right: var(--t-space-xs);
	padding: 2px var(--t-space-sm);
	font-size: 0.6875rem;
	font-weight: 600;
	border-radius: var(--t-radius-sm);
	background: var(--t-bg-alt);
	color: var(--t-text-light);
}

/* Quick facts */
.t-home__facts {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--t-space-lg);
	padding: var(--t-space-xl) 0;
	margin-bottom: var(--t-space-2xl);
}

@media (min-width: 768px) {
	.t-home__facts {
		grid-template-columns: repeat(3, 1fr);
	}
}

.t-home__fact {
	display: flex;
	flex-direction: column;
	gap: var(--t-space-xs);
	background: var(--t-white);
	border-left: 6px solid var(--t-secondary);
	padding: var(--t-space-lg);
	border-radius: var(--t-radius-md);
	box-shadow: var(--t-shadow-md);
	position: relative;
	overflow: hidden;
}

.t-home__fact-icon {
	position: absolute;
	right: var(--t-space-md);
	top: var(--t-space-md);
	font-size: 2.5rem;
	opacity: 0.15;
	line-height: 1;
}

.t-home__fact-number {
	font-size: clamp(2.5rem, 5vw, 3.5rem);
	font-weight: 900;
	color: var(--t-accent);
	line-height: 1;
	margin-bottom: var(--t-space-xs);
}

.t-home__fact-text {
	font-size: 1rem;
	color: var(--t-text);
	font-weight: 500;
	line-height: 1.4;
}

/* About */
.t-home__about {
	text-align: center;
	font-size: 0.8125rem;
	color: var(--t-text-light);
	padding-top: var(--t-space-lg);
	border-top: 1px solid var(--t-bg-alt);
}

/* Hide theme hero on home */
.t-home ~ .t-hero,
.home-page .t-hero {
	display: none;
}

/* --- Map --- */
.t-map {
	position: relative;
	padding: var(--t-space-lg) 0 var(--t-space-2xl);
}

/* Summary bar */
.t-map__summary {
	display: flex;
	flex-wrap: wrap;
	gap: var(--t-space-lg);
	justify-content: center;
	padding: var(--t-space-md) var(--t-space-lg);
	background: var(--t-white);
	border: 1px solid #d1d5db;
	border-radius: var(--t-radius-lg);
	margin-bottom: var(--t-space-lg);
}

.t-map__summary-item {
	font-size: 0.875rem;
	color: var(--t-text-light);
}

.t-map__summary-item strong {
	color: var(--t-text);
	font-weight: 700;
}

/* Search */
.t-map__search {
	max-width: 320px;
	margin: 0 auto var(--t-space-lg);
}

.t-map__search-input {
	width: 100%;
	padding: var(--t-space-sm) var(--t-space-md);
	border: 2px solid var(--t-bg-alt);
	border-radius: var(--t-radius-lg);
	font-size: 0.875rem;
	font-family: var(--t-font-sans);
	background: var(--t-white);
}

.t-map__search-input:focus {
	outline: none;
	border-color: var(--t-primary-light);
}

/* Two-column layout */
.t-map__layout {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--t-space-xl);
}

@media (min-width: 900px) {
	.t-map__layout {
		grid-template-columns: 1fr 280px;
	}
}

/* Legend */
.t-map__legend {
	display: flex;
	flex-wrap: wrap;
	gap: var(--t-space-sm);
	justify-content: center;
	margin-bottom: var(--t-space-md);
	font-size: 0.75rem;
	color: var(--t-text-light);
}

.t-map__legend-item {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.t-map__legend-swatch {
	width: 0.75rem;
	height: 0.75rem;
	border-radius: 2px;
}

/* SVG container */
.t-map__container {
	max-width: 600px;
	margin: 0 auto;
}

.t-map__container svg {
	width: 100%;
	height: auto;
	display: block;
}

/* Tooltip */
.t-map__tooltip {
	position: fixed;
	z-index: 100;
	background: var(--t-white);
	border: 1px solid #d1d5db;
	border-radius: var(--t-radius-md);
	box-shadow: var(--t-shadow-lg);
	padding: var(--t-space-sm) var(--t-space-md);
	pointer-events: none;
	max-width: 240px;
}

.t-map__tooltip.is-hidden {
	display: none;
}

.t-map__tooltip-name {
	display: block;
	font-size: 0.875rem;
	font-weight: 700;
	color: #7f1d1d;
	margin-bottom: 2px;
}

.t-map__tooltip-count {
	display: block;
	font-size: 0.75rem;
	color: var(--t-text-light);
	margin-bottom: 4px;
}

.t-map__tooltip-list {
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 0.75rem;
	color: var(--t-text);
}

.t-map__tooltip-list li {
	padding: 1px 0;
	border-bottom: 1px solid var(--t-bg-alt);
}

.t-map__tooltip-list li:last-child {
	border-bottom: none;
}

/* Ranking */
.t-map__rank-col {
	background: var(--t-white);
	border: 1px solid #d1d5db;
	border-radius: var(--t-radius-lg);
	padding: var(--t-space-md);
	max-height: 520px;
	overflow-y: auto;
}

.t-map__rank-title {
	font-size: 0.875rem;
	font-weight: 700;
	color: var(--t-text-light);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-bottom: var(--t-space-sm);
}

.t-map__rank-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.t-map__rank-item {
	display: grid;
	grid-template-columns: 28px 1fr;
	gap: var(--t-space-xs);
	align-items: center;
	padding: 3px 0;
	cursor: pointer;
	border-bottom: 1px solid var(--t-bg-alt);
	font-size: 0.8125rem;
}

.t-map__rank-item:last-child {
	border-bottom: none;
}

.t-map__rank-badge {
	display: inline-block;
	width: 24px;
	height: 24px;
	line-height: 24px;
	text-align: center;
	border-radius: 4px;
	font-weight: 700;
	font-size: 0.6875rem;
}

.t-map__rank-bar {
	display: block;
	height: 4px;
	border-radius: 2px;
	min-width: 2px;
}

/* Detail panel */
.t-map__detail {
	margin-top: var(--t-space-2xl);
}

.t-map__detail.is-hidden {
	display: none;
}

.t-map__detail-title {
	font-size: 1.25rem;
	font-weight: 700;
	color: #7f1d1d;
	margin-bottom: var(--t-space-md);
}

.t-map__detail-body {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--t-space-xl);
}

@media (min-width: 768px) {
	.t-map__detail-body {
		grid-template-columns: 240px 1fr;
	}
}

/* Bar chart in detail */
.t-map__chart-row {
	display: grid;
	grid-template-columns: 100px 1fr 36px;
	gap: var(--t-space-xs);
	align-items: center;
	margin-bottom: 6px;
	font-size: 0.8125rem;
}

.t-map__chart-label {
	color: var(--t-text-light);
	text-align: right;
}

.t-map__chart-track {
	height: 8px;
	background: var(--t-bg-alt);
	border-radius: 4px;
	overflow: hidden;
}

.t-map__chart-fill {
	display: block;
	height: 100%;
	border-radius: 4px;
	transition: width 400ms ease;
}

.t-map__chart-val {
	font-weight: 600;
	color: var(--t-text);
}

/* Detail tax cards */
.t-map__detail-list {
	display: flex;
	flex-direction: column;
	gap: var(--t-space-xs);
}

.t-map__detail-empty {
	color: var(--t-text-light);
	font-size: 0.875rem;
	font-style: italic;
}

.t-map__detail-card {
	display: block;
	padding: var(--t-space-sm) var(--t-space-md);
	background: var(--t-white);
	border: 1px solid #d1d5db;
	border-radius: var(--t-radius-md);
	text-decoration: none;
	color: #7f1d1d;
	font-size: 0.875rem;
	font-weight: 500;
	transition:
		border-color var(--t-transition-fast),
		background var(--t-transition-fast);
}

.t-map__detail-card:hover {
	border-color: #7f1d1d;
	background: #fef2f2;
}

/* Ceuta/Melilla badges */
.t-map__badges {
	display: flex;
	flex-wrap: wrap;
	gap: var(--t-space-sm);
	justify-content: center;
	margin-top: var(--t-space-md);
}

.t-map__badge {
	display: inline-block;
	padding: var(--t-space-xs) var(--t-space-md);
	background: var(--t-bg-alt);
	border: 1px solid #d1d5db;
	border-radius: var(--t-radius-md);
	font-size: 0.8125rem;
	color: var(--t-text-light);
}

/* --- Calculator --- */
.t-calc__chips {
	display: flex;
	flex-wrap: wrap;
	gap: var(--t-space-xs);
	margin-bottom: var(--t-space-md);
}

.t-calc__chip {
	padding: 4px var(--t-space-sm);
	border: 1px solid var(--t-bg-alt);
	border-radius: var(--t-radius-md);
	background: var(--t-white);
	color: var(--t-text-light);
	font-size: 0.75rem;
	font-weight: 600;
	font-family: var(--t-font-sans);
	cursor: pointer;
	transition:
		border-color var(--t-transition-fast),
		background var(--t-transition-fast),
		color var(--t-transition-fast);
}

.t-calc__chip:hover {
	border-color: var(--t-primary-light);
	color: var(--t-primary);
}

.t-calc__chip--active {
	background: var(--t-primary);
	border-color: var(--t-primary);
	color: var(--t-white);
}

/* Donut chart */
.t-calc__donut-container {
	display: flex;
	align-items: center;
	gap: var(--t-space-xl);
	margin-bottom: var(--t-space-xl);
	padding: var(--t-space-lg);
	background: var(--t-white);
	border: 1px solid #d1d5db;
	border-radius: var(--t-radius-xl);
}

.t-calc__donut {
	position: relative;
	width: 140px;
	height: 140px;
	border-radius: 50%;
	background: conic-gradient(var(--t-accent) 0%, #10b981 0%);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.t-calc__donut::after {
	content: "";
	position: absolute;
	width: 90px;
	height: 90px;
	border-radius: 50%;
	background: var(--t-white);
}

.t-calc__donut-pct {
	position: relative;
	z-index: 1;
	font-size: 1.5rem;
	font-weight: 900;
	color: var(--t-accent);
}

.t-calc__donut-label {
	position: relative;
	z-index: 1;
	font-size: 0.6875rem;
	color: var(--t-text-light);
}

.t-calc__donut-legend {
	display: flex;
	flex-direction: column;
	gap: var(--t-space-sm);
}

.t-calc__donut-legend-item {
	display: flex;
	align-items: center;
	gap: var(--t-space-xs);
	font-size: 0.9375rem;
	color: var(--t-text);
}

.t-calc__donut-swatch {
	width: 12px;
	height: 12px;
	border-radius: 2px;
	flex-shrink: 0;
}

.t-calc__donut-legend-item strong {
	font-weight: 700;
}

/* Categories */
.t-calc__categories {
	display: flex;
	flex-direction: column;
	gap: var(--t-space-xs);
	max-height: 340px;
	overflow-y: auto;
	padding-right: var(--t-space-xs);
}

.t-calc__cat {
	display: grid;
	grid-template-columns: 18px 1fr 80px 44px;
	gap: var(--t-space-xs);
	align-items: center;
	padding: var(--t-space-xs) var(--t-space-sm);
	border: 1px solid var(--t-bg-alt);
	border-radius: var(--t-radius-md);
	font-size: 0.8125rem;
	cursor: pointer;
	transition:
		border-color var(--t-transition-fast),
		opacity var(--t-transition-fast);
}

.t-calc__cat:has(input:not(:checked)) {
	opacity: 0.4;
}

.t-calc__cat input[type="checkbox"] {
	accent-color: var(--t-accent);
}

.t-calc__cat-name {
	color: var(--t-text);
	font-weight: 500;
}

.t-calc__cat-input {
	width: 70px;
	padding: 2px var(--t-space-xs);
	border: 1px solid var(--t-bg-alt);
	border-radius: 4px;
	font-size: 0.8125rem;
	text-align: right;
	font-family: var(--t-font-sans);
}

.t-calc__cat-pct {
	font-size: 0.6875rem;
	color: var(--t-text-light);
	text-align: right;
}

.t-calc {
	padding: var(--t-space-lg) 0 var(--t-space-2xl);
}

.t-calc__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--t-space-2xl);
}

@media (min-width: 768px) {
	.t-calc__grid {
		grid-template-columns: 340px 1fr;
	}
}

.t-calc__form {
	display: flex;
	flex-direction: column;
	gap: var(--t-space-md);
	background: var(--t-white);
	border: 1px solid #d1d5db;
	border-radius: var(--t-radius-lg);
	padding: var(--t-space-lg);
	position: sticky;
	top: var(--t-space-lg);
}

.t-calc__field {
	display: flex;
	flex-direction: column;
	gap: var(--t-space-xs);
}

.t-calc__label {
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--t-text-light);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.t-calc__input,
.t-calc__select {
	padding: var(--t-space-sm) var(--t-space-md);
	border: 1px solid #d1d5db;
	border-radius: var(--t-radius-md);
	font-size: 1rem;
	color: var(--t-text);
	background: var(--t-white);
}

.t-calc__input:focus,
.t-calc__select:focus {
	outline: 2px solid var(--t-primary);
	outline-offset: 1px;
	border-color: var(--t-primary);
}

.t-calc__results {
	display: flex;
	flex-direction: column;
	gap: var(--t-space-xl);
}

.t-calc__results.is-hidden {
	display: none;
}

.t-calc__results-title {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--t-primary);
}

.t-calc__big-numbers {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: var(--t-space-md);
}

.t-calc__big-number {
	background: var(--t-white);
	border: 1px solid #d1d5db;
	border-radius: var(--t-radius-lg);
	padding: var(--t-space-md);
	text-align: center;
}

.t-calc__big-value {
	display: block;
	font-size: 1.75rem;
	font-weight: 800;
	color: var(--t-primary);
	line-height: 1.2;
}

.t-calc__big-value--accent {
	color: var(--t-accent);
}

.t-calc__big-value--secondary {
	color: var(--t-secondary);
	font-size: 0.9375rem;
	font-weight: 600;
}

.t-calc__big-value--cost {
	color: var(--t-secondary);
}

.t-calc__thermo {
	margin-top: var(--t-space-lg);
	padding-top: var(--t-space-lg);
	border-top: 1px solid var(--t-bg-alt);
}

.t-calc__thermo-row {
	display: grid;
	grid-template-columns: 140px 1fr 60px;
	gap: var(--t-space-sm);
	align-items: center;
	margin-bottom: var(--t-space-md);
}

.t-calc__thermo-label {
	font-size: 0.8125rem;
	color: var(--t-text-light);
	text-align: right;
}

.t-calc__thermo-label small {
	font-size: 0.6875rem;
	color: var(--t-text-light);
	opacity: 0.7;
}

.t-calc__thermo-track {
	height: 12px;
	background: var(--t-bg-alt);
	border-radius: 6px;
	overflow: hidden;
}

.t-calc__thermo-fill {
	height: 100%;
	background: var(--t-accent);
	border-radius: 6px;
	transition: width 300ms ease;
	min-width: 2px;
}

.t-calc__thermo-fill--efectivo {
	background: var(--t-primary);
}

.t-calc__thermo-val {
	font-weight: 700;
	font-size: 0.9375rem;
	color: var(--t-text);
}

.t-calc__thermo-note {
	font-size: 0.75rem;
	color: var(--t-text-light);
	margin-top: var(--t-space-xs);
}

.t-calc__summary {
	margin-top: var(--t-space-xl);
	padding: var(--t-space-lg);
	background: linear-gradient(135deg, #fef2f2, var(--t-white));
	border: 2px solid var(--t-accent);
	border-radius: var(--t-radius-xl);
}

.t-calc__summary-title {
	font-size: 1.25rem;
	font-weight: 900;
	color: var(--t-accent);
	text-align: center;
	margin-bottom: var(--t-space-md);
}

.t-calc__summary-rows {
	max-width: 400px;
	margin: 0 auto;
}

.t-calc__summary-row {
	display: flex;
	justify-content: space-between;
	padding: var(--t-space-xs) 0;
	font-size: 0.875rem;
	color: var(--t-text);
	border-bottom: 1px solid var(--t-bg-alt);
}

.t-calc__summary-row--indent {
	padding-left: var(--t-space-lg);
	color: var(--t-text-light);
	font-size: 0.8125rem;
}

.t-calc__summary-row--result {
	font-weight: 700;
	color: #10b981;
	font-size: 0.9375rem;
	border-bottom: none;
	padding: var(--t-space-sm) 0;
}

.t-calc__summary-row strong {
	font-weight: 700;
}

.t-calc__summary-total {
	display: flex;
	justify-content: space-between;
	padding: var(--t-space-md) 0 var(--t-space-xs);
	font-size: 1rem;
	font-weight: 900;
	color: var(--t-accent);
	border-top: 2px solid var(--t-accent);
	margin-top: var(--t-space-sm);
}

.t-calc__summary-pct {
	text-align: center;
	font-size: 0.9375rem;
	color: var(--t-text-light);
}

.t-calc__summary-pct strong {
	color: var(--t-accent);
	font-weight: 900;
	font-size: 1.125rem;
}

.t-calc__big-label {
	font-size: 0.75rem;
	color: var(--t-text-light);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-top: var(--t-space-xs);
	display: block;
}

.t-calc__breakdown {
	background: var(--t-white);
	border: 1px solid #d1d5db;
	border-radius: var(--t-radius-lg);
	padding: var(--t-space-lg);
}

.t-calc__breakdown-title {
	font-size: 0.9375rem;
	font-weight: 700;
	color: var(--t-text);
	margin-bottom: var(--t-space-md);
}

.t-calc__bar {
	display: flex;
	height: 2.5rem;
	border-radius: var(--t-radius-md);
	overflow: hidden;
}

.t-calc__bar-segment {
	transition: width 300ms ease;
	min-width: 0;
}

.t-calc__bar-segment--neto {
	background: #10b981;
}
.t-calc__bar-segment--irpf {
	background: var(--t-accent);
}
.t-calc__bar-segment--ss-obrero {
	background: var(--t-secondary);
}
.t-calc__bar-segment--ss-empresa {
	background: var(--t-primary);
}

.t-calc__bar-legend {
	display: flex;
	flex-wrap: wrap;
	gap: var(--t-space-sm);
	margin-top: var(--t-space-sm);
	font-size: 0.75rem;
	color: var(--t-text-light);
}

.t-calc__bar-legend-item {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.t-calc__bar-swatch {
	width: 0.75rem;
	height: 0.75rem;
	border-radius: 2px;
	display: inline-block;
}

.t-calc__bar-swatch--neto {
	background: #10b981;
}
.t-calc__bar-swatch--irpf {
	background: var(--t-accent);
}
.t-calc__bar-swatch--ss-obrero {
	background: var(--t-secondary);
}
.t-calc__bar-swatch--ss-empresa {
	background: var(--t-primary);
}

.t-calc__detail {
	background: var(--t-white);
	border: 1px solid #d1d5db;
	border-radius: var(--t-radius-lg);
	padding: var(--t-space-lg);
}

.t-calc__detail-title {
	font-size: 0.9375rem;
	font-weight: 700;
	color: var(--t-text);
	margin-bottom: var(--t-space-md);
}

.t-calc__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.875rem;
}

.t-calc__table td {
	padding: var(--t-space-xs) 0;
}

.t-calc__table td:last-child {
	text-align: right;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
}

.t-calc__row--sub td {
	padding-left: var(--t-space-md);
	color: var(--t-text-light);
	font-size: 0.8125rem;
}

.t-calc__row--highlight td {
	font-weight: 700;
	border-top: 2px solid var(--t-primary);
	color: var(--t-primary);
}

.t-calc__row--spacer td {
	padding: 0;
	height: var(--t-space-sm);
}

.t-calc__disclaimer {
	font-size: 0.75rem;
	color: var(--t-text-light);
	text-align: center;
	font-style: italic;
	padding: var(--t-space-sm) 0;
}

/* ── Mapa Interactivo ── */
.t-map-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--t-space-lg);
    align-items: start;
}

@media (min-width: 1024px) {
    .t-map-layout {
        grid-template-columns: 3fr 2fr;
    }
}

.t-map-container {
    background: white;
    border-radius: var(--t-radius-lg);
    padding: var(--t-space-md);
    box-shadow: var(--t-shadow-sm);
    position: sticky;
    top: var(--t-space-md);
}

.t-map-svg {
    width: 100%;
    height: auto;
    max-height: 70vh;
}

.t-map-svg path,
.t-map-city {
    fill: var(--t-blue-100);
    stroke: white;
    stroke-width: 1;
    cursor: pointer;
    transition: fill var(--t-transition-fast), transform var(--t-transition-fast);
    vector-effect: non-scaling-stroke;
}

.t-map-svg path:hover,
.t-map-city:hover {
    fill: var(--t-primary-light) !important;
}

.t-map-svg--active,
.t-map-city--active {
    fill: var(--t-primary) !important;
    stroke: var(--t-primary-dark);
    stroke-width: 2;
}

/* Panel de info lateral */
.t-map-info {
    min-height: 300px;
}

.t-map-info__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--t-text-light);
    border: 2px dashed var(--t-blue-200);
    border-radius: var(--t-radius-md);
    padding: var(--t-space-xl);
}

.t-map-info__content {
    animation: fadeIn var(--t-transition-base);
}

.t-map-info__header {
    margin-bottom: var(--t-space-md);
}

.t-map-info__title {
    font-size: 1.5rem;
    color: var(--t-primary);
    margin-bottom: 0;
}

.t-map-info__count {
    font-weight: 600;
    color: var(--t-text-muted);
}

.t-map-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--t-space-md);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── CREATIVE OVERHAUL (Phase 4.1) ── */

/* 1. Dark Hero Fintech Style */
.t-home__hero {
    background: linear-gradient(135deg, var(--t-primary-dark) 0%, var(--t-primary) 100%);
    color: var(--t-white);
    padding: var(--t-space-3xl) var(--t-space-xl);
    border-radius: var(--t-radius-xl);
    margin-top: var(--t-space-md);
    box-shadow: var(--t-shadow-lg);
    position: relative;
    overflow: hidden;
}

/* Subtle background pattern for hero */
.t-home__hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.5;
    pointer-events: none;
}

.t-home__counter-number {
    background: linear-gradient(90deg, var(--t-secondary), var(--t-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none; /* remove default text shadow if any */
}

.t-home__counter-label {
    color: rgba(255, 255, 255, 0.8) !important;
}

.t-home__hook {
    color: var(--t-white);
}

.t-home__hook .t-text-accent {
    color: var(--t-secondary); /* Amber looks better on dark blue than red */
}

/* 3. Torn Receipt Effect for Quick Facts */
.t-home__facts {
    background-color: transparent;
}

.t-home__fact {
    background: var(--t-white);
    border: none;
    border-top: 1px dashed var(--t-gray-300);
    border-bottom: 1px dashed var(--t-gray-300);
    border-radius: 0;
    position: relative;
    padding: var(--t-space-xl) var(--t-space-lg);
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    margin-bottom: var(--t-space-md);
}

/* The torn edges */
.t-home__fact::before,
.t-home__fact::after {
    content: '';
    position: absolute;
    left: -5px; /* Pull out slightly */
    width: 10px;
    height: 100%;
    background-color: var(--t-bg); /* Match main background to create holes */
    background-image: radial-gradient(circle at 0px 10px, transparent 6px, var(--t-white) 7px);
    background-size: 10px 20px;
    background-repeat: repeat-y;
}

.t-home__fact::before {
    left: -4px;
    background-image: radial-gradient(circle at 0px 10px, var(--t-bg) 4px, var(--t-white) 5px);
}

.t-home__fact::after {
    left: auto;
    right: -4px;
    background-image: radial-gradient(circle at 10px 10px, var(--t-bg) 4px, var(--t-white) 5px);
}

.t-home__fact-number {
    font-family: var(--t-font-mono); /* Monospace font for receipt look */
    letter-spacing: -1px;
}
