/**
 * Calculadora de Inversiones — estilos.
 *
 * Todo cuelga de .ivcalc para que el tema de WordPress no pise la calculadora
 * ni la calculadora pise al tema. Los reset puntuales existen porque los temas
 * de bloques inyectan sus propios márgenes y tipografías en h2/h3/table/p.
 */

.ivcalc {
	--iv-navy: #232a4d;
	--iv-magenta: #e6007e;
	--iv-bg: #f4f6fb;
	--iv-panel: #ffffff;
	--iv-panel-2: #f0f3f9;
	--iv-border: #e2e7f0;
	--iv-text: #232a4d;
	--iv-muted: #6b7385;
	--iv-accent: #10b4c7;
	--iv-accent-dark: #0a8595;
	--iv-accent-soft: rgba( 16, 180, 199, 0.12 );
	--iv-green: #1f9d57;
	--iv-radius: 14px;

	background: var( --iv-bg );
	color: var( --iv-text );
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
}

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

/**
 * Ancho completo.
 *
 * El trabajo pesado lo hace la clase `alignfull` que añade el propio plugin: los
 * temas de bloques excluyen .alignfull de su regla de ancho máximo y le dan un
 * desbordamiento que descuenta el padding de la raíz. Aquí solo se levanta el
 * tope de ancho, porque algunos temas lo aplican igualmente.
 */
.ivcalc-full {
	max-width: none;
}

/**
 * Respaldo para temas clásicos y maquetadores que ignoran `alignfull`
 * (shortcode con ancho="pantalla").
 *
 * calc(50% - 50vw) es autocorrectivo: si el contenedor ya ocupa todo el ancho,
 * el margen resultante es cero y no se rompe nada dos veces. El !important es
 * necesario para ganarle al `margin-left: auto !important` del tema.
 */
.ivcalc-bleed {
	width: auto !important;
	max-width: none !important;
	margin-left: calc( 50% - 50vw ) !important;
	margin-right: calc( 50% - 50vw ) !important;
}

/* ------------------------------- Estructura ------------------------------- */

.ivcalc-brandbar {
	background: var( --iv-navy );
	padding: 18px 20px;
}

.ivcalc-brandbar img {
	height: 42px;
	width: auto;
	display: block;
	max-width: 100%;
	margin: 0 auto;
}

.ivcalc-wrap {
	max-width: 1080px;
	margin: 0 auto;
	padding: 32px 20px 64px;
}

.ivcalc-header {
	margin-bottom: 28px;
}

.ivcalc-header h2 {
	font-size: 24px;
	margin: 0 0 4px;
	padding: 0;
	letter-spacing: -0.01em;
	color: var( --iv-navy );
	line-height: 1.25;
}

.ivcalc-header p {
	margin: 0;
	color: var( --iv-muted );
	font-size: 14px;
}

.ivcalc-section-title {
	font-size: 13px;
	color: var( --iv-muted );
	text-transform: uppercase;
	letter-spacing: 0.06em;
	margin: 28px 0 12px;
}

.ivcalc-mt0 {
	margin-top: 0;
}

/* -------------------------------- Leyenda --------------------------------- */

.ivcalc-legend {
	display: grid;
	grid-template-columns: 1fr;
	gap: 12px;
	margin-bottom: 28px;
}

@media ( min-width: 680px ) {
	.ivcalc-legend {
		grid-template-columns: repeat( 3, 1fr );
	}
}

.ivcalc-legend-item {
	background: var( --iv-panel );
	border: 1px solid var( --iv-border );
	border-radius: 12px;
	padding: 14px 16px;
	box-shadow: 0 1px 3px rgba( 35, 42, 77, 0.06 );
}

.ivcalc-sig {
	display: inline-block;
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 999px;
	background: var( --iv-accent-soft );
	color: var( --iv-accent-dark );
	margin-bottom: 8px;
}

