/* Calculadora de presupuesto: solo lo propio. Lo común está en herramientas.css. */

.rvh[data-rvh="presupuesto"] [hidden] { display: none !important; }

/* Tres grupos (Ruta / Vosotros y el vehículo / Lo que pones tú): poco espacio dentro, más entre grupos y una línea. */
.rvh-presupuesto-form { gap: var(--rv-space-7); }
.rvh-presupuesto-grupo { display: grid; gap: var(--rv-space-5); min-width: 0; margin: 0; padding: 0; border: 0; }
.rvh-presupuesto-grupo + .rvh-presupuesto-grupo { padding-top: var(--rv-space-6); border-top: 1px solid var(--rv-line); }
.rvh-presupuesto-grupo__t {
	float: left; /* la leyenda entra en la rejilla como un título más */
	width: 100%;
	margin: 0;
	padding: 0;
	font-family: var(--rv-font-serif);
	font-size: var(--rv-text-lg);
	font-weight: 700;
	line-height: 1.25;
	color: var(--rv-ink);
}
.rvh-presupuesto-grupo__t + * { clear: both; }
.rvh-presupuesto-grupo__intro { margin-top: calc(-1 * var(--rv-space-3)); }

/* Filas de país: nombre | días | km */
.rvh-presupuesto-filas { display: grid; gap: var(--rv-space-2); }
.rvh-presupuesto-filas:has(.rvh-presupuesto-fila:not([hidden])) { margin-top: var(--rv-space-2); }
.rvh-presupuesto-fila {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 7.5rem) minmax(0, 9.5rem);
	gap: var(--rv-space-2);
	align-items: start;
}
.rvh-presupuesto-fila__pais { line-height: 44px; }
.rvh-presupuesto-celda { display: grid; gap: 4px; min-width: 0; align-content: start; }
.rvh-presupuesto-fila__pais,
.rvh-presupuesto-propio__pais { font-weight: 600; font-size: var(--rv-text-sm); color: var(--rv-ink); }
.rvh[data-rvh="presupuesto"] .rvh-presupuesto-fila .rvh-input,
.rvh[data-rvh="presupuesto"] .rvh-presupuesto-propio .rvh-input { min-height: 44px; flex: 0 0 auto; }
.rvh[data-rvh="presupuesto"] .rvh-presupuesto-fila input,
.rvh[data-rvh="presupuesto"] .rvh-presupuesto-propio input { font-size: var(--rv-text-base); padding: 0 var(--rv-space-3); }
.rvh[data-rvh="presupuesto"] .rvh-presupuesto-fila .rvh-input__unit,
.rvh[data-rvh="presupuesto"] .rvh-presupuesto-propio .rvh-input__unit { padding-right: var(--rv-space-3); font-size: var(--rv-text-xs); }
.rvh-presupuesto-est,
.rvh-presupuesto-ref { font-size: var(--rv-text-xs); line-height: 1.35; color: var(--rv-muted); }
.rvh-presupuesto-est { color: var(--rv-ink); }
.rvh[data-rvh="presupuesto"] .rvh-err { font-size: var(--rv-text-xs); }
.rvh-presupuesto-suma { color: var(--rv-ink); font-weight: 600; }

/* Campos con su etiqueta pequeña encima (noche, seguros, mis precios) */
.rvh-presupuesto-dos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--rv-space-2); }
.rvh[data-rvh="presupuesto"] .rvh-presupuesto-dos input,
.rvh[data-rvh="presupuesto"] .rvh-presupuesto-sub input { font-size: var(--rv-text-base); }
.rvh[data-rvh="presupuesto"] .rvh-seg--block .rvh-seg__btn { padding: 0 4px; white-space: nowrap; }
.rvh-presupuesto-sub { display: grid; gap: 4px; min-width: 0; }
.rvh-presupuesto-sub__label { font-size: var(--rv-text-xs); color: var(--rv-muted); font-weight: 500; }
.rvh-presupuesto-estilo { color: var(--rv-ink); font-weight: 600; }

/* Mis precios por país (dentro del plegable común .rvh-ajustes) */
.rvh-presupuesto-propio {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: var(--rv-space-3) var(--rv-space-2);
	padding-top: var(--rv-space-3);
	border-top: 1px solid var(--rv-line);
}
.rvh-presupuesto-propio__pais { grid-column: 1 / -1; }
.rvh[data-rvh="presupuesto"] .rvh-presupuesto-reset { justify-self: start; }