.ivcalc-nm {
	font-weight: 600;
	color: var( --iv-navy );
	font-size: 14px;
}

.ivcalc-ds {
	color: var( --iv-muted );
	font-size: 12.5px;
	margin-top: 4px;
}

/* -------------------------------- Controles -------------------------------- */

.ivcalc-controls {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	align-items: flex-end;
	background: var( --iv-panel );
	border: 1px solid var( --iv-border );
	border-radius: var( --iv-radius );
	padding: 20px;
	margin-bottom: 24px;
	box-shadow: 0 1px 3px rgba( 35, 42, 77, 0.06 );
}

.ivcalc-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.ivcalc-field label {
	font-size: 12px;
	color: var( --iv-muted );
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-weight: 500;
}

.ivcalc-field input[type="text"],
.ivcalc-field input[type="email"],
.ivcalc-field input[type="tel"] {
	background: var( --iv-panel-2 );
	border: 1px solid var( --iv-border );
	color: var( --iv-text );
	border-radius: 10px;
	padding: 11px 13px;
	font-size: 16px;
	width: 200px;
	max-width: 100%;
	outline: none;
	font-family: inherit;
}

.ivcalc-field input:focus,
.ivcalc-field select:focus {
	border-color: var( --iv-accent );
	box-shadow: 0 0 0 3px var( --iv-accent-soft );
}

.ivcalc-hint {
	font-size: 11px;
	color: var( --iv-muted );
}

.ivcalc-field select {
	background-color: var( --iv-panel-2 );
	border: 1px solid var( --iv-border );
	color: var( --iv-text );
	border-radius: 10px;
	padding: 11px 38px 11px 13px;
	font-size: 16px;
	width: 320px;
	max-width: 100%;
	outline: none;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	font-family: inherit;
	background-image: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7385' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E" );
	background-repeat: no-repeat;
	background-position: right 14px center;
}

/* --------------------------------- Botones --------------------------------- */

.ivcalc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	border-radius: 10px;
	padding: 13px 20px;
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	border: 1px solid transparent;
	line-height: 1;
	font-family: inherit;
	transition: filter 0.12s, background 0.12s, box-shadow 0.12s;
	white-space: nowrap;
}

.ivcalc-btn svg {
	flex: 0 0 auto;
}

.ivcalc-btn-wa {
	background: #25d366;
	color: #fff;
	box-shadow: 0 2px 6px rgba( 37, 211, 102, 0.3 );
}

.ivcalc-btn-wa:hover {
	filter: brightness( 0.96 );
	color: #fff;
}

.ivcalc-btn-excel {
	background: var( --iv-panel );
	color: var( --iv-navy );
	border-color: var( --iv-border );
}

.ivcalc-btn-excel:hover:not( :disabled ) {
	background: var( --iv-panel-2 );
	border-color: var( --iv-accent );
}

.ivcalc-btn-primary {
	background: var( --iv-magenta );
	color: #fff;
	width: 100%;
	margin-top: 4px;
}

.ivcalc-btn-primary:hover:not( :disabled ) {
	filter: brightness( 0.95 );
}

.ivcalc-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.ivcalc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin: 4px 0 26px;
}

.ivcalc-cta-final {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	text-align: center;
	background: var( --iv-panel );
	border: 1px solid var( --iv-border );
	border-radius: var( --iv-radius );
	padding: 26px 20px;
	margin-top: 40px;
	box-shadow: 0 1px 3px rgba( 35, 42, 77, 0.06 );
}

.ivcalc-cta-final p {
	margin: 0;
	color: var( --iv-muted );
	font-size: 14px;
}

.ivcalc-cta-final .ivcalc-btn {
	padding: 14px 28px;
	font-size: 16px;
}

/* --------------------------------- Detalle --------------------------------- */

.ivcalc-print-header {
	display: none;
}

.ivcalc-detail {
	margin-top: 36px;
}

.ivcalc-detail[hidden] {
	display: none;
}

.ivcalc-detail-head {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 16px;
}

.ivcalc-detail-head h3 {
	margin: 0;
	padding: 0;
	font-size: 20px;
	color: var( --iv-navy );
	line-height: 1.3;
}

.ivcalc-sub {
	color: var( --iv-muted );
	font-size: 13px;
	margin-top: 2px;
}

.ivcalc-tickers {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.ivcalc-tag {
	display: inline-block;
	font-size: 11px;
	padding: 3px 10px;
	border-radius: 999px;
	background: var( --iv-navy );
	border: 1px solid var( --iv-navy );
	color: #fff;
	font-weight: 600;
	letter-spacing: 0.02em;
}

.ivcalc-warning {
	background: #fff6e5;
	border: 1px solid #f0c26b;
	color: #7a5300;
	border-radius: 10px;
	padding: 12px 14px;
	font-size: 13.5px;
	margin-bottom: 16px;
}

.ivcalc-warning[hidden] {
	display: none;
}

.ivcalc-stats {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 160px, 1fr ) );
	gap: 12px;
	margin-bottom: 20px;
}

.ivcalc-stat {
	background: var( --iv-panel );
	border: 1px solid var( --iv-border );
	border-radius: 12px;
	padding: 14px 16px;
	box-shadow: 0 1px 3px rgba( 35, 42, 77, 0.06 );
}

.ivcalc-k {
	font-size: 11px;
	color: var( --iv-muted );
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.ivcalc-v {
	font-size: 20px;
	font-weight: 600;
	margin-top: 4px;
	font-variant-numeric: tabular-nums;
	color: var( --iv-navy );
}

.ivcalc-grid2 {
	display: grid;
	grid-template-columns: 1fr;
	gap: 20px;
}

@media ( min-width: 760px ) {
	.ivcalc-grid2 {
		grid-template-columns: 1.4fr 1fr;
	}
}

/* --------------------------------- Tablas ---------------------------------- */

.ivcalc-card {
	background: var( --iv-panel );
	border: 1px solid var( --iv-border );
	border-radius: var( --iv-radius );
	overflow: hidden;
	box-shadow: 0 1px 3px rgba( 35, 42, 77, 0.06 );
}

.ivcalc-scrollbox {
	max-height: 420px;
	overflow: auto;
}

.ivcalc table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
	margin: 0;
	background: transparent;
}

.ivcalc th,
.ivcalc td {
	padding: 12px 14px;
	text-align: right;
	border: none;
	border-bottom: 1px solid var( --iv-border );
}

.ivcalc th:first-child,
.ivcalc td:first-child {
	text-align: left;
}

.ivcalc thead th {
	font-size: 11px;
	color: var( --iv-muted );
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-weight: 600;
	background: var( --iv-panel-2 );
}

.ivcalc tbody tr:last-child td {
	border-bottom: none;
}

.ivcalc tfoot td {
	font-weight: 700;
	background: var( --iv-panel-2 );
}

.ivcalc-num {
	font-variant-numeric: tabular-nums;
}

.ivcalc-pos {
	color: var( --iv-green );
	font-weight: 600;
}

/* ---------------------------------- Pie ------------------------------------ */

.ivcalc-footer {
	margin-top: 48px;
	color: var( --iv-muted );
	font-size: 12px;
	text-align: center;
}

.ivcalc-disc {
	max-width: 680px;
	margin: 8px auto 0;
	line-height: 1.5;
}

/* ---------------------------- Modal de captura ----------------------------- */

.ivcalc-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.ivcalc-modal[hidden] {
	display: none;
}

.ivcalc-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba( 35, 42, 77, 0.55 );
}

.ivcalc-modal-box {
	position: relative;
	background: var( --iv-panel );
	border-radius: var( --iv-radius );
	padding: 28px 26px 26px;
	width: 100%;
	max-width: 420px;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 20px 50px rgba( 35, 42, 77, 0.3 );
}