/* ---------- Resultado ---------- */
.rvh-presupuesto-res { gap: var(--rv-space-3); }
@media (min-width: 860px) {
	.rvh-presupuesto-res { padding: var(--rv-space-4) var(--rv-space-6) var(--rv-space-5); gap: 10px; }
	.rvh-presupuesto-res .rvh-big__num { font-size: clamp(2.75rem, 2rem + 2.4vw, 3.5rem); }
	.rvh-presupuesto-partidas > div { padding: 6px 0; }
}
@media (min-width: 860px) {
	/* Que quepa en la pantalla del escritorio; si no, scroll dentro del panel. */
	.rvh-presupuesto-res.rvh-result--sticky {
		max-height: calc(100vh - var(--rv-header-h, 72px) - 2 * var(--rv-space-4));
		overflow-y: auto;
		overscroll-behavior: contain;
		scrollbar-width: thin;
	}
}
.rvh-presupuesto-sin { flex-basis: 100%; color: var(--rv-ink); font-weight: 600; }
.rvh-presupuesto-dia { margin: 0; font-size: var(--rv-text-sm); font-weight: 600; color: var(--rv-ink); font-variant-numeric: tabular-nums; }
.rvh-presupuesto-partidas { display: grid; margin: 0; padding: 0; }
.rvh-presupuesto-partidas > div {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 4px var(--rv-space-4);
	align-items: baseline;
	padding: var(--rv-space-2) 0;
	border-top: 1px solid #E3DCD0;
	font-size: var(--rv-text-sm);
}
.rvh-presupuesto-partidas dt { margin: 0; color: var(--rv-muted); }
.rvh-presupuesto-partidas dd { display: contents; }
.rvh-presupuesto-partida__v { color: var(--rv-ink); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rvh-presupuesto-partida__bar {
	grid-column: 1 / -1;
	height: 5px;
	border-radius: 3px;
	background: #E6E0D6;
	overflow: hidden;
}
.rvh-presupuesto-partida__bar > span {
	display: block;
	height: 100%;
	width: 0;
	border-radius: inherit;
	background: var(--rv-ink);
	transition: width var(--rv-duration) var(--rv-ease);
}

/* Aviso con botón para ir al campo que falta */
.rvh-presupuesto-aviso > div { display: grid; gap: var(--rv-space-1, 4px); justify-items: start; }
.rvh-presupuesto-aviso p { margin: 0; }
.rvh .rvh-presupuesto-ir {
	min-height: 44px;
	margin: 0 0 -8px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--rv-ink);
	font: inherit;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

/* Tabla por país, plegada */
.rvh-presupuesto-porpais { border: 1px solid #E3DCD0; border-radius: var(--rv-radius); background: #fff; }
.rvh-presupuesto-porpais > summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--rv-space-3);
	min-height: 44px;
	padding: 0 var(--rv-space-4);
	font-size: var(--rv-text-sm);
	font-weight: 600;
	color: var(--rv-ink);
	cursor: pointer;
	list-style: none;
}
.rvh-presupuesto-porpais > summary::-webkit-details-marker { display: none; }
.rvh-presupuesto-porpais > summary b { font-weight: 500; color: var(--rv-muted); }
.rvh-presupuesto-porpais > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform var(--rv-duration) var(--rv-ease); flex: 0 0 auto; }
.rvh-presupuesto-porpais[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.rvh-presupuesto-tabla { margin: 0; border: 0; border-top: 1px solid var(--rv-line); border-radius: 0 0 var(--rv-radius) var(--rv-radius); background: #fff; }
.rvh-presupuesto-tabla .rvh-table th,
.rvh-presupuesto-tabla .rvh-table td { padding: 0.5rem 0.75rem; }
.rvh-presupuesto-tabla .rvh-table td { text-align: right; white-space: nowrap; }
.rvh-presupuesto-tabla .rvh-table thead th:not(:first-child) { text-align: right; }
.rvh-presupuesto-tabla .rvh-table thead th:first-child { text-align: left; }

/* Descarga del Excel dentro del resultado */
.rvh-presupuesto-xlsx { display: grid; gap: var(--rv-space-2); }
.rvh[data-rvh="presupuesto"] .rvh-presupuesto-xlsx .rvh-btn { justify-content: center; width: 100%; }
.rvh[data-rvh="presupuesto"] .rvh-presupuesto-xlsx .rvh-btn[aria-busy="true"] { opacity: 0.7; cursor: progress; }
.rvh-presupuesto-nocuenta { margin: 0; }

/* Botones de descarga en la página (fuera de la herramienta) */
.rvh-presupuesto-descarga { display: flex; flex-wrap: wrap; gap: var(--rv-space-3); margin: var(--rv-space-5) 0; }

@media (max-width: 520px) {
	.rvh-presupuesto-fila { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px var(--rv-space-2); }
	.rvh-presupuesto-fila__pais { grid-column: 1 / -1; line-height: 1.4; }
	.rvh-presupuesto-propio { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media print {
	.rvh-presupuesto-mis:not([open]) { display: none; }
	.rvh-presupuesto-porpais > summary { display: none; }
	.rvh-presupuesto-res.rvh-result--sticky { max-height: none; overflow: visible; }
	.rvh-presupuesto-partida__bar > span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/*
 * El tema pinta el texto de todo botón en :hover de blanco con
 * button:not(.a):not(.b):not(.c):hover {color:#fff!important}, especificidad (0,4,1),
 * que gana a las reglas comunes. Aquí se sube la especificidad para los botones claros de esta herramienta.
 */
.rvh[data-rvh="presupuesto"] .rvh-seg .rvh-seg__btn:not([aria-pressed="true"]):hover,
.rvh[data-rvh="presupuesto"] .rvh-mini .rvh-mini__go.rvh-mini__go:hover,
.rvh[data-rvh="presupuesto"] .rvh-ajustes .rvh-btn.rvh-btn--ghost:hover,
.rvh[data-rvh="presupuesto"] .rvh-alert .rvh-presupuesto-ir.rvh-presupuesto-ir:hover { color: var(--rv-ink) !important; }