.ivcalc-modal-box h3 {
	margin: 0 0 6px;
	padding: 0;
	font-size: 19px;
	color: var( --iv-navy );
	line-height: 1.3;
}

.ivcalc-modal-lead {
	margin: 0 0 18px;
	color: var( --iv-muted );
	font-size: 13.5px;
}

.ivcalc-modal-box .ivcalc-field {
	margin-bottom: 14px;
}

.ivcalc-modal-box .ivcalc-field input {
	width: 100%;
}

.ivcalc-modal-x {
	position: absolute;
	top: 10px;
	right: 12px;
	background: none;
	border: none;
	font-size: 26px;
	line-height: 1;
	color: var( --iv-muted );
	cursor: pointer;
	padding: 4px 8px;
}

.ivcalc-consent {
	display: flex;
	gap: 9px;
	align-items: flex-start;
	font-size: 12px;
	color: var( --iv-muted );
	line-height: 1.45;
	margin: 4px 0 14px;
	cursor: pointer;
	text-transform: none;
	letter-spacing: 0;
}

.ivcalc-consent input {
	margin-top: 2px;
	flex: 0 0 auto;
}

.ivcalc-modal-error {
	background: #fdeaea;
	border: 1px solid #f0a5a5;
	color: #a11;
	border-radius: 8px;
	padding: 9px 12px;
	font-size: 13px;
	margin-bottom: 12px;
}

.ivcalc-modal-error[hidden] {
	display: none;
}

/* Honeypot: fuera de pantalla, nunca oculto con display:none — algunos bots
   detectan display:none y saltean el campo. */
.ivcalc-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---------------------------------- Móvil ---------------------------------- */

@media ( max-width: 620px ) {
	.ivcalc-field input[type="text"],
	.ivcalc-field select {
		width: 100%;
	}

	.ivcalc-controls .ivcalc-field {
		flex: 1 1 100%;
	}

	.ivcalc-stats {
		grid-template-columns: repeat( 2, 1fr );
	}

	.ivcalc-actions .ivcalc-btn {
		flex: 1 1 100%;
	}

	.ivcalc-grid2 > div {
		min-width: 0;
	}

	.ivcalc-grid2 .ivcalc-card {
		overflow-x: auto;
		min-width: 0;
	}

	/* Sin scroll interno vertical en móvil: la página se desplaza sola. Evita el
	   bloque de espacio vacío del bug de scroll anidado en iOS. */
	.ivcalc-scrollbox {
		max-height: none;
		overflow-x: auto;
		overflow-y: visible;
	}

	.ivcalc table {
		font-size: 11px;
	}

	.ivcalc th,
	.ivcalc td {
		padding: 8px 6px;
		white-space: nowrap;
	}

	/* Encabezados abreviados: se oculta el texto largo y se muestra la sigla. */
	.ivcalc thead th {
		font-size: 0;
		letter-spacing: 0;
	}

	.ivcalc thead th::after {
		content: attr( data-short );
		font-size: 10px;
		letter-spacing: 0.02em;
	}
}

/* ------------------------------- Impresión --------------------------------- */

@media print {
	body.ivcalc-printing * {
		visibility: hidden;
	}

	body.ivcalc-printing .ivcalc-print-active .ivcalc-detail,
	body.ivcalc-printing .ivcalc-print-active .ivcalc-detail * {
		visibility: visible;
	}

	body.ivcalc-printing .ivcalc-print-active .ivcalc-detail {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		margin: 0;
	}

	body.ivcalc-printing .ivcalc-print-active .ivcalc-print-header {
		display: block;
		margin-bottom: 18px;
	}

	.ivcalc-pTitle {
		font-weight: 700;
		color: var( --iv-navy );
		font-size: 16px;
	}

	.ivcalc-pMeta {
		color: var( --iv-muted );
		font-size: 11px;
		margin-top: 2px;
	}

	body.ivcalc-printing .ivcalc-actions,
	body.ivcalc-printing .ivcalc-warning {
		display: none !important;
	}

	body.ivcalc-printing .ivcalc-scrollbox {
		max-height: none;
		overflow: visible;
	}
}

/* ==========================================================================
   Calculadora de Notas de Crédito
   Solo lo que le es propio: el resto de reglas (.ivcalc-btn, .ivcalc-card,
   tablas, modal, impresión, ancho completo) se reutiliza tal cual.
   ========================================================================== */

/* Es una sola cifra de entrada y otra de salida: no necesita los 1080 px. */
.ivcalc-wrap-estrecho {
	max-width: 860px;
}

/* Ficha del título: datos fijos del papel, como texto fino bajo el encabezado. */
.ivcalc-ficha {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 22px;
	margin: 10px 0 4px;
	font-size: 13.5px;
	color: var( --iv-muted );
}

.ivcalc-ficha-item {
	display: inline-flex;
	gap: 6px;
}

.ivcalc-ficha-v {
	color: var( --iv-navy );
	font-weight: 600;
}

/* Entrada a la izquierda, resultado a la derecha. */
.ivcalc-calc {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
	margin: 22px 0;
}

@media ( min-width: 640px ) {
	.ivcalc-calc {
		grid-template-columns: 1fr 1fr;
		align-items: stretch;
	}
}

.ivcalc-controls-nc {
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 22px 24px;
	margin: 0;
}

.ivcalc-controls-nc .ivcalc-field {
	width: 100%;
}

.ivcalc .ivcalc-input-grande {
	width: 100%;
	font-size: 20px;
	font-weight: 600;
	padding: 13px 15px;
	font-variant-numeric: tabular-nums;
}

/* El valor efectivo es lo único que el visitante viene a ver: va en negativo
   sobre el azul de marca para que no compita con nada más de la página. */
.ivcalc-result {
	background: var( --iv-navy );
	border-radius: var( --iv-radius );
	padding: 24px 26px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	box-shadow: 0 6px 20px rgba( 35, 42, 77, 0.18 );
}

.ivcalc-result-k {
	font-size: 11px;
	color: rgba( 255, 255, 255, 0.65 );
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.ivcalc-result-v {
	font-size: 38px;
	font-weight: 700;
	margin-top: 6px;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	color: #fff;
}

.ivcalc-result-meta {
	margin-top: 12px;
	font-size: 13px;
	color: rgba( 255, 255, 255, 0.72 );
	font-variant-numeric: tabular-nums;
}

.ivcalc-result-meta b {
	color: #fff;
	font-weight: 600;
}

@media ( max-width: 620px ) {
	.ivcalc-result-v {
		font-size: 30px;
	}
}

/* Tramo aplicado en la tabla de rangos. */
.ivcalc tbody tr.ivcalc-activo {
	background: var( --iv-accent-soft );
	box-shadow: inset 3px 0 0 var( --iv-accent );
}

.ivcalc-tag-aplicado {
	display: inline-block;
	font-size: 11px;
	padding: 2px 8px;
	border-radius: 999px;
	background: var( --iv-accent-soft );
	border: 1px solid rgba( 16, 180, 199, 0.35 );
	color: var( --iv-accent-dark );
	font-weight: 600;
}

.ivcalc-nota {
	background: #fff8ec;
	border: 1px solid #f2e2bd;
	color: #8a6d2f;
	border-radius: 12px;
	padding: 12px 15px;
	font-size: 12.5px;
	margin: 16px 0 0;
	line-height: 1.5;
}

/* En impresión sobra el campo de entrada: la cotización ya lleva el nominal
   en la cabecera y el resultado debe ocupar el ancho completo de la hoja. */
@media print {
	body.ivcalc-printing .ivcalc-print-active .ivcalc-controls-nc {
		display: none !important;
	}

	body.ivcalc-printing .ivcalc-print-active .ivcalc-calc {
		display: block !important;
	}
}
